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

Allow 'en' in the list of supported locales #9

Merged
merged 7 commits into from
May 23, 2018
Merged

Allow 'en' in the list of supported locales #9

merged 7 commits into from
May 23, 2018

Conversation

jessevanassen
Copy link
Contributor

For newer versions of Moment (2.21.0+), moment.localeData('unknown') returns the localeData of the currently set locale, instead of null. This means that if the locale hasn't been set explicitly, it will return the localeData of the built-in 'en' locale.

Starting with 1.0.6, this plugin checks for unknown locales by retrieving the localeData of the locales in the "localesToKeep" parameter, and comparing them to the localeData of the currently set locale.

However, when "en" is also included in "localesToKeep", the plugin will produce the "Moment.js doesn’t include a locale you specified: en" error. Considering that this is the default locale that can't be removed, the message is quite unclear.

With this PR, I remove the "en" locale from the list of locales to keep, before it will check for missing locales or produce the final list of locale abbreviations. In practice, this means that ['en'] will be treated similarly to [] for the localesToKeep parameter.

@iamakulov iamakulov merged commit 33c13cf into iamakulov:master May 23, 2018
@iamakulov
Copy link
Owner

Sorry for build issues – and thanks for the PR! Just published as moment-locales-webpack-plugin@1.0.7.

@jessevanassen
Copy link
Contributor Author

No worries, and thanks for accepting the PR!

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

Successfully merging this pull request may close these issues.

2 participants