Ignore:
Timestamp:
Feb 27, 2016, 4:36:01 PM (9 years ago)
Author:
[email protected]
Message:

Intl.Collator uses POSIX locale (detected by js/intl-collator.html on iOS Simulator)
https://bugs.webkit.org/show_bug.cgi?id=152448

Patch by Andy VanWagoner <[email protected]> on 2016-02-27
Reviewed by Darin Adler.

Source/JavaScriptCore:

Add defaultLanguage to the globalObjectMethodTable and use it for the
default locale in Intl object initializations. Fall back to ICU default
locale only if the defaultLanguage function is null, or returns an
empty string.

  • jsc.cpp:
  • runtime/IntlCollator.cpp:

(JSC::IntlCollator::initializeCollator):

  • runtime/IntlDateTimeFormat.cpp:

(JSC::IntlDateTimeFormat::initializeDateTimeFormat):

  • runtime/IntlNumberFormat.cpp:

(JSC::IntlNumberFormat::initializeNumberFormat):

  • runtime/IntlObject.cpp:

(JSC::defaultLocale):
(JSC::lookupMatcher):
(JSC::bestFitMatcher):
(JSC::resolveLocale):

  • runtime/IntlObject.h:
  • runtime/JSGlobalObject.cpp:
  • runtime/JSGlobalObject.h:
  • runtime/StringPrototype.cpp:

(JSC::toLocaleCase):

Source/WebCore:

Pass defaultLanguage from Language.h to the globalObjectMethodTable to
ensure Intl objects can be initialized with the correct default locale.

  • bindings/js/JSDOMWindowBase.cpp:
  • bindings/js/JSWorkerGlobalScopeBase.cpp:

LayoutTests:

Add tests for default locale in test runner to be en-US.

  • js/intl-collator-expected.txt:
  • js/intl-datetimeformat-expected.txt:
  • js/intl-numberformat-expected.txt:
  • js/script-tests/intl-collator.js:
  • js/script-tests/intl-datetimeformat.js:
  • js/script-tests/intl-numberformat.js:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/IntlObject.h

    r196434 r197261  
    5858};
    5959
    60 String defaultLocale();
     60String defaultLocale(ExecState&);
    6161void convertICULocaleToBCP47LanguageTag(String& locale);
    6262bool intlBooleanOption(ExecState&, JSValue options, PropertyName, bool& usesFallback);
     
    6464unsigned intlNumberOption(ExecState&, JSValue options, PropertyName, unsigned minimum, unsigned maximum, unsigned fallback);
    6565Vector<String> canonicalizeLocaleList(ExecState&, JSValue locales);
    66 HashMap<String, String> resolveLocale(const HashSet<String>& availableLocales, const Vector<String>& requestedLocales, const HashMap<String, String>& options, const char* const relevantExtensionKeys[], size_t relevantExtensionKeyCount, Vector<String> (*localeData)(const String&, size_t));
     66HashMap<String, String> resolveLocale(ExecState&, const HashSet<String>& availableLocales, const Vector<String>& requestedLocales, const HashMap<String, String>& options, const char* const relevantExtensionKeys[], size_t relevantExtensionKeyCount, Vector<String> (*localeData)(const String&, size_t));
    6767JSValue supportedLocales(ExecState&, const HashSet<String>& availableLocales, const Vector<String>& requestedLocales, JSValue options);
    6868String removeUnicodeLocaleExtension(const String& locale);
Note: See TracChangeset for help on using the changeset viewer.