Skip to content

Commit

Permalink
Add Czech language
Browse files Browse the repository at this point in the history
  • Loading branch information
cdauth committed Nov 8, 2024
1 parent be30e18 commit f47aa2f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions frontend/src/lib/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
Expand All @@ -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));
Expand Down
3 changes: 3 additions & 0 deletions leaflet/src/utils/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="vite/client" />
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";
Expand All @@ -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);
Expand All @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions server/src/i18n.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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);
Expand Down
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", "fr", "nb-NO", "ru", "zh-Hant"];
export const LANGUAGES = ["en", "cs", "de", "es", "fr", "nb-NO", "ru", "zh-Hant"];

export const DEFAULT_LANGUAGE = "en";

Expand Down
4 changes: 4 additions & 0 deletions utils/src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="vite/client" />
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";
Expand All @@ -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);
Expand All @@ -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));
Expand All @@ -45,6 +48,7 @@ export function getI18n(): Pick<i18n, "t"> {
export function getLocalizedLanguageList(): Record<string, string> {
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" }),
Expand Down
1 change: 1 addition & 0 deletions utils/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"i18n": {
"language-en": "Englisch",
"language-cs": "Tschechisch",
"language-de": "Deutsch",
"language-es": "Spanisch",
"language-fr": "Französisch",
Expand Down
1 change: 1 addition & 0 deletions utils/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"i18n": {
"language-en": "English",
"language-cs": "Czech",
"language-de": "German",
"language-es": "Spanish",
"language-fr": "French",
Expand Down

0 comments on commit f47aa2f

Please sign in to comment.