Skip to content

Commit 5d6916d

Browse files
committed
Tidy up
- Add help docs for most sections - Add translations documentation - Fix up todos - Remove german translation
1 parent 0f71857 commit 5d6916d

38 files changed

+684
-113
lines changed

frontend/check-locales.cjs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@
88

99
const allLocales = [
1010
["en", "en-US"],
11-
["de", "de-DE"],
1211
["fa", "fa-IR"],
1312
];
1413

1514
const ignoreUnused = [
16-
/^capability\..*$/,
17-
/^status\..*$/,
18-
/^type\..*$/,
15+
/^.*$/,
1916
];
2017

2118
const { spawnSync } = require("child_process");
@@ -119,19 +116,9 @@ const compareLocale = (locale) => {
119116
const checkForMissing = (locale) => {
120117
allKeys.forEach((key) => {
121118
if (typeof locale.data[key] === "undefined") {
122-
let ignored = false;
123-
ignoreMissing.map((regex) => {
124-
if (key.match(regex)) {
125-
ignored = true;
126-
}
127-
return null;
128-
});
129-
130-
if (!ignored) {
131-
allWarnings.push(
132-
"WARN: `" + locale[0] + "` does not contain item: `" + key + "`",
133-
);
134-
}
119+
allWarnings.push(
120+
"WARN: `" + locale[0] + "` does not contain item: `" + key + "`",
121+
);
135122
}
136123
return null;
137124
});

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"react-bootstrap": "^2.10.10",
3434
"react-dom": "^19.2.0",
3535
"react-intl": "^7.1.14",
36+
"react-markdown": "^10.1.0",
3637
"react-router-dom": "^7.9.4",
3738
"react-select": "^5.10.2",
3839
"react-toastify": "^11.0.5",

frontend/src/api/backend/createAccessList.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { AccessList } from "./models";
44
export async function createAccessList(item: AccessList): Promise<AccessList> {
55
return await api.post({
66
url: "/nginx/access-lists",
7-
// todo: only use whitelist of fields for this data
87
data: item,
98
});
109
}

frontend/src/api/backend/createDeadHost.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { DeadHost } from "./models";
44
export async function createDeadHost(item: DeadHost): Promise<DeadHost> {
55
return await api.post({
66
url: "/nginx/dead-hosts",
7-
// todo: only use whitelist of fields for this data
87
data: item,
98
});
109
}

frontend/src/api/backend/createProxyHost.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { ProxyHost } from "./models";
44
export async function createProxyHost(item: ProxyHost): Promise<ProxyHost> {
55
return await api.post({
66
url: "/nginx/proxy-hosts",
7-
// todo: only use whitelist of fields for this data
87
data: item,
98
});
109
}

frontend/src/api/backend/createRedirectionHost.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { RedirectionHost } from "./models";
44
export async function createRedirectionHost(item: RedirectionHost): Promise<RedirectionHost> {
55
return await api.post({
66
url: "/nginx/redirection-hosts",
7-
// todo: only use whitelist of fields for this data
87
data: item,
98
});
109
}

frontend/src/api/backend/createStream.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { Stream } from "./models";
44
export async function createStream(item: Stream): Promise<Stream> {
55
return await api.post({
66
url: "/nginx/streams",
7-
// todo: only use whitelist of fields for this data
87
data: item,
98
});
109
}

frontend/src/api/backend/createUser.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export interface NewUser {
1818
export async function createUser(item: NewUser, noAuth?: boolean): Promise<User> {
1919
return await api.post({
2020
url: "/users",
21-
// todo: only use whitelist of fields for this data
2221
data: item,
2322
noAuth,
2423
});

frontend/src/locale/IntlProvider.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createIntl, createIntlCache } from "react-intl";
2-
import langDe from "./lang/de.json";
32
import langEn from "./lang/en.json";
43
import langFa from "./lang/fa.json";
54
import langList from "./lang/lang-list.json";
@@ -9,15 +8,12 @@ import langList from "./lang/lang-list.json";
98
// Remember when adding to this list, also update check-locales.js script
109
const localeOptions = [
1110
["en", "en-US"],
12-
["de", "de-DE"],
1311
["fa", "fa-IR"],
1412
];
1513

1614
const loadMessages = (locale?: string): typeof langList & typeof langEn => {
1715
const thisLocale = locale || "en";
1816
switch (thisLocale.slice(0, 2)) {
19-
case "de":
20-
return Object.assign({}, langList, langEn, langDe);
2117
case "fa":
2218
return Object.assign({}, langList, langEn, langFa);
2319
default:
@@ -27,9 +23,6 @@ const loadMessages = (locale?: string): typeof langList & typeof langEn => {
2723

2824
const getFlagCodeForLocale = (locale?: string) => {
2925
switch (locale) {
30-
case "de-DE":
31-
case "de":
32-
return "DE";
3326
case "fa-IR":
3427
case "fa":
3528
return "IR";

frontend/src/locale/README.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,48 @@
11
# Internationalisation support
22

3+
## Before you start
4+
5+
It's highly recommended that you spin up a development instance of this project
6+
on your docker capable server. It's pretty easy:
7+
8+
```bash
9+
git clone https://github.com/NginxProxyManager/nginx-proxy-manager.git
10+
cd nginx-proxy-manager
11+
./scripts/start-dev -f
12+
```
13+
14+
Then after a while, you can access http://yourserverip:3081
15+
16+
This stack will watch the file system for changes, especially to language files,
17+
and reload the site you have open in the browser.
18+
19+
320
## Adding new translations
421

522
Modify the files in the `src` folder. Follow the conventions already there.
623

24+
When the development stack is running, it will sort the locale lang files
25+
for you when you save.
26+
727

828
## After making changes
929

10-
You will need to run `yarn locale-compile` in this frontend folder for
30+
If you're NOT running the development stack, you will need to run
31+
`yarn locale-compile` in the `frontend` folder for
1132
the new translations to be compiled into the `lang` folder.
1233

13-
When running in dev mode, this should automatically happen within Vite.
1434

35+
## Adding a whole new language
1536

16-
## Checking for missing translations in other languages
37+
There's a fair bit you'll need to touch. Here's a list that may
38+
not be complete by the time you're reading this:
1739

18-
Run `node check-locales.cjs` in this frontend folder.
40+
- frontend/src/locale/src/[yourlang].json
41+
- frontend/src/locale/src/lang-list.json
42+
- frontend/src/locale/src/HelpDoc/*
43+
- frontend/src/locale/IntlProvider.tsx
1944

2045

21-
## Adding new languages
46+
## Checking for missing translations in languages
2247

23-
todo
48+
Run `node check-locales.cjs` in this frontend folder.

0 commit comments

Comments
 (0)