From c2177abe39e5177e287b1b5aedf21db16a6c03e9 Mon Sep 17 00:00:00 2001 From: Jelcoo <53396500+Jelcoo@users.noreply.github.com> Date: Thu, 13 Nov 2025 15:25:12 +0100 Subject: [PATCH] Add language to frontend settings & correct some translations --- frontend/check-locales.cjs | 1 + frontend/src/locale/IntlProvider.tsx | 28 +++++++++++++++++++++++----- frontend/src/locale/src/nl.json | 10 +++++----- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/frontend/check-locales.cjs b/frontend/check-locales.cjs index b4ffe859..feb61a93 100755 --- a/frontend/check-locales.cjs +++ b/frontend/check-locales.cjs @@ -15,6 +15,7 @@ const allLocales = [ ["zh", "zh-CN"], ["pl", "pl-PL"], ["it", "it-IT"], + ["nl", "nl-NL"], ]; const ignoreUnused = [ diff --git a/frontend/src/locale/IntlProvider.tsx b/frontend/src/locale/IntlProvider.tsx index e92304b4..395f45dc 100755 --- a/frontend/src/locale/IntlProvider.tsx +++ b/frontend/src/locale/IntlProvider.tsx @@ -2,14 +2,15 @@ import { createIntl, createIntlCache } from "react-intl"; import langDe from "./lang/de.json"; import langEn from "./lang/en.json"; import langEs from "./lang/es.json"; +import langIt from "./lang/it.json"; import langJa from "./lang/ja.json"; import langList from "./lang/lang-list.json"; +import langNl from "./lang/nl.json"; +import langPl from "./lang/pl.json"; import langRu from "./lang/ru.json"; import langSk from "./lang/sk.json"; -import langZh from "./lang/zh.json"; -import langPl from "./lang/pl.json"; -import langIt from "./lang/it.json"; import langVi from "./lang/vi.json"; +import langZh from "./lang/zh.json"; // first item of each array should be the language code, // not the country code @@ -25,6 +26,7 @@ const localeOptions = [ ["pl", "pl-PL"], ["it", "it-IT"], ["vi", "vi-VN"], + ["nl", "nl-NL"], ]; const loadMessages = (locale?: string): typeof langList & typeof langEn => { @@ -48,6 +50,8 @@ const loadMessages = (locale?: string): typeof langList & typeof langEn => { return Object.assign({}, langList, langEn, langIt); case "vi": return Object.assign({}, langList, langEn, langVi); + case "nl": + return Object.assign({}, langList, langEn, langNl); default: return Object.assign({}, langList, langEn); } @@ -82,6 +86,9 @@ const getFlagCodeForLocale = (locale?: string) => { case "vi": case "vi-VN": return "VN"; + case "nl": + case "nl-NL": + return "NL"; default: return "EN"; } @@ -105,7 +112,10 @@ const getLocale = (short = false) => { const cache = createIntlCache(); const initialMessages = loadMessages(getLocale()); -let intl = createIntl({ locale: getLocale(), messages: initialMessages }, cache); +let intl = createIntl( + { locale: getLocale(), messages: initialMessages }, + cache, +); const changeLocale = (locale: string): void => { const messages = loadMessages(locale); @@ -145,4 +155,12 @@ const T = ({ ); }; -export { localeOptions, getFlagCodeForLocale, getLocale, createIntl, changeLocale, intl, T }; +export { + localeOptions, + getFlagCodeForLocale, + getLocale, + createIntl, + changeLocale, + intl, + T, +}; diff --git a/frontend/src/locale/src/nl.json b/frontend/src/locale/src/nl.json index 680623b3..2732f5e4 100644 --- a/frontend/src/locale/src/nl.json +++ b/frontend/src/locale/src/nl.json @@ -126,7 +126,7 @@ "defaultMessage": "Laat leeg om de standaardwaarde van de plugin te gebruiken. Aantal seconden om te wachten op DNS propagatie." }, "certificates.dns.provider": { - "defaultMessage": "DNS Aanbieder" + "defaultMessage": "DNS Provider" }, "certificates.dns.warning": { "defaultMessage": "Deze sectie vereist wat informatie over Certbot en zijn DNS plugins. Gebruik de documentatie van de bijbehorende plugins." @@ -201,7 +201,7 @@ "defaultMessage": "Protocol" }, "column.provider": { - "defaultMessage": "Aanbieder" + "defaultMessage": "Provider" }, "column.roles": { "defaultMessage": "Rollen" @@ -504,7 +504,7 @@ "defaultMessage": "Openbaar" }, "redirection-host": { - "defaultMessage": "Omleiding Host" + "defaultMessage": "Redirection Host" }, "redirection-host.forward-domain": { "defaultMessage": "Doorgestuurd Domein" @@ -513,10 +513,10 @@ "defaultMessage": "HTTP Code" }, "redirection-hosts": { - "defaultMessage": "Omleiding Hosts" + "defaultMessage": "Redirection Hosts" }, "redirection-hosts.count": { - "defaultMessage": "{count} {count, plural, one {Omleiding Host} other {Omleiding Hosts}}" + "defaultMessage": "{count} {count, plural, one {Redirection Host} other {Redirection Hosts}}" }, "role.admin": { "defaultMessage": "Beheerder"