Last Comment Bug 889616 - I18n API should expose language negotiation API
: I18n API should expose language negotiation API
Status: NEW
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86_64 Linux
-- normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2013-07-02 15:12 PDT by Zibi Braniecki [:gandalf][:zibi]
Modified: 2014-07-24 11:07 PDT (History)
6 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Zibi Braniecki [:gandalf][:zibi] 2013-07-02 15:12:24 PDT
The Ecma 402 API introduces very nice API for language negotiation, but makes it non-public.

In particular, two functions: LookupSupportedLocales and CanonicalizeLanguageTag are very useful for localization libraries.

In L20n we exposed them together with one wrapper function that we named prioritizeLocales.

prioritizeLocales takes three arguments:
 - availableLocales
 - requestedLocales
 - defaultLocale

It canonicalizes all the input and builds a list of available locales that match user requestedLocales, adding defaultLocale at the end if needed.

One addition to that is that we had to fork LookupSupportedLocales into LookupAvailableLocales because the former one returns the list of *requested* locales, not *availalable* ones.
The difference translates into returning "es-MX" when "es" is available which is pointless for localization library which needs to pick the available locale for app localization.

It would be very helpful for localization frameworks to have access to CanonicalizeLanguageTag and LookupSupportedLocales at least.
It would be even better to have LookupAvailableLocales as well.
Comment 1 User image Jeff Walden [:Waldo] (remove +bmo to email) 2013-07-02 15:38:41 PDT
You want to bring this up on the es-discuss list.  We don't extend the language in advance of rough consensus on standardizing APIs any more.

I'd expect not exposing this stuff was a deliberate design decision, but I could be wrong.
Comment 2 User image Marcos Caceres [:marcosc] 2013-07-25 08:09:41 PDT
Any update on from ES-Discuss or Norbert?

Note You need to log in before you can comment on or make changes to this bug.