end
def test_list
- assert_equal [], Locale.list
+ assert_empty Locale.list
assert_equal [EN], Locale.list("en")
assert_equal [EN, ZH_YUE, ZH_HANT_TW], Locale.list("en", "zh-yue", "zh-Hant-TW")
assert_equal [ZH_YUE, ZH_HANT_TW], Locale.list("en;de", "zh-yue", "zh-Hant-TW")
end
def test_available
- assert_equal I18n.available_locales.count, Locale.available.count
+ assert Locale.available.count <= I18n.available_locales.count
end
def test_preferred
assert_equal "de", Locale.available.preferred(Locale.list("zh-Hant", "de")).to_s
assert_equal "zh-TW", Locale.available.preferred(Locale.list("zh-Hant-TW", "de")).to_s
assert_equal "zh-TW", Locale.available.preferred(Locale.list("zh-TW", "de")).to_s
- assert_equal "zh-HK", Locale.available.preferred(Locale.list("yue", "zh-HK", "de")).to_s
- assert_equal "zh-yue", Locale.available. preferred(Locale.list("yue", "zh-yue", "zh-HK", "de")).to_s
- assert_equal "zh-yue", Locale.available. preferred(Locale.list("yue", "zh-YUE", "zh-HK", "de")).to_s
+ assert_equal "zh-HK", Locale.available.preferred(
+ Locale.list("zh-HK", "zh-hk", "zh-Hant", "zh-hant", "zh-TW", "zh-tw", "zh", "zh-yue",
+ "yue", "yue-Hant", "yue-HK", "yue-Hans", "zh-classical", "lzh", "ja-Hani",
+ "ko-Hani", "ko_hanja", "vi-Hani", "ja-hani", "ko-hani", "vi-hani", "en-HK",
+ "en-hk", "en-SG", "en-sg", "en-GB", "en-gb", "en-US", "en-us", "en", "ja")
+ ).to_s
assert_equal "en", Locale.available.preferred(Locale.list("yue")).to_s
end
end