From c273f1823ab71debfaa291c93230ebe3312fb08e Mon Sep 17 00:00:00 2001 From: KOWX712 Date: Fri, 28 Mar 2025 19:07:08 +0800 Subject: [PATCH] feat: add default option in language menu --- module/webui/locales/A-template.json | 1 + module/webui/locales/en-US.json | 1 + module/webui/locales/es-ES.json | 1 + module/webui/locales/id-ID.json | 1 + module/webui/locales/it-IT.json | 1 + module/webui/locales/ja-JP.json | 1 + module/webui/locales/pl-PL.json | 1 + module/webui/locales/ru-RU.json | 1 + module/webui/locales/tl-PH.json | 3 ++- module/webui/locales/tr-TR.json | 1 + module/webui/locales/zh-CN.json | 1 + module/webui/locales/zh-TW.json | 1 + module/webui/scripts/language.js | 8 ++++++++ 13 files changed, 21 insertions(+), 1 deletion(-) diff --git a/module/webui/locales/A-template.json b/module/webui/locales/A-template.json index af20de4..eb7a145 100644 --- a/module/webui/locales/A-template.json +++ b/module/webui/locales/A-template.json @@ -1,5 +1,6 @@ { "language": "English", + "system_default": "System Default", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/en-US.json b/module/webui/locales/en-US.json index af20de4..eb7a145 100644 --- a/module/webui/locales/en-US.json +++ b/module/webui/locales/en-US.json @@ -1,5 +1,6 @@ { "language": "English", + "system_default": "System Default", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/es-ES.json b/module/webui/locales/es-ES.json index fe4b9d3..8797786 100644 --- a/module/webui/locales/es-ES.json +++ b/module/webui/locales/es-ES.json @@ -1,5 +1,6 @@ { "language": "Español", + "system_default": "Predeterminado del sistema", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/id-ID.json b/module/webui/locales/id-ID.json index ca983d4..f568529 100644 --- a/module/webui/locales/id-ID.json +++ b/module/webui/locales/id-ID.json @@ -1,5 +1,6 @@ { "language": "Bahasa Indonesia", + "system_default": "Default Sistem", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/it-IT.json b/module/webui/locales/it-IT.json index 8415c5d..0364993 100644 --- a/module/webui/locales/it-IT.json +++ b/module/webui/locales/it-IT.json @@ -1,5 +1,6 @@ { "language": "Italiano", + "system_default": "Predefinito di sistema", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/ja-JP.json b/module/webui/locales/ja-JP.json index 1adea55..70ee039 100644 --- a/module/webui/locales/ja-JP.json +++ b/module/webui/locales/ja-JP.json @@ -1,5 +1,6 @@ { "language": "日本語", + "system_default": "システムデフォルト", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/pl-PL.json b/module/webui/locales/pl-PL.json index 4221d56..1ecd7ad 100644 --- a/module/webui/locales/pl-PL.json +++ b/module/webui/locales/pl-PL.json @@ -1,5 +1,6 @@ { "language": "Polski", + "system_default": "Domyślne systemowe", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/ru-RU.json b/module/webui/locales/ru-RU.json index c21160b..25c68df 100644 --- a/module/webui/locales/ru-RU.json +++ b/module/webui/locales/ru-RU.json @@ -1,5 +1,6 @@ { "language": "Русский", + "system_default": "Системный по умолчанию", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/tl-PH.json b/module/webui/locales/tl-PH.json index d449322..2b2bdf3 100644 --- a/module/webui/locales/tl-PH.json +++ b/module/webui/locales/tl-PH.json @@ -1,5 +1,6 @@ { - "language": "Tagalog", + "language": "Filipino", + "system_default": "Default ng Sistema", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/tr-TR.json b/module/webui/locales/tr-TR.json index 0226f89..b66c293 100644 --- a/module/webui/locales/tr-TR.json +++ b/module/webui/locales/tr-TR.json @@ -1,5 +1,6 @@ { "language": "Türkçe", + "system_default": "Sistem Varsayılanı", "header": { "title": "Tricky Addon" }, diff --git a/module/webui/locales/zh-CN.json b/module/webui/locales/zh-CN.json index 3d6fb5b..3ab7b4a 100644 --- a/module/webui/locales/zh-CN.json +++ b/module/webui/locales/zh-CN.json @@ -1,5 +1,6 @@ { "language": "简体中文", + "system_default": "系统默认", "header": { "title": "TS 插件" }, diff --git a/module/webui/locales/zh-TW.json b/module/webui/locales/zh-TW.json index ed8691d..3e6c1f8 100644 --- a/module/webui/locales/zh-TW.json +++ b/module/webui/locales/zh-TW.json @@ -1,5 +1,6 @@ { "language": "繁體中文", + "system_default": "系統預設", "header": { "title": "TS 插件" }, diff --git a/module/webui/scripts/language.js b/module/webui/scripts/language.js index 49a7402..813095c 100644 --- a/module/webui/scripts/language.js +++ b/module/webui/scripts/language.js @@ -125,6 +125,14 @@ export function setupLanguageMenu() { */ async function generateLanguageMenu() { languageMenu.innerHTML = ''; + + // Add System Default option + const defaultButton = document.createElement('button'); + defaultButton.classList.add('language-option', 'ripple-element'); + defaultButton.setAttribute('data-lang', 'default'); + defaultButton.setAttribute('data-i18n', 'system_default'); + languageMenu.appendChild(defaultButton); + const languagePromises = availableLanguages.map(async (lang) => { try { const response = await fetch(`locales/${lang}.json`);