Exemplo n.º 1
0
 public void LookupAriffTest()
 {
     string expected = "عريف";
     string actual = "";
     JawiLookup target = new JawiLookup();
     actual = target.Lookup("ariff");
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 2
0
 public void LookupMuhdTest()
 {
     string expected = "محمد";
     string actual = "";
     JawiLookup target = new JawiLookup();
     actual = target.Lookup("Muhd");
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Automate convert to jawi when provide rumi name.
        /// </summary>
        /// <param name="rumi">Rumi word.</param>
        public string ConvertToJawi(string rumi)
        {
            // Translate word by word
            string output = string.Empty;
            JawiLookup localTranslator = new JawiLookup();
            JawiTranslator webTranslator = new JawiTranslator();
            string[] words = rumi.Split(new char[] { ' ' });
            foreach (string word in words)
            {
                string jawi = localTranslator.Lookup(word);
                if (string.IsNullOrEmpty(jawi))
                    jawi = webTranslator.Translate(word);

                if (output.Length > 0) output += " ";
                output += jawi;
            }

            this.jawiField = output;
            this.OnPropertyChanged("jawi");
            return output;
        }