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
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user