mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-02 01:20:23 +08:00
Add full Traditional Chinese support for Hong Kong/Taiwan users by creating a zh-Hant dictionary and registering the locale across the web app, metadata, and Electron desktop menu system.
21 lines
669 B
TypeScript
21 lines
669 B
TypeScript
import "server-only"
|
|
|
|
import type { Locale } from "./config"
|
|
|
|
const dictionaries = {
|
|
en: () => import("./dictionaries/en.json").then((m) => m.default),
|
|
zh: () => import("./dictionaries/zh.json").then((m) => m.default),
|
|
ja: () => import("./dictionaries/ja.json").then((m) => m.default),
|
|
"zh-Hant": () =>
|
|
import("./dictionaries/zh-Hant.json").then((m) => m.default),
|
|
}
|
|
|
|
export type Dictionary = Awaited<ReturnType<(typeof dictionaries)["en"]>>
|
|
|
|
export const hasLocale = (locale: string): locale is Locale =>
|
|
locale in dictionaries
|
|
|
|
export async function getDictionary(locale: Locale): Promise<Dictionary> {
|
|
return dictionaries[locale]()
|
|
}
|