Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mapping for language_CountryCode to momentjs locale names #2

Closed
graste opened this issue Jan 21, 2015 · 1 comment
Closed

Add mapping for language_CountryCode to momentjs locale names #2

graste opened this issue Jan 21, 2015 · 1 comment
Labels

Comments

@graste
Copy link
Owner

graste commented Jan 21, 2015

What locale should be taken for an HTML page delivered with <html lang="en"> etc.?

MomentJS seems to use common ISO language codes (conforming to ISO 639-1) with a two letter country code where deemed relevant. The default en language is basically en-us if I see that correctly.

It might be nice to accept locales as defined in RFC5646 like en_UK or de_AT and map them to en-gb and de-at respectively. The ISO 3166-1 alpha-2 codes should be used to map to the available locales of momentjs. The correct differentiation between geographical territory (ISO 3166) and language spoken (ISO 639) is important as there are short names that are ambiguous: e.g. AF/af are Afghanistan and Afrikaans.

This topic should be explored and maybe even lead to a momentjs pull request instead of a mapping introduced here. Is there a momentjs documentation that defines what ISO/RFC is used for their namings? See also momentjs source code that reads the given locale identifier.

@graste
Copy link
Owner Author

graste commented Jan 21, 2015

Moment:

  • uses el when el_GR or el-gr is given
  • uses de when de_DE or de-de is given
  • uses en on en_UK instead of en-gb, but that's okay as en_UK is to be written as en_GB anyways
  • uses en-gb when en_GB is given

Seems to work. In b42b267 the default locale of the datetime-local-picker is set to en-gb and that is used when en only is specified as locale in the settings. American and other friends that prefer the MM/DD/YYYY format as a default now need to specify en-us. :-)

@graste graste closed this as completed Jan 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant