Ver código fonte

Add language to frontend settings & correct some translations

Jelcoo 1 mês atrás
pai
commit
c2177abe39

+ 1 - 0
frontend/check-locales.cjs

@@ -15,6 +15,7 @@ const allLocales = [
 	["zh", "zh-CN"],
 	["pl", "pl-PL"],
 	["it", "it-IT"],
+	["nl", "nl-NL"],
 ];
 
 const ignoreUnused = [

+ 23 - 5
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,
+};

+ 5 - 5
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"