feat(web-i18n): add es/fr locales and expand switcher locale set
This commit is contained in:
19
packages/i18n/package.json
Normal file
19
packages/i18n/package.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "@cms/i18n",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"lint": "biome check src",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cms/config": "workspace:*",
|
||||
"@biomejs/biome": "2.3.14",
|
||||
"typescript": "5.9.3"
|
||||
}
|
||||
}
|
||||
16
packages/i18n/src/index.ts
Normal file
16
packages/i18n/src/index.ts
Normal file
@ -0,0 +1,16 @@
|
||||
export const locales = ["de", "en", "es", "fr"] as const
|
||||
|
||||
export type AppLocale = (typeof locales)[number]
|
||||
|
||||
export const defaultLocale: AppLocale = "en"
|
||||
|
||||
export const localeLabels: Record<AppLocale, string> = {
|
||||
de: "Deutsch",
|
||||
en: "English",
|
||||
es: "Español",
|
||||
fr: "Français",
|
||||
}
|
||||
|
||||
export function isAppLocale(value: string): value is AppLocale {
|
||||
return locales.includes(value as AppLocale)
|
||||
}
|
||||
8
packages/i18n/tsconfig.json
Normal file
8
packages/i18n/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@cms/config/tsconfig/base",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user