Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10101 closed enhancement (wontfix)

dojo i18n does not support fallback to locales listed in djConfig.extraLocale

Reported by: asitowagh Owned by: Adam Peller
Priority: high Milestone: tbd
Component: Internationalization Version: 1.3.2
Keywords: Cc: James Burke
Blocked By: Blocking:


Suppose djConfig.locale is set to "hi" and djConfig.extraLocale to ["ja", "en"]. Also suppose that there is no "hi" directory under the nls directory concerned but there is a "ja" directory. I would expect to get "ja" localizations akin to the http Accept-language contract. Unfortunately dojo.i18n._requireLocalization loads the "ROOT" localization for the non-existent "hi" locale without any indication that it did so. So there is no way of knowing if you are actually getting strings for the locale specified or just the default ones.

Ideally in the above case dojo i18n should iterate thru' the extraLocale list and try to return localized strings based on that list. At the very least dojo i18n should indicate that a default localization was loaded (in i18n.getLocalization) so that users have the choice of retryign with other locales on the extraLocale list.

Change History (4)

comment:1 Changed 12 years ago by Adam Peller

Priority: highnormal
Type: defectenhancement

Working as designed. If the documentation was unclear, please provide comments and it will be fixed. extraLocale is for additional locale support on a page and is not a fallback list. There is presently no functionality in Dojo like the http language header which provides fallback. Given that resources are sparse, I'm not sure there really is any way to detect whether a given locale was 'found' since it is possible that the given locale does not override any of the resources in ROOT.

comment:2 Changed 12 years ago by Adam Peller

Cc: jamestag added
Resolution: wontfix
Status: newclosed

By design, the root is the fallback for all missing locales and there is really no distinction between that fallback and 'missing' translations. I'm not seeing any straightforward way to implement this within the existing architecture and I'd hesitate to add more complexity even if we could.

comment:3 Changed 12 years ago by Adam Peller

Cc: James Burke added; jamestag removed

comment:4 Changed 12 years ago by Adam Peller

Summary: dojo i18n does not support honoring locales listed in djConfig.extraLocaledojo i18n does not support fallback to locales listed in djConfig.extraLocale
Note: See TracTickets for help on using tickets.