From f47aa2f7b4d37485f86b5f6824efbd82d57b2e4a Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Fri, 8 Nov 2024 01:35:49 +0100 Subject: [PATCH] Add Czech language --- frontend/src/lib/utils/i18n.ts | 3 +++ leaflet/src/utils/i18n.ts | 3 +++ server/src/i18n.ts | 2 ++ utils/src/i18n-utils.ts | 2 +- utils/src/i18n.ts | 4 ++++ utils/src/i18n/de.json | 1 + utils/src/i18n/en.json | 1 + 7 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/utils/i18n.ts b/frontend/src/lib/utils/i18n.ts index e3cebe22..6f8023e0 100644 --- a/frontend/src/lib/utils/i18n.ts +++ b/frontend/src/lib/utils/i18n.ts @@ -2,6 +2,7 @@ import { type i18n } from "i18next"; import { defineComponent, ref, type Directive } from "vue"; import messagesEn from "../../i18n/en.json"; +import messagesCs from "../../i18n/cs.json"; import messagesDe from "../../i18n/de.json"; import messagesEs from "../../i18n/es.json"; import messagesFr from "../../i18n/fr.json"; @@ -16,6 +17,7 @@ const namespace = "facilmap-frontend"; onI18nReady((i18n) => { i18n.addResourceBundle("en", namespace, messagesEn); + i18n.addResourceBundle("cs", namespace, messagesCs); i18n.addResourceBundle("de", namespace, messagesDe); i18n.addResourceBundle("es", namespace, messagesEs); i18n.addResourceBundle("fr", namespace, messagesFr); @@ -26,6 +28,7 @@ onI18nReady((i18n) => { if (import.meta.hot) { import.meta.hot!.accept(`../../i18n/en.json`, getAcceptHotI18n("en", namespace)); + import.meta.hot!.accept(`../../i18n/cs.json`, getAcceptHotI18n("cs", namespace)); import.meta.hot!.accept(`../../i18n/de.json`, getAcceptHotI18n("de", namespace)); import.meta.hot!.accept(`../../i18n/es.json`, getAcceptHotI18n("es", namespace)); import.meta.hot!.accept(`../../i18n/fr.json`, getAcceptHotI18n("fr", namespace)); diff --git a/leaflet/src/utils/i18n.ts b/leaflet/src/utils/i18n.ts index d1518102..efeabdb5 100644 --- a/leaflet/src/utils/i18n.ts +++ b/leaflet/src/utils/i18n.ts @@ -1,5 +1,6 @@ /// import type { i18n } from "i18next"; +import messagesCs from "../i18n/cs.json"; import messagesDe from "../i18n/de.json"; import messagesEn from "../i18n/en.json"; import messagesEs from "../i18n/es.json"; @@ -13,6 +14,7 @@ const namespace = "facilmap-leaflet"; onI18nReady((i18n) => { i18n.addResourceBundle("en", namespace, messagesEn); + i18n.addResourceBundle("cs", namespace, messagesCs); i18n.addResourceBundle("de", namespace, messagesDe); i18n.addResourceBundle("es", namespace, messagesEs); i18n.addResourceBundle("fr", namespace, messagesFr); @@ -24,6 +26,7 @@ onI18nReady((i18n) => { if (import.meta.hot) { if (import.meta.hot) { import.meta.hot!.accept(`../i18n/en.json`, getAcceptHotI18n("en", namespace)); + import.meta.hot!.accept(`../i18n/cs.json`, getAcceptHotI18n("cs", namespace)); import.meta.hot!.accept(`../i18n/de.json`, getAcceptHotI18n("de", namespace)); import.meta.hot!.accept(`../i18n/es.json`, getAcceptHotI18n("es", namespace)); import.meta.hot!.accept(`../i18n/fr.json`, getAcceptHotI18n("fr", namespace)); diff --git a/server/src/i18n.ts b/server/src/i18n.ts index a9fb3255..db312037 100644 --- a/server/src/i18n.ts +++ b/server/src/i18n.ts @@ -1,5 +1,6 @@ import { defaultI18nGetter, getRawI18n, onI18nReady, setLanguageDetector, setI18nGetter, isCustomLanguageDetector, isCustomI18nGetter, LANG_QUERY, LANG_COOKIE, setCurrentUnitsGetter } from "facilmap-utils"; import messagesEn from "./i18n/en.json"; +import messagesCs from "./i18n/cs.json"; import messagesDe from "./i18n/de.json"; import messagesEs from "./i18n/es.json"; import messagesFr from "./i18n/fr.json"; @@ -41,6 +42,7 @@ declare module 'domain' { onI18nReady((i18n) => { i18n.addResourceBundle("en", namespace, messagesEn); + i18n.addResourceBundle("cs", namespace, messagesCs); i18n.addResourceBundle("de", namespace, messagesDe); i18n.addResourceBundle("es", namespace, messagesEs); i18n.addResourceBundle("fr", namespace, messagesFr); diff --git a/utils/src/i18n-utils.ts b/utils/src/i18n-utils.ts index ae55d4e6..736f5d79 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", "fr", "nb-NO", "ru", "zh-Hant"]; +export const LANGUAGES = ["en", "cs", "de", "es", "fr", "nb-NO", "ru", "zh-Hant"]; export const DEFAULT_LANGUAGE = "en"; diff --git a/utils/src/i18n.ts b/utils/src/i18n.ts index 5fe4d2ad..3b920b83 100644 --- a/utils/src/i18n.ts +++ b/utils/src/i18n.ts @@ -1,6 +1,7 @@ /// import type { i18n } from "i18next"; import { getAcceptHotI18n, getRawI18n, onI18nReady } from "./i18n-utils"; +import messagesCs from "./i18n/cs.json"; import messagesDe from "./i18n/de.json"; import messagesEn from "./i18n/en.json"; import messagesEs from "./i18n/es.json"; @@ -13,6 +14,7 @@ const namespace = "facilmap-utils"; onI18nReady((i18n) => { i18n.addResourceBundle("en", namespace, messagesEn); + i18n.addResourceBundle("cs", namespace, messagesCs); i18n.addResourceBundle("de", namespace, messagesDe); i18n.addResourceBundle("es", namespace, messagesEs); i18n.addResourceBundle("fr", namespace, messagesFr); @@ -24,6 +26,7 @@ onI18nReady((i18n) => { if (import.meta.hot) { if (import.meta.hot) { import.meta.hot!.accept(`./i18n/en.json`, getAcceptHotI18n("en", namespace)); + import.meta.hot!.accept(`./i18n/cs.json`, getAcceptHotI18n("cs", namespace)); import.meta.hot!.accept(`./i18n/de.json`, getAcceptHotI18n("de", namespace)); import.meta.hot!.accept(`./i18n/es.json`, getAcceptHotI18n("es", namespace)); import.meta.hot!.accept(`./i18n/fr.json`, getAcceptHotI18n("fr", namespace)); @@ -45,6 +48,7 @@ export function getI18n(): Pick { export function getLocalizedLanguageList(): Record { return { "en": getI18n().t("i18n.language-en", { lng: "en" }), + "cs": getI18n().t("i18n.language-cs", { lng: "cs" }), "de": getI18n().t("i18n.language-de", { lng: "de" }), "es": getI18n().t("i18n.language-es", { lng: "es" }), "fr": getI18n().t("i18n.language-fr", { lng: "fr" }), diff --git a/utils/src/i18n/de.json b/utils/src/i18n/de.json index 6c19164d..9359b5d1 100644 --- a/utils/src/i18n/de.json +++ b/utils/src/i18n/de.json @@ -16,6 +16,7 @@ }, "i18n": { "language-en": "Englisch", + "language-cs": "Tschechisch", "language-de": "Deutsch", "language-es": "Spanisch", "language-fr": "Französisch", diff --git a/utils/src/i18n/en.json b/utils/src/i18n/en.json index 2a7afe5f..60e6ef4d 100644 --- a/utils/src/i18n/en.json +++ b/utils/src/i18n/en.json @@ -16,6 +16,7 @@ }, "i18n": { "language-en": "English", + "language-cs": "Czech", "language-de": "German", "language-es": "Spanish", "language-fr": "French",