Esempio n. 1
0
        public void LocaleNames_Factory_ForCultureInfo_Existing_Culture_Test()
        {
            var translations = LocaleTranslations.ForCultureInfo(new System.Globalization.CultureInfo("en-US"));

            Assert.AreEqual(new System.Globalization.CultureInfo("en-US"), translations.CultureInfo);
            Assert.IsFalse(translations.AreCountryNameTranslationsEmpty);
            Assert.IsFalse(translations.AreLanguageTranslationsEmpty);
        }
Esempio n. 2
0
        public void LocaleNames_Is_loading_from_cache()
        {
            LocaleTranslations.ClearCache();
            var localeName = LocaleTranslations.ForCultureInfo(new CultureInfo("cs-CZ"));

            Assert.IsFalse(localeName.IsFromCache);

            localeName = LocaleTranslations.ForCultureInfo(new CultureInfo("cs-CZ"));

            Assert.IsTrue(localeName.IsFromCache);
        }
Esempio n. 3
0
        public void LocaleNames_Find_language_name_for_given_culture()
        {
            var localeNames = LocaleTranslations.ForCultureInfo(new CultureInfo("cs-CZ"));

            Assert.AreEqual("angličtina (USA)", localeNames.FindLanguageName("en-US"));

            Assert.AreEqual("němčina (walser)", localeNames.FindLanguageName("wae"));

            Assert.AreEqual("čínština (tradiční)", localeNames.FindLanguageName("zh-Hant"));

            Assert.AreEqual(null, localeNames.FindLanguageName("unknown code"));

            localeNames = LocaleTranslations.ForCultureInfo(new CultureInfo("yue"));

            Assert.AreEqual("德文", localeNames.FindLanguageName("de"));

            Assert.AreEqual("捷克文", localeNames.FindLanguageName("cs"));

            Assert.AreEqual("英文 (美國)", localeNames.FindLanguageName("en-US"));
        }