Skip to content

Commit

Permalink
fix: use valid IETF BCP 47 zh-HK code
Browse files Browse the repository at this point in the history
JIRA: LX-454
  • Loading branch information
NestorEncinas committed Aug 16, 2024
1 parent 90cb89e commit 9297c4e
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import frCA from "./bundles/fr-CA.json";
import enGB from "./bundles/en-GB.json";
import enAU from "./bundles/en-AU.json";
import zhHant from "./bundles/zh-Hant.json";
import zhYue from "./bundles/zh-Yue.json";
import zhHK from "./bundles/zh-HK.json";
import fiFI from "./bundles/fi-FI.json";

const sdkUiDashboardTranslations: { [locale: string]: Record<string, string> } = {
Expand All @@ -40,7 +40,7 @@ const sdkUiDashboardTranslations: { [locale: string]: Record<string, string> } =
"en-AU": enAU,
"fi-FI": fiFI,
"zh-Hant": zhHant,
yue: zhYue,
"zh-HK": zhHK,
};

/**
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-ui-ext/src/internal/utils/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import enGB from "../translations/en-GB.json";
import enAU from "../translations/en-AU.json";
import fiFI from "../translations/fi-FI.json";
import zhHant from "../translations/zh-Hant.json";
import zhYue from "../translations/zh-Yue.json";
import zhHK from "../translations/zh-HK.json";

import { IDropdownItem } from "../interfaces/Dropdown.js";

Expand Down Expand Up @@ -59,7 +59,7 @@ const sdkUiExtTranslations: { [locale: string]: Record<string, string> } = {
"en-AU": enAU,
"fi-FI": fiFI,
"zh-Hant": zhHant,
yue: zhYue,
"zh-HK": zhHK,
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const LOCALES: ILocale[] = [
"en-AU",
"fi-FI",
"zh-Hant",
"yue",
"zh-HK",
];
export const DEFAULT_LOCALE = "en-US";

Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-ui/api/sdk-ui.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ export interface ILoadingState {
}

// @public
export type ILocale = "en-US" | "de-DE" | "es-ES" | "fr-FR" | "ja-JP" | "nl-NL" | "pt-BR" | "pt-PT" | "zh-Hans" | "ru-RU" | "it-IT" | "es-419" | "fr-CA" | "en-GB" | "en-AU" | "fi-FI" | "zh-Hant" | "yue";
export type ILocale = "en-US" | "de-DE" | "es-ES" | "fr-FR" | "ja-JP" | "nl-NL" | "pt-BR" | "pt-PT" | "zh-Hans" | "ru-RU" | "it-IT" | "es-419" | "fr-CA" | "en-GB" | "en-AU" | "fi-FI" | "zh-Hant" | "zh-HK";

// @public (undocumented)
export type IMappingHeader = IAttributeDescriptor | IResultAttributeHeader | IMeasureDescriptor | ITotalDescriptor | IColorDescriptor;
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-ui/src/base/localization/Locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type ILocale =
| "en-AU"
| "fi-FI"
| "zh-Hant"
| "yue";
| "zh-HK";

/**
* Array of locales for type-guard. It must be the same as {@link ILocale}
Expand All @@ -48,7 +48,7 @@ export const LOCALES = [
"en-AU",
"fi-FI",
"zh-Hant",
"yue",
"zh-HK",
];

/**
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-ui/src/base/localization/messagesMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import enGB from "./bundles/en-GB.json";
import enAU from "./bundles/en-AU.json";
import fiFI from "./bundles/fi-FI.json";
import zhHant from "./bundles/zh-Hant.json";
import zhYue from "./bundles/zh-Yue.json";
import zhHK from "./bundles/zh-HK.json";

/**
* @internal
Expand Down Expand Up @@ -48,5 +48,5 @@ export const messagesMap: { [locale: string]: ITranslations } = {
"en-AU": enAU,
"fi-FI": fiFI,
"zh-Hant": zhHant,
yue: zhYue,
"zh-HK": zhHK,
};
2 changes: 1 addition & 1 deletion libs/sdk-ui/src/base/localization/test/IntlStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe("IntlStore", () => {
"en-AU",
"fi-FI",
"zh-Hant",
"yue",
"zh-HK",
];

it("should return message in en-US", () => {
Expand Down
4 changes: 2 additions & 2 deletions libs/util/src/tests/translationUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ describe("sanitizeLocaleForMoment", () => {
expect(actual).toEqual(expected);
});

it("should sanitize the yue locale", () => {
it("should sanitize the zh-HK locale", () => {
const expected = "zh-CN";
const actual = sanitizeLocaleForMoment("yue");
const actual = sanitizeLocaleForMoment("zh-HK");
expect(actual).toEqual(expected);
});

Expand Down
2 changes: 1 addition & 1 deletion libs/util/src/translationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function removeMetadata(translationsWithMetadata: Record<string, any>): R
* @internal
*/
export const sanitizeLocaleForMoment = (intlLocale: string): string => {
if (intlLocale === "zh-Hans" || intlLocale === "zh-Hant" || intlLocale === "yue") {
if (intlLocale === "zh-Hans" || intlLocale === "zh-Hant" || intlLocale === "zh-HK") {
return "zh-CN";
}
return intlLocale;
Expand Down

0 comments on commit 9297c4e

Please sign in to comment.