Beispiel #1
0
 public void ToIcuLocale_UnknownLanguageTags_ReturnsIcuLocales()
 {
     // language, private use script
     Assert.AreEqual("en_Fake", IetfLanguageTag.ToIcuLocale("en-Qaaa-x-Fake"));
     // language, private use script, private use region
     Assert.AreEqual("en_Fake_QD", IetfLanguageTag.ToIcuLocale("en-Qaaa-QM-x-Fake-QD"));
     // private use language, script
     Assert.AreEqual("xzzz_Latn", IetfLanguageTag.ToIcuLocale("qaa-Latn-x-zzz"));
 }
Beispiel #2
0
 public void ToIcuLocale_PrivateUseLanguageTags_ReturnsPrivateUseIcuLocales()
 {
     // private use language
     Assert.AreEqual("xkal", IetfLanguageTag.ToIcuLocale("qaa-x-kal"));
     // private use language, ICU variant
     Assert.AreEqual("xkal__X_ETIC", IetfLanguageTag.ToIcuLocale("qaa-fonipa-x-kal-etic"));
     // private use language, private use region
     Assert.AreEqual("xkal_XA", IetfLanguageTag.ToIcuLocale("qaa-QM-x-kal-XA"));
     // private use language, private use script
     Assert.AreEqual("xkal_Fake", IetfLanguageTag.ToIcuLocale("qaa-Qaaa-x-kal-Fake"));
 }
Beispiel #3
0
 public void ToIcuLocale_EnglishLanguageTags_ReturnsEnglishIcuLocales()
 {
     // language
     Assert.AreEqual("en", IetfLanguageTag.ToIcuLocale("en"));
     // language, script
     Assert.AreEqual("en", IetfLanguageTag.ToIcuLocale("en-Latn"));
     // language, region
     Assert.AreEqual("en_US", IetfLanguageTag.ToIcuLocale("en-US"));
     // language, script, region, ICU variant
     Assert.AreEqual("en_US_X_ETIC", IetfLanguageTag.ToIcuLocale("en-Latn-US-fonipa-x-etic"));
     // language, ICU variant
     Assert.AreEqual("en__X_EMIC", IetfLanguageTag.ToIcuLocale("en-fonipa-x-emic"));
 }
Beispiel #4
0
 public void ToIcuLocale_InvalidLangTag_Throws()
 {
     IetfLanguageTag.ToIcuLocale("en_Latn_US_X_ETIC");
 }
Beispiel #5
0
 public void ToIcuLocale_ChineseLanguageTag_ReturnsChineseIcuLocale()
 {
     // language, region, ICU variant
     Assert.AreEqual("zh_Latn_CN_X_PY", IetfLanguageTag.ToIcuLocale("zh-Latn-CN-pinyin"));
 }
 public void ToIcuLocale_InvalidLangTag_Throws()
 {
     Assert.Throws <ArgumentException>(() => IetfLanguageTag.ToIcuLocale("en_Latn_US_X_ETIC"));
 }