Skip to content

Commit

Permalink
Fix #3883 defineLocale lazy load parentLocale
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyers committed Nov 18, 2017
1 parent 328d51e commit bb6dd57
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/lib/locale/locales.js
Expand Up @@ -84,7 +84,7 @@ export function getSetGlobalLocale (key, values) {

export function defineLocale (name, config) {
if (config !== null) {
var parentConfig = baseConfig;
var locale, parentConfig = baseConfig;
config.abbr = name;
if (locales[name] != null) {
deprecateSimple('defineLocaleOverride',
Expand All @@ -97,14 +97,19 @@ export function defineLocale (name, config) {
if (locales[config.parentLocale] != null) {
parentConfig = locales[config.parentLocale]._config;
} else {
if (!localeFamilies[config.parentLocale]) {
localeFamilies[config.parentLocale] = [];
locale = loadLocale(config.parentLocale);
if (locale != null) {
parentConfig = locale._config;
} else {
if (!localeFamilies[config.parentLocale]) {
localeFamilies[config.parentLocale] = [];
}
localeFamilies[config.parentLocale].push({
name: name,
config: config
});
return null;
}
localeFamilies[config.parentLocale].push({
name: name,
config: config
});
return null;
}
}
locales[name] = new Locale(mergeConfigs(parentConfig, config));
Expand Down

0 comments on commit bb6dd57

Please sign in to comment.