feat(i18n): standardize bilingual catalogs and tooling
This commit is contained in:
@@ -19,7 +19,7 @@ import {
|
||||
I18nProvider as UiI18nProvider,
|
||||
type CalendarLocale,
|
||||
} from "@workspace/ui/components/i18n"
|
||||
import { calendarLocale as englishCalendarLocale } from "@workspace/ui/locales/en"
|
||||
import { calendarLocale as englishCalendarLocale } from "@workspace/ui/locales/en-US"
|
||||
import { calendarLocale as simplifiedChineseCalendarLocale } from "@workspace/ui/locales/zh-Hans"
|
||||
|
||||
import { appLocales, DEFAULT_APP_LOCALE, type AppLocale } from "./app-locales"
|
||||
@@ -27,7 +27,7 @@ import { AppI18nDevtool } from "./app-i18n-devtool"
|
||||
import { setAppLocale as persistAppLocale } from "@/server/app-locale.functions"
|
||||
|
||||
const appCalendarLocales: Partial<Record<AppLocale, CalendarLocale>> = {
|
||||
en: englishCalendarLocale,
|
||||
"en-US": englishCalendarLocale,
|
||||
"zh-Hans": simplifiedChineseCalendarLocale,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,16 +7,11 @@ import { AppLanguageSwitcher } from "./app-language-switcher"
|
||||
|
||||
vi.mock("./app-i18n-provider", () => ({
|
||||
useAppLocale: () => ({
|
||||
locale: "en",
|
||||
locale: "en-US",
|
||||
setLocale: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock("country-flag-icons/react/1x1", () => ({
|
||||
CN: () => <svg />,
|
||||
US: () => <svg />,
|
||||
}))
|
||||
|
||||
beforeAll(() => {
|
||||
vi.stubGlobal(
|
||||
"ResizeObserver",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { LocaleDefinition } from "@workspace/i18n"
|
||||
|
||||
export type AppLocale = "en" | "zh-Hans"
|
||||
export type AppLocale = "en-US" | "zh-Hans"
|
||||
export type AppLocaleCountry = "CN" | "US"
|
||||
|
||||
export interface AppLocaleDefinition extends LocaleDefinition {
|
||||
@@ -16,7 +16,7 @@ export const appLocales = [
|
||||
direction: "ltr",
|
||||
languageTag: "en-US",
|
||||
label: "English",
|
||||
locale: "en",
|
||||
locale: "en-US",
|
||||
},
|
||||
{
|
||||
country: "CN",
|
||||
|
||||
Reference in New Issue
Block a user