Esempio n. 1
0
        public void Test04_TODOKeyReturnsEnglishTest()
        {
            LoadTranslationsIfNotLoaded();

            //in the event that a language has a TODO key (not translated yet), make sure that the returned item is English
            string    key  = string.Empty;
            Languages lang = Languages.English;

            //check for each key in the English dictionary
            foreach (string key_ in Translations.GetLanguageDictionaries(Languages.English).Keys)
            {
                //for each key, check the other language dictionaries
                foreach (Languages lang_ in Translations.SupportedLanguages)
                {
                    if (lang_ == Languages.English)
                    {
                        continue;
                    }

                    if (Translations.Exists(key_, lang_) && Translations.GetLanguageDictionaries(lang_)[key_].Equals(Translations.TranslationNeeded))
                    {
                        key  = key_;
                        lang = lang_;
                        break;
                    }
                }
                if (!string.IsNullOrEmpty(key))
                {
                    break;
                }
            }

            //if key is still blank, then we have no TODO translations. Which is a good thing i guess
            if (string.IsNullOrEmpty(key))
            {
                return;
            }

            //set the language to the one with the TODO, and ensure that the English phrase is returned
            Translations.SetLanguage(lang);
            Assert.AreEqual(Translations.GetLanguageDictionaries(Languages.English)[key], Translations.GetTranslatedString(key));
        }