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
[bugfix] updateLocale now tries to load parent, fixes #3626 #4242
Conversation
src/lib/locale/locales.js
Outdated
@@ -136,6 +136,12 @@ export function updateLocale(name, config) { | |||
if (locales[name] != null) { | |||
parentConfig = locales[name]._config; | |||
} | |||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
tmpLocale = locales[name] || loadLocale(name);
if (locale != null) {
parentConfig = tmpLocale._config;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I've committed with the suggested refactor.
@cmyers Can you add a test? |
@icambron new to qunit but I'll give it a go. |
Actually, another thought: I looked at the |
That's a good catch, I'll revisit then add a test. |
LGTM. Thanks! |
So basically try to load it if its not loaded already? That's mostly for node.js, I guess. |
Yup |
Merged in d26f97e |
[bugfix] updateLocale now tries to load parent, fixes #3626
This addresses #3626.
A fix was suggested in the comments but a PR wasn't submitted. I've refactored the suggested fix which will check if the locale to update exists (if not found in the currently loaded locales) and load it before merging. This mitigates the merge with the current set locale if the submitted locale isn't found in the loaded locales array.
Not sure if it should continue to merge if the locale to merge with can't be loaded, but this could be another issue to discuss.