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 auto-detect locale support #33

Merged
merged 1 commit into from
Dec 22, 2017

Conversation

greyli
Copy link
Contributor

@greyli greyli commented Jul 7, 2017

No description provided.

@greyli
Copy link
Contributor Author

greyli commented Dec 21, 2017

Any ideas?

@miguelgrinberg
Copy link
Owner

Oh, this looks pretty good! Should have done this long ago, makes a lot more sense.

@miguelgrinberg
Copy link
Owner

I'll test it a little bit and then merge. I'm not sure how this works with the longer locales, such as en_GB and so on, I want to verify that before I merge.

@greyli
Copy link
Contributor Author

greyli commented Dec 22, 2017

Thanks. It seems that Moment.js will handle these locales:

Moment will also try locale specifier substrings from most-specific to least-specific until it finds a locale it knows. This is useful when supplying Moment with a locale string pulled from the user's environment, such as window.navigator.language. - Docs

@miguelgrinberg
Copy link
Owner

Yeah, that seems to work, thanks! I was hoping there was also a way to access the language settings that the browser sends in the Accept-Language header, but that does not seem to be accessible from JS. So for the cases where the server uses the Accept header it can very well set the moment local explicitly.

So I'm merging this. Thanks again!

@miguelgrinberg miguelgrinberg merged commit 32e18b6 into miguelgrinberg:master Dec 22, 2017
@greyli greyli deleted the patch-1 branch December 23, 2017 04:07
@greyli
Copy link
Contributor Author

greyli commented Dec 23, 2017

It's my pleasure. I notice that the last release was two years ago. Maybe it's time to make a new one?

@miguelgrinberg
Copy link
Owner

@greyli I was going to, but noticed that there is a problem with the Travis builds, so I want to figure that out before I get a new release (since now master releases show as failed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants