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,20 @@
|
||||
import { createServerFn } from "@tanstack/react-start"
|
||||
|
||||
import { isAppLocale } from "@/i18n/app-locales"
|
||||
import { readAppLocale, writeAppLocale } from "./app-locale.server"
|
||||
|
||||
export const getAppLocale = createServerFn({ method: "GET" }).handler(() => {
|
||||
return readAppLocale()
|
||||
})
|
||||
|
||||
export const setAppLocale = createServerFn({ method: "POST" })
|
||||
.validator((value: unknown) => {
|
||||
if (!isAppLocale(value)) {
|
||||
throw new Error("Invalid app locale")
|
||||
}
|
||||
|
||||
return value
|
||||
})
|
||||
.handler(({ data }) => {
|
||||
writeAppLocale(data)
|
||||
})
|
||||
Reference in New Issue
Block a user