[+] Country code names

This commit is contained in:
Azalea
2025-02-08 23:43:03 -05:00
parent 81743b22e9
commit 5a06ae52a9
3 changed files with 507 additions and 0 deletions

View File

@@ -2,6 +2,9 @@ import { EN_REF, type LocalizedMessages } from "./i18n/en_ref";
import { ZH } from "./i18n/zh";
import type { GameName } from "./scoring";
import zhCountires from "./i18n/zh_countries.json"
import enCountires from "./i18n/en_countries.json"
type Lang = 'en' | 'zh'
const msgs: Record<Lang, LocalizedMessages> = {
@@ -9,6 +12,10 @@ const msgs: Record<Lang, LocalizedMessages> = {
zh: ZH
}
const countries: Record<Lang, typeof enCountires> = {
en: enCountires,
zh: zhCountires
}
let lang: Lang = 'en'
@@ -48,5 +55,9 @@ export function t(key: keyof LocalizedMessages, variables?: { [index: string]: a
}
Object.assign(window, { t })
export function getCountryName(code: keyof typeof enCountires) {
return countries[lang][code]
}
export const GAME_TITLE: { [key in GameName]: string } =
{chu3: t("game.chu3"), mai2: t("game.mai2"), ongeki: t("game.ongeki"), wacca: t("game.wacca")}