Skip to content

Commit 6c9cb97

Browse files
committed
fix(calendarView): Fix locale not updating for calendar views.
1 parent dc8e3c9 commit 6c9cb97

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

projects/igniteui-angular/src/lib/calendar/common/calendar-view.directive.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ export abstract class IgxCalendarViewDirective implements ControlValueAccessor {
118118
*/
119119
protected _locale = "en";
120120

121+
/**
122+
* @hidden
123+
*/
124+
protected _defaultLocale = "en";
125+
121126
/**
122127
* @hidden
123128
* @internal
@@ -165,7 +170,7 @@ export abstract class IgxCalendarViewDirective implements ControlValueAccessor {
165170
*/
166171
@Input()
167172
public get locale(): string {
168-
return this._locale;
173+
return this._locale || this._defaultLocale;
169174
}
170175

171176
/**
@@ -177,11 +182,13 @@ export abstract class IgxCalendarViewDirective implements ControlValueAccessor {
177182
*/
178183
public set locale(value: string) {
179184
this._locale = value;
180-
this.initFormatter();
181185
}
182186

183187
constructor(@Inject(DAY_INTERVAL_TOKEN) protected dayInterval?: DayInterval) {
184-
this.initFormatter();
188+
this._defaultLocale = getCurrentI18n();
189+
getI18nManager().onResourceChange((args: ResourceChangeEventArgs) => {
190+
this._defaultLocale = args.newLocale;
191+
});
185192
}
186193

187194
/**

0 commit comments

Comments
 (0)