meteor-messageformat icon indicating copy to clipboard operation
meteor-messageformat copied to clipboard

Locales ambiguity

Open Sabst opened this issue 9 years ago • 2 comments

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.

Sabst avatar May 05 '16 13:05 Sabst

related: #28 Use MessageFormat.fallback so that 'en_US' finds 'en' etc.

1u avatar May 05 '16 18:05 1u

https://github.com/Openki/Openki/blob/master/client/start.js#L76

1u avatar Jan 23 '17 21:01 1u