Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Allow widget i18n bundles to be overridden #902

Merged
merged 5 commits into from
May 2, 2018

Conversation

mwistrand
Copy link
Contributor

@mwistrand mwistrand commented Mar 23, 2018

Type: feature

The following has been addressed in the PR:

Description:

Add an overrideBundle property to the I18n mixin properties allowing the base bundle to be overridden, or specific bundles to be overridden in the event that a widget derives its messages from multiple bundles. overrideBundle can a complete bundle, an object with a locales loader object that will be merged with the widget's default bundle, or a Map of default bundles to override values.

Resolves #901

@dylans dylans modified the milestone: rc.2 Mar 24, 2018
README.md Outdated
w(WidgetA, {
i18nBundle: overrideBundleForWidgetA
}),
w(WidgetB) {
Copy link

@jcfranco jcfranco Apr 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a typo. 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks!

@mwistrand mwistrand force-pushed the 901-override-bundles branch from a14e393 to 70ec826 Compare April 24, 2018 13:51
@mwistrand mwistrand requested a review from matt-gadd April 24, 2018 14:14
@@ -119,6 +135,62 @@ registerSuite('mixins/I18nMixin', {
});
}
},
'.localizeBundle() with an override': {
'Uses the `i18nBundle` property'(this: any) {
const dfd = this.async();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we are using this.async here and not dealing with promises as with other async tests in widget-core? It would be super if we didn't need to use a setTimeout also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was originally needed to workaround the fact that localizeBundle asynchronously loads locale-specific messages but synchronously returns either the default messages or the cached messages. However, the underlying functionality has changed between commits, so I should be able to just use @dojo/i18n/i18n.default() directly.

mwistrand added 4 commits May 1, 2018 11:32
Add an `overrideBundle` property to the `I18n` mixin properties allowing
the base bundle to be overridden, or specific bundles to be overridden
in the event that a widget derives its messages from multiple bundles.
Rename `overrideBundle` to `i18nBundle` and require the property to be a
full bundle or map of bundles.
@mwistrand mwistrand force-pushed the 901-override-bundles branch from eeb87ef to ebd1695 Compare May 1, 2018 16:36
@dylans dylans added this to the 2.0.0 milestone May 1, 2018
@agubler agubler merged commit 8268490 into dojo:master May 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants