meteor-messageformat
meteor-messageformat copied to clipboard
Locales ambiguity
Hi, I defined the translations for one locale, say 'fr'. Now, on some device, the system reports the locale as 'fr-FR' (could sometimes also be 'fr_FR' or 'fr-fr'). The result is that default (english) texts are displayed... which is not so nice. It would be better for example to:
- fallback on the 'parent' locale, i.e. 'fr' if not translation exists for 'fr-FR' (implicit behavior defined by the library)
- allow a list of locales (instead of just one), e.g. ['fr-FR,'fr'](explicit behavior defined by the application)... by the way this what the browser preferences define.
Other sub-optimal solutions exist like:
- cloning 'fr' into 'fr-FR' but this is a pain to maintain.
- considering the first level only ('fr-FR' becomes 'fr') but then the ability to refine the translations for a given dialect is lost: for example for canadian french, rely on 'fr' but define translations for 'fr-CA' only when the text is different from 'fr'.
Is there currently a solution to this locale ambiguity problem?
Regards.
related: #28 Use MessageFormat.fallback so that 'en_US' finds 'en' etc.
https://github.com/Openki/Openki/blob/master/client/start.js#L76