Пример #1
0
        public void SetLanguage(string lang)
        {
            string language = null;

            try
            {
                language = Utils.getLang(lang);
            }
            catch (Utils.LangExeption e)
            {
                Console.WriteLine($"Ошибка: {e.Message}");
                language = "ru-en";
            }

            nameRequestUniversity = yandexTranslate.Translate(nameRequestUniversity, language);
            nameRequestRating     = yandexTranslate.Translate(nameRequestRating, language);

            university       = yandexTranslate.Translate(university, language);
            ratingAverage    = yandexTranslate.Translate(ratingAverage, language);
            selectedLanguage = yandexTranslate.Translate(selectedLanguage, language);

            buttonNameRequest = yandexTranslate.Translate(buttonNameRequest, language);
            buttonSavePdf     = yandexTranslate.Translate(buttonSavePdf, language);
            buttonSaveExcel   = yandexTranslate.Translate(buttonSaveExcel, language);

            Constant.onSuccessRequestMessage = yandexTranslate.Translate(Constant.onSuccessRequestMessage, language);
            Constant.onSuccessSaveMessage    = yandexTranslate.Translate(Constant.onSuccessSaveMessage, language);
            Constant.onErrorExcelEmptyData   = yandexTranslate.Translate(Constant.onErrorExcelEmptyData, language);
            Constant.onErrorExcelEmptyPath   = yandexTranslate.Translate(Constant.onErrorExcelEmptyPath, language);
            Constant.onErrorSetLanguage      = yandexTranslate.Translate(Constant.onErrorSetLanguage, language);
            Constant.onErrorSetCity          = yandexTranslate.Translate(Constant.onErrorSetCity, language);

            for (int i = 0; i < Constant.comboLanguage.Count(); i++)
            {
                Constant.comboLanguage[i] = yandexTranslate.Translate(Constant.comboLanguage[i], language);
            }
        }
Пример #2
0
 public void SetLanguageWithTread()
 {
     text = yandexTranslate.Translate(text, lang);
 }