Skip to content

Commit 53cb864

Browse files
committed
fix(grid): Set the new localization update for grid globally.
1 parent 4e5e3e0 commit 53cb864

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ import { IgxGridValidationService } from './grid/grid-validation.service';
184184
import { getCurrentResourceStrings } from '../core/i18n/resources';
185185
import { isTree, recreateTree, recreateTreeFromFields } from '../data-operations/expressions-tree-util';
186186
import { getUUID } from './common/random';
187-
import { getI18nManager } from 'igniteui-i18n-core';
187+
import { getCurrentI18n, getI18nManager, ResourceChangeEventArgs } from 'igniteui-i18n-core';
188188

189189
interface IMatchInfoCache {
190190
row: any;
@@ -3498,15 +3498,16 @@ export abstract class IgxGridBaseDirective implements GridType,
34983498
protected platform: PlatformUtil,
34993499
@Optional() @Inject(IgxGridTransaction) protected _diTransactions?: TransactionService<Transaction, State>,
35003500
) {
3501-
this.locale = this.locale || this.localeId;
3501+
this.locale = this.locale || getCurrentI18n() || this.localeId;
35023502
this._transactions = this.transactionFactory.create(TRANSACTION_TYPE.None);
35033503
this._transactions.cloneStrategy = this.dataCloneStrategy;
35043504
this.cdr.detach();
35053505
this.selectionService.selectedRowsChange.pipe(takeUntil(this.destroy$)).subscribe((args: any[]) => {
35063506
this.selectedRowsChange.emit(args);
35073507
});
35083508
IgcTrialWatermark.register();
3509-
getI18nManager().onResourceChange(() => {
3509+
getI18nManager().onResourceChange((args: ResourceChangeEventArgs) => {
3510+
this.locale = args.newLocale;
35103511
this._resourceStrings = getCurrentResourceStrings(GridResourceStringsEN, false);
35113512
});
35123513
}

0 commit comments

Comments
 (0)