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

locale is not loaded automatically with browserify #2007

Closed
janmarek opened this issue Oct 23, 2014 · 9 comments
Closed

locale is not loaded automatically with browserify #2007

janmarek opened this issue Oct 23, 2014 · 9 comments

Comments

@janmarek
Copy link

With browserify (http://browserify.org/) setting locale does not work.

var moment = require('moment');
moment.locale('cs');
console.log(moment.locale()); // en

I have found this workaround:

var moment = require('moment');
require('moment/locale/cs');
moment.locale('cs');
console.log(moment.locale()); // cs

It is probably not easily fixable, but at least it can be mentioned in docs.

@ichernev
Copy link
Contributor

I agree, we should say it in the docs.

@timaschew
Copy link

And it's still not in the docs after 6 months.

@janmarek you don't need to call the locale after the require

var moment = require('moment');
require('moment/locale/cs');
console.log(moment.locale()); // cs

But this behaviour and the common js requiring in moment is totally horrible.

@alesanabriav
Copy link

It works thanks, even if is not pretty. It should be in the docs.

@mattjohnsonpint
Copy link
Contributor

Please send a PR to https://github.com/moment/momentjs.com. Thanks.

@albertorestifo
Copy link

This is long overdue.

It might not be the pretties solution, but it's the best one.

@mattjohnsonpint
Copy link
Contributor

Merged the PR in the docs repo. Thanks, and sorry for the delay.

@muhgumus
Copy link

muhgumus commented Jul 29, 2017

var trLocale = require('moment/locale/tr');
moment.locale('tr',trLocale)

@VarshaBawari
Copy link

Was able to fix with this one #3624 (comment)

@fgagneten
Copy link

Solution for me was removing the following lines:

LocaleConfig.locales.locale = i18n.t("calendar")

LocaleConfig.defaultLocale = "locale"

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

No branches or pull requests

9 participants