Skip to content

Commit

Permalink
Add Chinese (Traditional) translation
Browse files Browse the repository at this point in the history
  • Loading branch information
cdauth committed Jun 10, 2024
1 parent 0702d0c commit b7b06fe
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions frontend/src/lib/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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) {
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions leaflet/src/i18n/zh-Hant.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions leaflet/src/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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) {
Expand All @@ -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));
}
}

Expand Down
2 changes: 2 additions & 0 deletions server/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions server/src/i18n/zh-Hant.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion utils/src/i18n-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
6 changes: 5 additions & 1 deletion utils/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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) {
Expand All @@ -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));
}
}

Expand All @@ -42,6 +45,7 @@ export function getLocalizedLanguageList(): Record<string, string> {
"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" })
};
};
3 changes: 2 additions & 1 deletion utils/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion utils/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions utils/src/i18n/zh-Hant.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit b7b06fe

Please sign in to comment.