mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-30 10:14:03 +00:00
commit
7a0cebf5bb
11 changed files with 51 additions and 48 deletions
|
@ -1,4 +1,5 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
root: true,
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
commonjs: true,
|
commonjs: true,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Need to use es6 to read language files
|
// Need to use ES6 to read language files
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
@ -14,6 +14,7 @@ const copyRecursiveSync = function (src, dest) {
|
||||||
let exists = fs.existsSync(src);
|
let exists = fs.existsSync(src);
|
||||||
let stats = exists && fs.statSync(src);
|
let stats = exists && fs.statSync(src);
|
||||||
let isDirectory = exists && stats.isDirectory();
|
let isDirectory = exists && stats.isDirectory();
|
||||||
|
|
||||||
if (isDirectory) {
|
if (isDirectory) {
|
||||||
fs.mkdirSync(dest);
|
fs.mkdirSync(dest);
|
||||||
fs.readdirSync(src).forEach(function (childItemName) {
|
fs.readdirSync(src).forEach(function (childItemName) {
|
||||||
|
@ -24,8 +25,9 @@ const copyRecursiveSync = function (src, dest) {
|
||||||
fs.copyFileSync(src, dest);
|
fs.copyFileSync(src, dest);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
console.log(process.argv)
|
|
||||||
const baseLangCode = process.argv[2] || "zh-HK";
|
console.log("Arguments:", process.argv)
|
||||||
|
const baseLangCode = process.argv[2] || "en";
|
||||||
console.log("Base Lang: " + baseLangCode);
|
console.log("Base Lang: " + baseLangCode);
|
||||||
fs.rmdirSync("./languages", { recursive: true });
|
fs.rmdirSync("./languages", { recursive: true });
|
||||||
copyRecursiveSync("../../src/languages", "./languages");
|
copyRecursiveSync("../../src/languages", "./languages");
|
||||||
|
@ -33,19 +35,23 @@ copyRecursiveSync("../../src/languages", "./languages");
|
||||||
const en = (await import("./languages/en.js")).default;
|
const en = (await import("./languages/en.js")).default;
|
||||||
const baseLang = (await import(`./languages/${baseLangCode}.js`)).default;
|
const baseLang = (await import(`./languages/${baseLangCode}.js`)).default;
|
||||||
const files = fs.readdirSync("./languages");
|
const files = fs.readdirSync("./languages");
|
||||||
console.log(files);
|
console.log("Files:", files);
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (file.endsWith(".js")) {
|
if (!file.endsWith(".js")) {
|
||||||
|
console.log("Skipping " + file)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Processing " + file);
|
console.log("Processing " + file);
|
||||||
const lang = await import("./languages/" + file);
|
const lang = await import("./languages/" + file);
|
||||||
|
|
||||||
let obj;
|
let obj;
|
||||||
|
|
||||||
if (lang.default) {
|
if (lang.default) {
|
||||||
console.log("is js module");
|
|
||||||
obj = lang.default;
|
obj = lang.default;
|
||||||
} else {
|
} else {
|
||||||
console.log("empty file");
|
console.log("Empty file");
|
||||||
obj = {
|
obj = {
|
||||||
languageName: "<Your Language name in your language (not in English)>"
|
languageName: "<Your Language name in your language (not in English)>"
|
||||||
};
|
};
|
||||||
|
@ -58,21 +64,21 @@ for (const file of files) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (baseLang !== en) {
|
||||||
// Base second
|
// Base second
|
||||||
for (const key in baseLang) {
|
for (const key in baseLang) {
|
||||||
if (! obj[key]) {
|
if (! obj[key]) {
|
||||||
obj[key] = key;
|
obj[key] = key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const code = "export default " + util.inspect(obj, {
|
const code = "export default " + util.inspect(obj, {
|
||||||
depth: null,
|
depth: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.writeFileSync(`../../src/languages/${file}`, code);
|
fs.writeFileSync(`../../src/languages/${file}`, code);
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.rmdirSync("./languages", { recursive: true });
|
fs.rmdirSync("./languages", { recursive: true });
|
||||||
console.log("Done, fix the format by eslint now");
|
console.log("Done. Fixing formatting by ESLint...");
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
"test-install-script-ubuntu": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu.dockerfile .",
|
"test-install-script-ubuntu": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu.dockerfile .",
|
||||||
"test-install-script-ubuntu1604": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu1604.dockerfile .",
|
"test-install-script-ubuntu1604": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu1604.dockerfile .",
|
||||||
"simple-dns-server": "node extra/simple-dns-server.js",
|
"simple-dns-server": "node extra/simple-dns-server.js",
|
||||||
"update-language-files": "cd extra/update-language-files && node index.js %npm_config_base_lang% && eslint ../../src/languages/**.js --fix"
|
"update-language-files_old": "cd extra/update-language-files && node index.js %npm_config_base_lang% && eslint ../../src/languages/**.js --fix",
|
||||||
|
"update-language-files": "cd extra/update-language-files && node index.js && eslint ../../src/languages/**.js --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# How to translate
|
# How to translate
|
||||||
|
|
||||||
1. Fork this repo.
|
1. Fork this repo.
|
||||||
2. Create a language file. (e.g. `zh-TW.js`) The filename must be ISO language code: http://www.lingoes.net/en/translator/langcode.htm
|
2. Create a language file (e.g. `zh-TW.js`). The filename must be ISO language code: http://www.lingoes.net/en/translator/langcode.htm
|
||||||
3. `npm run update-language-files --base-lang=de-DE`
|
3. Run `npm run update-language-files`. You can also use this command to check if there are new strings to translate for your language.
|
||||||
4. Your language file should be filled in. You can translate now.
|
4. Your language file should be filled in. You can translate now.
|
||||||
5. Translate `src/pages/Settings.vue` (search for a `Confirm` component with `rel="confirmDisableAuth"`).
|
5. Translate `src/pages/Settings.vue` (search for a `Confirm` component with `rel="confirmDisableAuth"`).
|
||||||
6. Import your language file in `src/i18n.js` and add it to `languageList` constant.
|
6. Import your language file in `src/i18n.js` and add it to `languageList` constant.
|
||||||
|
|
|
@ -113,9 +113,6 @@ export default {
|
||||||
"Create your admin account": "Erstelle dein Admin Konto",
|
"Create your admin account": "Erstelle dein Admin Konto",
|
||||||
"Repeat Password": "Wiederhole das Passwort",
|
"Repeat Password": "Wiederhole das Passwort",
|
||||||
"Resource Record Type": "Resource Record Type",
|
"Resource Record Type": "Resource Record Type",
|
||||||
"Export": "Export",
|
|
||||||
"Import": "Import",
|
|
||||||
"Import/Export Backup": "Import/Export Backup",
|
|
||||||
Export: "Export",
|
Export: "Export",
|
||||||
Import: "Import",
|
Import: "Import",
|
||||||
respTime: "Antw. Zeit (ms)",
|
respTime: "Antw. Zeit (ms)",
|
||||||
|
@ -133,8 +130,8 @@ export default {
|
||||||
"Clear all statistics": "Lösche alle Statistiken",
|
"Clear all statistics": "Lösche alle Statistiken",
|
||||||
importHandleDescription: "Wähle 'Vorhandene überspringen' aus, wenn jeder Monitor oder Benachrichtigung mit demselben Namen übersprungen werden soll. 'Überschreiben' löscht jeden vorhandenen Monitor sowie Benachrichtigungen.",
|
importHandleDescription: "Wähle 'Vorhandene überspringen' aus, wenn jeder Monitor oder Benachrichtigung mit demselben Namen übersprungen werden soll. 'Überschreiben' löscht jeden vorhandenen Monitor sowie Benachrichtigungen.",
|
||||||
"Skip existing": "Vorhandene überspringen",
|
"Skip existing": "Vorhandene überspringen",
|
||||||
"Overwrite": "Überschreiben",
|
Overwrite: "Überschreiben",
|
||||||
"Options": "Optionen",
|
Options: "Optionen",
|
||||||
confirmImportMsg: "Möchtest du das Backup wirklich importieren? Bitte stelle sicher, dass die richtige Import Option ausgewählt ist.",
|
confirmImportMsg: "Möchtest du das Backup wirklich importieren? Bitte stelle sicher, dass die richtige Import Option ausgewählt ist.",
|
||||||
"Keep both": "Beide behalten",
|
"Keep both": "Beide behalten",
|
||||||
twoFAVerifyLabel: "Bitte trage deinen Token ein um zu verifizieren das 2FA funktioniert",
|
twoFAVerifyLabel: "Bitte trage deinen Token ein um zu verifizieren das 2FA funktioniert",
|
||||||
|
@ -151,7 +148,6 @@ export default {
|
||||||
Inactive: "Inaktiv",
|
Inactive: "Inaktiv",
|
||||||
Token: "Token",
|
Token: "Token",
|
||||||
"Show URI": "URI Anzeigen",
|
"Show URI": "URI Anzeigen",
|
||||||
"Clear all statistics": "Lösche alle Statistiken",
|
|
||||||
Tags: "Tags",
|
Tags: "Tags",
|
||||||
"Add New below or Select...": "Füge neuen hinzu oder wähle aus...",
|
"Add New below or Select...": "Füge neuen hinzu oder wähle aus...",
|
||||||
"Tag with this name already exist.": "Ein Tag mit dem Namen existiert bereits.",
|
"Tag with this name already exist.": "Ein Tag mit dem Namen existiert bereits.",
|
||||||
|
@ -167,4 +163,8 @@ export default {
|
||||||
Purple: "Lila",
|
Purple: "Lila",
|
||||||
Pink: "Pink",
|
Pink: "Pink",
|
||||||
"Search...": "Suchen...",
|
"Search...": "Suchen...",
|
||||||
|
"Heartbeat Retry Interval": "Takt-Wiederholungsintervall",
|
||||||
|
retryCheckEverySecond: "Versuche alle {0} Sekunden",
|
||||||
|
"Import Backup": "Import Backup",
|
||||||
|
"Export Backup": "Export Backup",
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,8 +139,8 @@ export default {
|
||||||
alertWrongFileType: "Please select a JSON file.",
|
alertWrongFileType: "Please select a JSON file.",
|
||||||
"Clear all statistics": "Clear all Statistics",
|
"Clear all statistics": "Clear all Statistics",
|
||||||
"Skip existing": "Skip existing",
|
"Skip existing": "Skip existing",
|
||||||
"Overwrite": "Overwrite",
|
Overwrite: "Overwrite",
|
||||||
"Options": "Options",
|
Options: "Options",
|
||||||
"Keep both": "Keep both",
|
"Keep both": "Keep both",
|
||||||
"Verify Token": "Verify Token",
|
"Verify Token": "Verify Token",
|
||||||
"Setup 2FA": "Setup 2FA",
|
"Setup 2FA": "Setup 2FA",
|
||||||
|
@ -152,7 +152,6 @@ export default {
|
||||||
Inactive: "Inactive",
|
Inactive: "Inactive",
|
||||||
Token: "Token",
|
Token: "Token",
|
||||||
"Show URI": "Show URI",
|
"Show URI": "Show URI",
|
||||||
"Clear all statistics": "Clear all Statistics",
|
|
||||||
Tags: "Tags",
|
Tags: "Tags",
|
||||||
"Add New below or Select...": "Add New below or Select...",
|
"Add New below or Select...": "Add New below or Select...",
|
||||||
"Tag with this name already exist.": "Tag with this name already exist.",
|
"Tag with this name already exist.": "Tag with this name already exist.",
|
||||||
|
|
|
@ -115,7 +115,6 @@ export default {
|
||||||
"Last Result": "Ultimo risultato",
|
"Last Result": "Ultimo risultato",
|
||||||
"Create your admin account": "Crea l'account amministratore",
|
"Create your admin account": "Crea l'account amministratore",
|
||||||
"Repeat Password": "Ripeti Password",
|
"Repeat Password": "Ripeti Password",
|
||||||
"Import/Export Backup": "Importa/Esporta Backup",
|
|
||||||
Export: "Esporta",
|
Export: "Esporta",
|
||||||
Import: "Importa",
|
Import: "Importa",
|
||||||
respTime: "Tempo di Risposta (ms)",
|
respTime: "Tempo di Risposta (ms)",
|
||||||
|
|
|
@ -115,7 +115,6 @@ export default {
|
||||||
"Last Result": "Laatste resultaat",
|
"Last Result": "Laatste resultaat",
|
||||||
"Create your admin account": "Maak uw beheerdersaccount aan",
|
"Create your admin account": "Maak uw beheerdersaccount aan",
|
||||||
"Repeat Password": "Herhaal wachtwoord",
|
"Repeat Password": "Herhaal wachtwoord",
|
||||||
"Import/Export Backup": "Backup importeren/exporteren",
|
|
||||||
Export: "Exporteren",
|
Export: "Exporteren",
|
||||||
Import: "Importeren",
|
Import: "Importeren",
|
||||||
respTime: "resp. tijd (ms)",
|
respTime: "resp. tijd (ms)",
|
||||||
|
|
|
@ -116,5 +116,5 @@ export default {
|
||||||
"Clear Data": "Verileri Temizle",
|
"Clear Data": "Verileri Temizle",
|
||||||
Events: "Olaylar",
|
Events: "Olaylar",
|
||||||
Heartbeats: "Sağlık Durumları",
|
Heartbeats: "Sağlık Durumları",
|
||||||
"Auto Get": "Otomatik Al"
|
"Auto Get": "Otomatik Al",
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,6 @@ export default {
|
||||||
enableDefaultNotificationDescription: "新的监控项将默认启用,你也可以在每个监控项中分别设置",
|
enableDefaultNotificationDescription: "新的监控项将默认启用,你也可以在每个监控项中分别设置",
|
||||||
"Default enabled": "默认开启",
|
"Default enabled": "默认开启",
|
||||||
"Also apply to existing monitors": "应用到所有监控项",
|
"Also apply to existing monitors": "应用到所有监控项",
|
||||||
"Import/Export Backup": "导入/导出备份",
|
|
||||||
Export: "导出",
|
Export: "导出",
|
||||||
Import: "导入",
|
Import: "导入",
|
||||||
backupDescription: "你可以将所有的监控项和消息通知备份到一个 JSON 文件中",
|
backupDescription: "你可以将所有的监控项和消息通知备份到一个 JSON 文件中",
|
||||||
|
|
|
@ -120,7 +120,6 @@ export default {
|
||||||
enableDefaultNotificationDescription: "新增監測器時這個通知會預設啟用,當然每個監測器亦可分別控制開關。",
|
enableDefaultNotificationDescription: "新增監測器時這個通知會預設啟用,當然每個監測器亦可分別控制開關。",
|
||||||
"Default enabled": "預設通知",
|
"Default enabled": "預設通知",
|
||||||
"Also apply to existing monitors": "同時取用至目前所有監測器",
|
"Also apply to existing monitors": "同時取用至目前所有監測器",
|
||||||
"Import/Export Backup": "匯入/匯出 備份",
|
|
||||||
Export: "匯出",
|
Export: "匯出",
|
||||||
Import: "匯入",
|
Import: "匯入",
|
||||||
backupDescription: "您可以備份所有監測器及所有通知。",
|
backupDescription: "您可以備份所有監測器及所有通知。",
|
||||||
|
|
Loading…
Reference in a new issue