-
Notifications
You must be signed in to change notification settings - Fork 38
Allow widget i18n bundles to be overridden #902
Conversation
README.md
Outdated
| w(WidgetA, { | ||
| i18nBundle: overrideBundleForWidgetA | ||
| }), | ||
| w(WidgetB) { |
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.
Found a typo. 🙂
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.
Ah, thanks!
a14e393 to
70ec826
Compare
tests/unit/mixins/I18n.ts
Outdated
| }, | ||
| '.localizeBundle() with an override': { | ||
| 'Uses the `i18nBundle` property'(this: any) { | ||
| const dfd = this.async(); |
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 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.
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.
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.
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.
eeb87ef to
ebd1695
Compare
Type: feature
The following has been addressed in the PR:
prettieras per the readme code style guidelinesDescription:
Add an
overrideBundleproperty to theI18nmixin 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.overrideBundlecan a complete bundle, an object with alocalesloader object that will be merged with the widget's default bundle, or aMapof default bundles to override values.Resolves #901