From b7b06fe00229e57fc3ffb1c792f5aaad20161c39 Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Mon, 10 Jun 2024 09:54:52 +0200 Subject: [PATCH] Add Chinese (Traditional) translation --- frontend/src/lib/utils/i18n.ts | 3 +++ leaflet/src/i18n/zh-Hant.json | 1 + leaflet/src/utils/i18n.ts | 3 +++ server/src/i18n.ts | 2 ++ server/src/i18n/zh-Hant.json | 1 + utils/src/i18n-utils.ts | 2 +- utils/src/i18n.ts | 6 +++++- utils/src/i18n/de.json | 3 ++- utils/src/i18n/en.json | 3 ++- utils/src/i18n/zh-Hant.json | 1 + 10 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 leaflet/src/i18n/zh-Hant.json create mode 100644 server/src/i18n/zh-Hant.json create mode 100644 utils/src/i18n/zh-Hant.json diff --git a/frontend/src/lib/utils/i18n.ts b/frontend/src/lib/utils/i18n.ts index 45440514..4cfa5feb 100644 --- a/frontend/src/lib/utils/i18n.ts +++ b/frontend/src/lib/utils/i18n.ts @@ -6,6 +6,7 @@ import messagesDe from "../../i18n/de.json"; import messagesEs from "../../i18n/es.json"; import messagesNbNo from "../../i18n/nb-NO.json"; import messagesRu from "../../i18n/ru.json"; +import messagesZhHant from "../../i18n/zh-Hant.json"; import { LANG_COOKIE, LANG_QUERY, decodeQueryString, getAcceptHotI18n, getRawI18n, onI18nReady, setCurrentUnitsGetter } from "facilmap-utils"; import { cookies } from "./cookies"; import { unitsValidator } from "facilmap-types"; @@ -18,6 +19,7 @@ onI18nReady((i18n) => { i18n.addResourceBundle("es", namespace, messagesEs); i18n.addResourceBundle("nb-NO", namespace, messagesNbNo); i18n.addResourceBundle("ru", namespace, messagesRu); + i18n.addResourceBundle("zh-Hant", namespace, messagesZhHant); }); if (import.meta.hot) { @@ -26,6 +28,7 @@ if (import.meta.hot) { import.meta.hot!.accept(`../../i18n/es.json`, getAcceptHotI18n("es", namespace)); import.meta.hot!.accept(`../../i18n/nb-NO.json`, getAcceptHotI18n("nb-NO", namespace)); import.meta.hot!.accept(`../../i18n/ru.json`, getAcceptHotI18n("ru", namespace)); + import.meta.hot!.accept(`../../i18n/zh-Hant.json`, getAcceptHotI18n("zh-Hant", namespace)); } export const i18nResourceChangeCounter = ref(0); diff --git a/leaflet/src/i18n/zh-Hant.json b/leaflet/src/i18n/zh-Hant.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/leaflet/src/i18n/zh-Hant.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/leaflet/src/utils/i18n.ts b/leaflet/src/utils/i18n.ts index 83e4d112..9f8b9485 100644 --- a/leaflet/src/utils/i18n.ts +++ b/leaflet/src/utils/i18n.ts @@ -5,6 +5,7 @@ import messagesEn from "../i18n/en.json"; import messagesEs from "../i18n/es.json"; import messagesNbNo from "../i18n/nb-NO.json"; import messagesRu from "../i18n/ru.json"; +import messagesZhHant from "../i18n/zh-Hant.json"; import { getAcceptHotI18n, getRawI18n, onI18nReady } from "facilmap-utils"; const namespace = "facilmap-leaflet"; @@ -15,6 +16,7 @@ onI18nReady((i18n) => { i18n.addResourceBundle("es", namespace, messagesEs); i18n.addResourceBundle("nb-NO", namespace, messagesNbNo); i18n.addResourceBundle("ru", namespace, messagesRu); + i18n.addResourceBundle("zh-Hant", namespace, messagesZhHant); }); if (import.meta.hot) { @@ -24,6 +26,7 @@ if (import.meta.hot) { import.meta.hot!.accept(`../i18n/es.json`, getAcceptHotI18n("es", namespace)); import.meta.hot!.accept(`../i18n/nb-NO.json`, getAcceptHotI18n("nb-NO", namespace)); import.meta.hot!.accept(`../i18n/ru.json`, getAcceptHotI18n("ru", namespace)); + import.meta.hot!.accept(`../i18n/zh-Hant.json`, getAcceptHotI18n("zh-Hant", namespace)); } } diff --git a/server/src/i18n.ts b/server/src/i18n.ts index eba260b6..657bec46 100644 --- a/server/src/i18n.ts +++ b/server/src/i18n.ts @@ -4,6 +4,7 @@ import messagesDe from "./i18n/de.json"; import messagesEs from "./i18n/es.json"; import messagesNbNo from "./i18n/nb-NO.json"; import messagesRu from "./i18n/ru.json"; +import messagesZhHant from "./i18n/zh-Hant.json"; import type { i18n } from "i18next"; import type { Domain } from "domain"; import { Router } from "express"; @@ -43,6 +44,7 @@ onI18nReady((i18n) => { i18n.addResourceBundle("es", namespace, messagesEs); i18n.addResourceBundle("nb-NO", namespace, messagesNbNo); i18n.addResourceBundle("ru", namespace, messagesRu); + i18n.addResourceBundle("zh-Hant", namespace, messagesZhHant); }); export function getDomainLang(): FacilMapProcessLang | undefined { diff --git a/server/src/i18n/zh-Hant.json b/server/src/i18n/zh-Hant.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/server/src/i18n/zh-Hant.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/utils/src/i18n-utils.ts b/utils/src/i18n-utils.ts index c0e071bd..c5fc1837 100644 --- a/utils/src/i18n-utils.ts +++ b/utils/src/i18n-utils.ts @@ -2,7 +2,7 @@ import { Units } from "facilmap-types"; import i18next, { type CustomPluginOptions, type Module, type Newable, type i18n } from "i18next"; import LanguageDetector from "i18next-browser-languagedetector"; -export const LANGUAGES = ["en", "de", "es", "nb-NO", "ru"]; +export const LANGUAGES = ["en", "de", "es", "nb-NO", "ru", "zh-Hant"]; export const DEFAULT_LANGUAGE = "en"; diff --git a/utils/src/i18n.ts b/utils/src/i18n.ts index 3f2c66f3..4426771a 100644 --- a/utils/src/i18n.ts +++ b/utils/src/i18n.ts @@ -6,6 +6,7 @@ import messagesEn from "./i18n/en.json"; import messagesEs from "./i18n/es.json"; import messagesNbNo from "./i18n/nb-NO.json"; import messagesRu from "./i18n/ru.json"; +import messagesZhHant from "./i18n/zh-Hant.json"; const namespace = "facilmap-utils"; @@ -15,6 +16,7 @@ onI18nReady((i18n) => { i18n.addResourceBundle("es", namespace, messagesEs); i18n.addResourceBundle("nb-NO", namespace, messagesNbNo); i18n.addResourceBundle("ru", namespace, messagesRu); + i18n.addResourceBundle("zh-Hant", namespace, messagesZhHant); }); if (import.meta.hot) { @@ -24,6 +26,7 @@ if (import.meta.hot) { import.meta.hot!.accept(`./i18n/es.json`, getAcceptHotI18n("es", namespace)); import.meta.hot!.accept(`./i18n/nb-NO.json`, getAcceptHotI18n("nb-NO", namespace)); import.meta.hot!.accept(`./i18n/ru.json`, getAcceptHotI18n("ru", namespace)); + import.meta.hot!.accept(`./i18n/zh-Hant.json`, getAcceptHotI18n("zh-Hant", namespace)); } } @@ -42,6 +45,7 @@ export function getLocalizedLanguageList(): Record { "de": getI18n().t("i18n.language-de", { lng: "de" }), "es": getI18n().t("i18n.language-es", { lng: "es" }), "nb-NO": getI18n().t("i18n.language-nb-no", { lng: "nb-NO" }), - "ru": getI18n().t("i18n.language-ru", { lng: "ru" }) + "ru": getI18n().t("i18n.language-ru", { lng: "ru" }), + "zh-Hant": getI18n().t("i18n.language-zh-hant", { lng: "zh-Hant" }) }; }; \ No newline at end of file diff --git a/utils/src/i18n/de.json b/utils/src/i18n/de.json index dd36dfef..10ec1e8b 100644 --- a/utils/src/i18n/de.json +++ b/utils/src/i18n/de.json @@ -19,7 +19,8 @@ "language-de": "Deutsch", "language-es": "Spanisch", "language-nb-no": "Norwegisch Bokmål (Norwegen)", - "language-ru": "Russian" + "language-ru": "Russian", + "language-zh-hant": "Chinesisch (traditionell)" }, "objects": { "untitled-marker": "Unbenannter Marker", diff --git a/utils/src/i18n/en.json b/utils/src/i18n/en.json index 2b7be860..c4b54614 100644 --- a/utils/src/i18n/en.json +++ b/utils/src/i18n/en.json @@ -19,7 +19,8 @@ "language-de": "German", "language-es": "Spanish", "language-nb-no": "Norwegian Bokmål (Norway)", - "language-ru": "Russian" + "language-ru": "Russian", + "language-zh-hant": "Chinese (Traditional)" }, "objects": { "untitled-marker": "Untitled marker", diff --git a/utils/src/i18n/zh-Hant.json b/utils/src/i18n/zh-Hant.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/utils/src/i18n/zh-Hant.json @@ -0,0 +1 @@ +{} \ No newline at end of file