Skip to content

Commit 6234c12

Browse files
committed
feat(localization): Enable localized strings for week label.
1 parent 0f6ff62 commit 6234c12

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/components/common/i18n/i18n-controller.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
getCurrentI18n,
3+
getDisplayNamesFormatter,
34
getI18nManager,
45
type IResourceChangeEventArgs,
56
type IResourceStrings,
@@ -123,7 +124,10 @@ export class I18nController<T> implements ReactiveController {
123124
this._defaultEN[igcKey as keyof T];
124125
}
125126
} else if (coreKey?.includes('getWeekLabel')) {
126-
// Call core week label?
127+
const weekLabel = getDisplayNamesFormatter().getWeekLabel(this.locale, {
128+
style: 'short',
129+
});
130+
normalizedResourceStrings[igcKey as keyof T] = weekLabel as T[keyof T];
127131
} else {
128132
// No mapped keys, no need to convert the resources then.
129133
return resourceStrings as T;

src/components/common/i18n/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function convertToIgcResource<T extends IResourceStrings>(inObject: T) {
6565
}
6666

6767
for (const [key, value] of resourceMap) {
68-
if (value && !value.includes('i18n/')) {
68+
if (value) {
6969
result[key] = inObject[value as keyof IResourceStrings];
7070
}
7171
}
@@ -86,7 +86,7 @@ export function convertToCoreResource<T>(inObject: T): IResourceStrings {
8686

8787
if (resourceMap) {
8888
for (const [key, value] of resourceMap) {
89-
if (value && !value.includes('i18n/')) {
89+
if (value) {
9090
result[value as keyof IResourceStrings] = inObject[
9191
key as keyof T
9292
] as string;

0 commit comments

Comments
 (0)