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):
(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: