Skip to content

Commit 1f60578

Browse files
authored
Merge pull request #16230 from IgniteUI/skrastev/localization-split
refactor(localization): Update localization API to new separated structure.
2 parents d7e3640 + 4df598e commit 1f60578

File tree

15 files changed

+68
-57
lines changed

15 files changed

+68
-57
lines changed

package-lock.json

Lines changed: 23 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"@types/source-map": "0.5.2",
7676
"express": "^5.1.0",
7777
"fflate": "^0.8.1",
78-
"igniteui-i18n-core": "^0.5.0-alpha.5",
78+
"igniteui-i18n-core": "^0.6.0-alpha.2",
7979
"igniteui-theming": "^20.0.0",
8080
"igniteui-trial-watermark": "^3.1.0",
8181
"lodash-es": "^4.17.21",
@@ -121,7 +121,7 @@
121121
"hammerjs": "^2.0.8",
122122
"ig-typedoc-theme": "^6.0.0",
123123
"igniteui-dockmanager": "^1.17.0",
124-
"igniteui-i18n-resources": "^0.5.0-alpha.5",
124+
"igniteui-i18n-resources": "^0.6.0-alpha.2",
125125
"igniteui-sassdoc-theme": "^2.0.2",
126126
"igniteui-webcomponents": "6.2.1",
127127
"jasmine": "^5.6.0",

projects/igniteui-angular-i18n/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
},
2525
"homepage": "https://github.com/IgniteUI/igniteui-angular/projects/igniteui-angular-i18n#readme",
2626
"dependencies": {
27-
"igniteui-i18n-resources": "^0.5.0-alpha.5"
27+
"igniteui-i18n-resources": "^0.6.0-alpha.2"
2828
}
2929
}

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"tslib": "^2.3.0",
7474
"igniteui-trial-watermark": "^3.1.0",
7575
"lodash-es": "^4.17.21",
76-
"igniteui-i18n-core": "^0.5.0-alpha.5",
76+
"igniteui-i18n-core": "^0.6.0-alpha.2",
7777
"igniteui-theming": "^20.0.0",
7878
"@igniteui/material-icons-extended": "^3.1.0"
7979
},

projects/igniteui-angular/src/lib/calendar/calendar-base.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getCurrentResourceStrings, initi18n } from '../core/i18n/resources';
1010
import { KeyboardNavigationService } from './calendar.services';
1111
import { getYearRange, isDateInRanges } from './common/helpers';
1212
import { CalendarDay } from './common/model';
13-
import { getCurrentI18n, getI18nManager, IResourceChangeEventArgs } from 'igniteui-i18n-core';
13+
import { getCurrentI18n, getDateFormatter, IResourceChangeEventArgs } from 'igniteui-i18n-core';
1414

1515
/** @hidden @internal */
1616
@Directive({
@@ -132,42 +132,42 @@ export class IgxCalendarBaseDirective implements ControlValueAccessor {
132132
* @hidden
133133
*/
134134
protected get formatterWeekday(): Intl.DateTimeFormat {
135-
return getI18nManager().getDateFormatter(this.locale, { weekday: this._formatOptions.weekday });
135+
return getDateFormatter().getIntlFormatter(this.locale, { weekday: this._formatOptions.weekday });
136136
}
137137

138138
/**
139139
* @hidden
140140
*/
141141
protected get formatterDay(): Intl.DateTimeFormat {
142-
return getI18nManager().getDateFormatter(this.locale, { day: this._formatOptions.day });
142+
return getDateFormatter().getIntlFormatter(this.locale, { day: this._formatOptions.day });
143143
}
144144

145145
/**
146146
* @hidden
147147
*/
148148
protected get formatterMonth(): Intl.DateTimeFormat {
149-
return getI18nManager().getDateFormatter(this.locale, { month: this._formatOptions.month });
149+
return getDateFormatter().getIntlFormatter(this.locale, { month: this._formatOptions.month });
150150
}
151151

152152
/**
153153
* @hidden
154154
*/
155155
protected get formatterYear(): Intl.DateTimeFormat {
156-
return getI18nManager().getDateFormatter(this.locale, { year: this._formatOptions.year });
156+
return getDateFormatter().getIntlFormatter(this.locale, { year: this._formatOptions.year });
157157
}
158158

159159
/**
160160
* @hidden
161161
*/
162162
protected get formatterMonthDay(): Intl.DateTimeFormat {
163-
return getI18nManager().getDateFormatter(this.locale, { month: this._formatOptions.month, day: this._formatOptions.day });
163+
return getDateFormatter().getIntlFormatter(this.locale, { month: this._formatOptions.month, day: this._formatOptions.day });
164164
}
165165

166166
/**
167167
* @hidden
168168
*/
169169
protected get formatterRangeDay(): Intl.DateTimeFormat {
170-
return getI18nManager().getDateFormatter(this.locale, { day: this._formatOptions.day, month: 'short' });
170+
return getDateFormatter().getIntlFormatter(this.locale, { day: this._formatOptions.day, month: 'short' });
171171
}
172172

173173
/**

projects/igniteui-angular/src/lib/calendar/calendar.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { CalendarDay } from './common/model';
3434
import { IgxCalendarBaseDirective } from './calendar-base';
3535
import { KeyboardNavigationService } from './calendar.services';
3636
import { IgxDateFormatterPipe } from '../grids/common/pipes';
37-
import { getI18nManager } from 'igniteui-i18n-core';
37+
import { getDateFormatter } from 'igniteui-i18n-core';
3838

3939
let NEXT_ID = 0;
4040

@@ -880,8 +880,8 @@ export class IgxCalendarComponent extends IgxCalendarBaseDirective implements Af
880880
*/
881881
protected getFormattedDate(): { weekday: string; monthday: string } {
882882
const date = this.headerDate;
883-
const monthFormatted = getI18nManager().formatDateTime(date, this.locale, { month: 'short', day: 'numeric' });
884-
const dayFormatted = getI18nManager().formatDateTime(date, this.locale,{ weekday: 'short' });
883+
const monthFormatted = getDateFormatter().formatDateTime(date, this.locale, { month: 'short', day: 'numeric' });
884+
const dayFormatted = getDateFormatter().formatDateTime(date, this.locale,{ weekday: 'short' });
885885

886886
return {
887887
monthday: monthFormatted,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { CalendarDay, DayInterval } from "../common/model";
2424
import { getNextActiveDate, isDateInRanges } from "./helpers";
2525
import { DateRangeType } from "../../core/dates";
2626
import { isDate, onResourceChangeHandle } from "../../core/utils";
27-
import { getCurrentI18n, getI18nManager, IResourceChangeEventArgs } from 'igniteui-i18n-core';
27+
import { getCurrentI18n, getDateFormatter, IResourceChangeEventArgs } from 'igniteui-i18n-core';
2828

2929
export enum Direction {
3030
NEXT = 1,
@@ -112,7 +112,7 @@ export abstract class IgxCalendarViewDirective implements ControlValueAccessor {
112112
* @hidden
113113
*/
114114
protected get formatter(): Intl.DateTimeFormat {
115-
return getI18nManager().getDateFormatter(this.locale);
115+
return getDateFormatter().getIntlFormatter(this.locale);
116116
}
117117

118118
/**

projects/igniteui-angular/src/lib/calendar/common/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "./model";
88
import { DateRangeDescriptor, DateRangeType } from "./types";
99
import { first, last, modulo } from "../../core/utils";
10-
import { getI18nManager } from 'igniteui-i18n-core';
10+
import { getDateFormatter } from 'igniteui-i18n-core';
1111

1212
interface IFormattedParts {
1313
value: string;
@@ -186,7 +186,7 @@ export function formatToParts(
186186
options: Intl.DateTimeFormatOptions,
187187
parts: string[],
188188
): Record<string, any> {
189-
const formatter = getI18nManager().getDateFormatter(locale, options);
189+
const formatter = getDateFormatter().getIntlFormatter(locale, options);
190190
const result: Record<string, any> = {
191191
date,
192192
full: formatter.format(date),

projects/igniteui-angular/src/lib/calendar/days-view/days-view.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
isDateInRanges,
3232
} from "../common/helpers";
3333
import { CalendarDay } from '../common/model';
34-
import { getI18nManager } from 'igniteui-i18n-core';
34+
import { getDateFormatter } from 'igniteui-i18n-core';
3535

3636
let NEXT_ID = 0;
3737

@@ -400,7 +400,7 @@ export class IgxDaysViewComponent extends IgxCalendarBaseDirective {
400400
*/
401401
public get weekHeaderLabels(): {long: string, formatted: string}[] {
402402
const weekdays = [];
403-
const rawFormatter = getI18nManager().getDateFormatter(this.locale, { weekday: 'long' });
403+
const rawFormatter = getDateFormatter().getIntlFormatter(this.locale, { weekday: 'long' });
404404

405405
for (const day of this.monthWeeks.at(0)) {
406406
weekdays.push({

projects/igniteui-angular/src/lib/calendar/months-view/months-view.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
1616
import { CalendarDay } from "../common/model";
1717
import type { DayInterval } from "../common/model";
1818
import { calendarRange } from "../common/helpers";
19-
import { getI18nManager } from 'igniteui-i18n-core';
19+
import { getDateFormatter } from 'igniteui-i18n-core';
2020

2121
let NEXT_ID = 0;
2222

@@ -127,7 +127,7 @@ export class IgxMonthsViewComponent extends IgxCalendarViewDirective implements
127127
* @hidden
128128
*/
129129
protected override get formatter() {
130-
return getI18nManager().getDateFormatter(this.locale, { month: this.monthFormat });
130+
return getDateFormatter().getIntlFormatter(this.locale, { month: this.monthFormat });
131131
}
132132

133133
/**
@@ -157,7 +157,7 @@ export class IgxMonthsViewComponent extends IgxCalendarViewDirective implements
157157
* @hidden
158158
*/
159159
public formattedMonth(value: Date): { long: string; formatted: string } {
160-
const rawFormatter = getI18nManager().getDateFormatter(this.locale, {
160+
const rawFormatter = getDateFormatter().getIntlFormatter(this.locale, {
161161
month: "long",
162162
year: "numeric",
163163
});

0 commit comments

Comments
 (0)