mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibJS: Add FIXME regarding [[LanguageDisplay]] internal slot handling
This is supposed to work as follows (grabbed from SpiderMonkey): > opt = { type: "language", languageDisplay: "dialect" }; > new Intl.DisplayNames([], opt).of("en-US"); "American English" > opt = { type: "language", languageDisplay: "standard" }; > new Intl.DisplayNames([], opt).of("en-US"); "English (United States)" We currently display the "dialect" variant. We will need to figure out how to display the "standard" variant. I think the way it works is that we take the display names of "en" (language) and "US" (region) and format them according to this pattern in localeDisplayNames.json: "localeDisplayNames": { "localeDisplayPattern": { "localePattern": "{0} ({1})", }, }, But I'd like to confirm this before implementing it.
This commit is contained in:
parent
8126cb2545
commit
adb762ee48
Notes:
sideshowbarker
2024-07-17 20:57:09 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/adb762ee48c Pull-request: https://github.com/SerenityOS/serenity/pull/11847
@ -54,6 +54,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::of)
|
||||
|
||||
switch (display_names->type()) {
|
||||
case DisplayNames::Type::Language:
|
||||
// FIXME: Handle the [[LanguageDisplay]] internal slot once we know where that data comes from.
|
||||
result = Unicode::get_locale_language_mapping(display_names->locale(), code.as_string().string());
|
||||
break;
|
||||
case DisplayNames::Type::Region:
|
||||
|
Loading…
Reference in New Issue
Block a user