Skip to content

Conversation

skrustev
Copy link
Member

@skrustev skrustev commented Aug 29, 2025

@rkaraivanov
Copy link
Member

Abstract this into a controller class so each component can composite it into itself correctly.
There are also several other components such as combo and carousel which can use this functionality

@skrustev skrustev added i18n Issues related to internationalization and localization 🛠️ status: in-development enhancement New feature or request labels Sep 4, 2025
@skrustev skrustev requested a review from rkaraivanov September 9, 2025 09:07
@skrustev skrustev marked this pull request as ready for review September 9, 2025 09:07
@MayaKirova MayaKirova self-requested a review September 11, 2025 14:47
}

protected onResourceChange(event: CustomEvent<IResourceChangeEventArgs>) {
this._defaultResourceStrings = this.getCurrentResourceStrings();
Copy link
Contributor

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.

Copy link
Member Author

@skrustev skrustev Sep 15, 2025

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.

Copy link
Contributor

@MayaKirova MayaKirova Sep 15, 2025

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:

image

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.

Copy link
Member Author

@skrustev skrustev Sep 15, 2025

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.

@skrustev skrustev changed the title feat(localization): Integration of new i18nManager. feat(localization): Integration of new i18nManager resource strings. Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request i18n Issues related to internationalization and localization ❌ status: awaiting-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants