Feat: add new languages

This commit is contained in:
Unitwk 2024-05-06 16:05:40 +08:00
parent 4a255c5d39
commit 61a00a1fd9
10 changed files with 33 additions and 10 deletions

View File

@ -81,17 +81,37 @@ const menus = [
// DO NOT I18N
const allLanguages = [
{
label: `English`,
value: "en_us"
},
{
label: `简体中文`,
value: "zh_cn"
},
{
label: "English",
value: "en_us"
label: `繁體中文`,
value: "zh_tw"
},
{
label: "繁體中文",
value: "zh_tw"
label: `Français`,
value: "fr_FR"
},
{
label: `Русский`,
value: "ru_RU"
},
{
label: `Español`,
value: "es_ES"
},
{
label: `日本語`,
value: "jp_JP"
},
{
label: `한국어`,
value: "ko_KR"
}
];

View File

@ -2,7 +2,7 @@ const fs = require("fs");
const { crc32 } = require("crc");
const FN_KEY = "TXT_CODE_";
const LANGUAGES = ["zh_CN", "en_US", "zh_TW"];
const LANGUAGES = ["zh_CN", "en_US"];
module.exports = {
input: ["./**/*.{ts,vue}", "!**/node_modules/**"],

View File

@ -1893,5 +1893,6 @@
"TXT_CODE_94f1ba3": "After selecting this template, all data of this instance will be deleted. Please compress and download the file backup in file management first. Do you want to continue?",
"TXT_CODE_a5f01916": "Allow Instance Reset",
"TXT_CODE_b5a47731": "The administrator has restricted general users from using the instance reinstallation function.",
"TXT_CODE_f5f9664": "This feature allows general users to use the default packages in \"Quick Deployment\" to reinstall instances."
"TXT_CODE_f5f9664": "This feature allows general users to use the default packages in \"Quick Deployment\" to reinstall instances.",
"TXT_CODE_e29a9317": "Programming language changed"
}

0
languages/fr_FR.json Normal file
View File

0
languages/jp_JP.json Normal file
View File

0
languages/ko_KR.json Normal file
View File

0
languages/ru_RU.json Normal file
View File

View File

@ -1893,5 +1893,6 @@
"TXT_CODE_94f1ba3": "选择此模板后,该实例的所有数据将会被删除,请先在文件管理中压缩并下载文件备份,是否继续?",
"TXT_CODE_a5f01916": "准许普通用户使用实例模板功能",
"TXT_CODE_f5f9664": "该功能允许普通用户使用“快速部署”里面的预设包来进行重装实例。",
"TXT_CODE_b5a47731": "管理员已限制普通用户使用实例重装功能"
"TXT_CODE_b5a47731": "管理员已限制普通用户使用实例重装功能",
"TXT_CODE_e29a9317": "程序语言已变更"
}

View File

@ -1892,5 +1892,6 @@
"TXT_CODE_94f1ba3": "選擇此範本後,該實例的所有資料將會被刪除,請先在檔案管理中壓縮並下載檔案備份,是否繼續?",
"TXT_CODE_a5f01916": "準許一般使用者使用實例範本功能",
"TXT_CODE_f5f9664": "此功能允許一般使用者使用「快速部署」裡面的預設套件來進行重裝實例。",
"TXT_CODE_b5a47731": "管理員已限制一般使用者使用實例重裝功能"
"TXT_CODE_b5a47731": "管理員已限制一般使用者使用實例重裝功能",
"TXT_CODE_e29a9317": "程式語言已變更"
}

View File

@ -49,7 +49,7 @@ router.put("/setting", validator({ body: {} }), permission({ level: ROLE.ADMIN }
if (config.allowUsePreset != null) systemConfig.allowUsePreset = Boolean(config.allowUsePreset);
if (config.presetPackAddr != null) systemConfig.presetPackAddr = String(config.presetPackAddr);
if (config.language != null) {
logger.warn("Language change:", config.language);
logger.warn($t("TXT_CODE_e29a9317"), config.language);
systemConfig.language = String(config.language);
await i18next.changeLanguage(systemConfig.language.toLowerCase());
remoteService.changeDaemonLanguage(systemConfig.language);
@ -67,7 +67,7 @@ router.put("/install", async (ctx) => {
const config = ctx.request.body;
if (userSystem.objects.size === 0 && systemConfig) {
if (config.language != null) {
logger.warn("Language change:", config.language);
logger.warn($t("TXT_CODE_e29a9317"), config.language);
systemConfig.language = String(config.language);
i18next.changeLanguage(systemConfig.language.toLowerCase());
remoteService.changeDaemonLanguage(systemConfig.language);