-
Notifications
You must be signed in to change notification settings - Fork 7
feat(localization): Integration of new i18nManager resource strings. #1835
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
base: master
Are you sure you want to change the base?
Conversation
Abstract this into a controller class so each component can composite it into itself correctly. |
… properties there.
} | ||
|
||
protected onResourceChange(event: CustomEvent<IResourceChangeEventArgs>) { | ||
this._defaultResourceStrings = this.getCurrentResourceStrings(); |
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.
Shouldn't we set the new locale here? Currently when new lang
is set on the html element it triggers the logic in core and raises the event, however this.locale
remains the old one in the controller and the resource strings don't change.
Same happens if locale is set via the public API:
setCurrentI18n('bg');
Events fire but resources don't change.
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.
The locale for the component is resolved on line 33, because it can be overridden. It seems to be working on my end, do you have steps for reproducing?
Also note that for the calendar for example this PR is not changing the Intl implementations.
Also the stories override the locale and set it as input.
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.
Could just be the calendar, but if you run the calendar sample and change the closest html lang
tag, most strings don't change:

Also if I set:
import {
setCurrentI18n
} from 'igniteui-i18n-core';
setCurrentI18n('bg');
Inside stories\calendar.stories.ts and run the sample, the calendar remains in the default locale.
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.
I see, should fixed with this PR #1845
I haven't touched any of the locale handling in this PR like I said and the Calendar already had Intl used in its implementation, but the logic for setting locale was only local per component anyway so in the new PR it was replaced entirely and is obsolete.
Requires IgniteUI/igniteui-i18n#2