Skip to content

Commit

Permalink
Fix sync nls bundles for supported locales
Browse files Browse the repository at this point in the history
  • Loading branch information
agubler committed Mar 18, 2020
1 parent 4d03fae commit 7e93092
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ function registerBundle<T extends Messages>(bundle: Bundle<T>): string {
messages = bundleLoader;
}
if (isSupportedLocale) {
messageBundles[locale] = messages;
messageBundles[locale] = {
[bundleId]: messages
};
} else if (lookup[locale]) {
lookup[locale].bundles = { [bundleId]: messages };
} else {
Expand Down Expand Up @@ -361,7 +363,7 @@ export function localizeBundle<T extends Messages>(
return getPlaceholderBundle(bundle);
}
const bundleId = registerBundle(bundle);
const globalize = globalizeInstanceMap.get(locale) || new Globalize(locale);
const globalize = globalizeInstanceMap.get(locale) || new Globalize(new Cldr(locale));
globalizeInstanceMap.set(locale, globalize);
const lookupId = globalize.cldr.get(`${DOJO_PATH}/${bundleId}/id`);
const lookupLocale = globalize.cldr.get(`${DOJO_PATH}/${bundleId}/locale`);
Expand Down
1 change: 1 addition & 0 deletions tests/i18n/unit/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ describe('i18n', () => {
setCldrLoaders({
fallback: fallback.loader
});
setSupportedLocales(['fr', 'ja']);
const invalidator = stub();
const bundle = {
messages: { foo: 'bonjour, {name}', fallback: 'root/fr fallback' },
Expand Down

0 comments on commit 7e93092

Please sign in to comment.