Browse Source

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.
Timothy Flynn 3 years ago
parent
commit
adb762ee48
1 changed files with 1 additions and 0 deletions
  1. 1 0
      Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp

+ 1 - 0
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: