Skip to content

Add Chinese/English language switch in settings#62

Open
Dai666-me wants to merge 2 commits intotwoone-3:mainfrom
Dai666-me:main
Open

Add Chinese/English language switch in settings#62
Dai666-me wants to merge 2 commits intotwoone-3:mainfrom
Dai666-me:main

Conversation

@Dai666-me
Copy link
Copy Markdown

What does this PR do?

Adds a language switcher in the Settings page, supporting Chinese (Simplified) and English.
All UI texts (including status, buttons, settings labels, help modal, footer, etc.) can be toggled between the two languages without reloading the page. The selected language is saved in localStorage and persists after refresh.

Key changes

  • New feature: Language toggle with two buttons (中文 / English) placed in Settings page.
  • i18n data: Embedded inside app.js (no extra HTTP request) for faster loading.
  • Dynamic translation: Uses data-i18n attributes in HTML; JS function applyLanguage() updates all texts on switch.
  • Preserved original behavior: All existing functionality (start/stop, settings save, stats, logs, etc.) unchanged.

Files modified

  • index.html: Added language switch UI, added data-i18n to all translatable elements.
  • app.js: Added langData object and applyLanguage(); modified checkStatus(), controlAdGuard(), saveSettings(), loadLog(), collectDebugInfo() to use translated strings; added language switching event binding.

Testing performed

  • Tested on real device with KernelSU WebUI.
  • Switching between Chinese and English updates every UI element correctly.
  • After refresh, language choice is remembered.
  • No regression on module control (start/stop/restart) or statistics fetching.

Additional notes

  • This PR does not modify style.css or any existing logic structure.
  • Translation keys are minimal (only what appears on screen). Future language additions can be done by extending langData.

Screenshots

Screenshot_2026-04-21-20-58-09-45_676e4cb4cfb833a96b248618a803cf16 Screenshot_2026-04-21-20-58-12-09_676e4cb4cfb833a96b248618a803cf16 Screenshot_2026-04-21-20-58-15-69_676e4cb4cfb833a96b248618a803cf16 Screenshot_2026-04-21-20-58-18-25_676e4cb4cfb833a96b248618a803cf16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant