Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.InputEncoding  = Encoding.Unicode;
            Console.OutputEncoding = Encoding.Unicode;

            do
            {
                Console.Write("\nВведіть текст для транслітерації: ");

                string input = Console.ReadLine();

                Console.WriteLine("Результат: {0} \nБажаєте продовжити (Т/Н)? ",
                                  Transliterator.GetTransliteration(input, Language.Ukrainian));
            }while (Console.ReadKey().Key == ConsoleKey.N); //english 'N' button = Ukrainian 'T' button
        }
Esempio n. 2
0
        // Parameter args - pathes to the files, that includes dictionaries and input text
        public static void Main(string[] args)
        {
            try
            {
                // declaration
                string            inputText;
                DictionaryBuilder dictionaryBuilder = new DictionaryBuilder();
                Transliterator    transliterator    = new Transliterator();

                // initializing dictionaries
                Dictionary <string, string> cyrillicLatinDictionary = dictionaryBuilder.BuildFromFile(args[0]);
                Dictionary <string, string> latinCyrillicDictionary = dictionaryBuilder.BuildFromFile(args[1]);

                // transliteration process
                using (StreamReader file = new StreamReader(args[2], Encoding.Default))
                {
                    inputText = file.ReadToEnd();
                }
                string inLatinText = transliterator.Translit(inputText, cyrillicLatinDictionary);
                string inCyrilText = transliterator.Translit(inLatinText, latinCyrillicDictionary);

                // results
                Console.WriteLine(DefaultText);
                Console.WriteLine(inputText);

                Console.WriteLine(AfterTransliteration);
                Console.WriteLine(inLatinText);

                Console.WriteLine(ReverseTransliteration);
                Console.WriteLine(inCyrilText);

                Console.ReadKey();
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
                Console.ReadKey();
            }
        }
Esempio n. 3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Transliterator t = new Transliterator();
     Output.Text = t.Transliterate(Input.Text);
 }