summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-01-12 17:57:45 -0500
committerLinus Groh <mail@linusgroh.de>2022-01-13 13:43:57 +0100
commitadb762ee48c10f0f07d6a0f314b1d80ef74ec600 (patch)
tree1d31690af3617d3af902fa84e30cb9b2af75f67c
parent8126cb25457a0a0bcbee8b5250eff1ee3eaf9a89 (diff)
downloadserenity-adb762ee48c10f0f07d6a0f314b1d80ef74ec600.zip
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.
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp
index 8633841cea..0c51b3717b 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp
@@ -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: