Files
simple-react-app-kit/apps/web/src/i18n/app-locales.ts
T
Maofeng 8cf3a1f03a feat(web): integrate localized application catalogs
- compose app, UI, and independently imported block catalogs from JSON configuration\n- persist the selected locale on the server and activate it without hydration flicker\n- add a flag-based language switcher and localized navigation descriptors\n- mount the redesigned i18n devtool only in development\n- regenerate English and Simplified Chinese catalogs and add switcher coverage
2026-07-30 14:48:25 +08:00

33 lines
774 B
TypeScript

import type { LocaleDefinition } from "@workspace/i18n"
export type AppLocale = "en" | "zh-Hans"
export type AppLocaleCountry = "CN" | "US"
export interface AppLocaleDefinition extends LocaleDefinition {
country: AppLocaleCountry
locale: AppLocale
}
export const DEFAULT_APP_LOCALE: AppLocale = "zh-Hans"
export const appLocales = [
{
country: "US",
direction: "ltr",
languageTag: "en-US",
label: "English",
locale: "en",
},
{
country: "CN",
direction: "ltr",
languageTag: "zh-CN",
label: "简体中文",
locale: "zh-Hans",
},
] as const satisfies readonly AppLocaleDefinition[]
export function isAppLocale(value: unknown): value is AppLocale {
return appLocales.some((definition) => definition.locale === value)
}