mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 19:19:44 +03:00
LibUnicode: Perform complex Unicode locale alias substitution
This commit is contained in:
parent
9ae7ac4c87
commit
72f49e42b4
Notes:
sideshowbarker
2024-07-18 04:57:12 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/72f49e42b49 Pull-request: https://github.com/SerenityOS/serenity/pull/9705 Reviewed-by: https://github.com/linusg ✅
@ -410,4 +410,20 @@ TEST_CASE(canonicalize_unicode_locale_id)
|
||||
test("EN-U-RG-CN12"sv, "en-u-rg-cntj"sv);
|
||||
test("en-u-aa-cn11"sv, "en-u-aa-cn11"sv);
|
||||
test("EN-U-AA-CN11"sv, "en-u-aa-cn11"sv);
|
||||
|
||||
// Complex aliases.
|
||||
test("en-lojban"sv, "en"sv);
|
||||
test("EN-LOJBAN"sv, "en"sv);
|
||||
test("art-lojban"sv, "jbo"sv);
|
||||
test("ART-LOJBAN"sv, "jbo"sv);
|
||||
test("cel-gaulish"sv, "xtg"sv);
|
||||
test("CEL-GAULISH"sv, "xtg"sv);
|
||||
test("zh-guoyu"sv, "zh"sv);
|
||||
test("ZH-GUOYU"sv, "zh"sv);
|
||||
test("zh-hakka"sv, "hak"sv);
|
||||
test("ZH-HAKKA"sv, "hak"sv);
|
||||
test("zh-xiang"sv, "hsn"sv);
|
||||
test("ZH-XIANG"sv, "hsn"sv);
|
||||
test("ja-latn-hepburn-heploc"sv, "ja-Latn-alalc97"sv);
|
||||
test("JA-LATN-HEPBURN-HEPLOC"sv, "ja-Latn-alalc97"sv);
|
||||
}
|
||||
|
@ -568,6 +568,10 @@ static void transform_unicode_locale_id_to_canonical_syntax(LocaleID& locale_id)
|
||||
for (auto& variant : language_id.variants)
|
||||
variant = variant.to_lowercase();
|
||||
|
||||
#if ENABLE_UNICODE_DATA
|
||||
Detail::resolve_complex_language_aliases(language_id);
|
||||
#endif
|
||||
|
||||
if (auto alias = resolve_language_alias(*language_id.language); alias.has_value()) {
|
||||
auto language_alias = parse_unicode_language_id(*alias);
|
||||
VERIFY(language_alias.has_value());
|
||||
|
Loading…
Reference in New Issue
Block a user