Translation capability for branch 0_15#4274
Conversation
|
@Sojourneer please clean up you PR - it seems there are lots of copied files and "cached whatever" that look like backups or intermediate files. I'll mark your PR as draft for the time being. |
| @@ -0,0 +1,2 @@ | |||
| cd wled00 | |||
| sudo python3 UISimulator/main.py "$@" No newline at end of file | |||
There was a problem hiding this comment.
sudo should not be needed in a public repository.
There was a problem hiding this comment.
I don't know what that means. For example, is it permissible in documentation in a public repository?
There was a problem hiding this comment.
it means that i don't want to have scripts that use sudo. If possible, change to python3 UISimulator/main.py "$@" .
Running programs with root permissions is only permissible when there is a very good justification.
Where is this document? |
There are no files that are purely generated from something else. |
|
Sorry, I missed your message. I decided a few weeks back to move all the work to a new repository https://github.com/Sojourneer/WLED-Translators-Pack, so all the ugly stuff is elsewhere and it is largely independent of the main repository. The Translator's Pack also includes a proxy server instead of the UI Simulator, in order to get better coverage of the application. The proxy server stuff is new to me and has me tearing my hair out, so the translation stuff has been bumped by other Christmas projects. (Although I have been using it personally). I will get back to this after New Years. |
|
closing due to inactivity - the PR structure (files, scripts, unclear helpers, ...) needs heavy cleanup before it would be acceptable for merging. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (84)
WalkthroughThis PR introduces comprehensive internationalization (i18n) and localization (l12n) infrastructure to WLED, enabling multi-language UI support. It adds translation systems, language files (French, German, Japanese), client-side scripts, Python tooling for translation management, a UI simulator for testing, and updates existing HTML pages to load localization functionality. Changes
Sequence Diagram(s)sequenceDiagram
participant Browser as Browser/DOM
participant L12N as L12N.js
participant localStorage as localStorage
participant Server as WLED Server
participant GH as GitHub Raw
Browser->>L12N: Page load → runI18N()
L12N->>localStorage: Check I18N.langCode
alt Language is 'en'
L12N->>Browser: No translation needed
else Non-English language
L12N->>localStorage: Check I18N.langs.{langCode}
alt Cached translation exists
localStorage-->>L12N: Return cached JSON
L12N->>L12N: applyTranslation()
else Cache miss
L12N->>Server: Fetch /langs/{langCode}.json
alt Server has file
Server-->>L12N: Return translation JSON
else Server miss
L12N->>GH: Fetch from GitHub raw URL
GH-->>L12N: Return translation JSON
end
L12N->>localStorage: Store in I18N.langs.{langCode}
L12N->>L12N: applyTranslation()
end
L12N->>Browser: Walk DOM, apply translations
L12N->>Browser: Update text nodes & attributes (title, placeholder, label, value)
end
note over Browser,L12N: Wrapped global functions (updateUI, genForm, makeSeg, etc.)<br/>trigger re-translation after UI updates
sequenceDiagram
participant User as User/Browser
participant SettingsUI as settings_ui.htm
participant LangSelect as Language Dropdown
participant L12N as L12N.singleton
participant Server as /langcodes.json
User->>SettingsUI: Page loads
SettingsUI->>Server: populateLangCodeSelector()
Server-->>SettingsUI: {lc:"fr",t:"French"}, {lc:"ja",t:"Japanese"}
SettingsUI->>LangSelect: Populate <option> elements
LangSelect->>LangSelect: Mark current I18N.langCode as selected
User->>LangSelect: Select new language
LangSelect->>SettingsUI: OnChangeLangCode(e)
SettingsUI->>L12N: I18N.singleton.setLang(newLangCode)
L12N->>L12N: undoAll() + fetch translation
L12N->>L12N: applyTranslation()
L12N->>User: UI text updates in real-time
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes The PR introduces a substantial, multi-component i18n/l12n system spanning Python tooling, JavaScript client libraries, HTML template modifications across 30+ pages, embedded data resources, and server routes. While many HTML changes follow a repetitive pattern (script injection + onload wrapping), the review requires careful assessment of: (1) the client-side translation logic and function-wrapping mechanisms in Possibly related PRs
Suggested reviewers
✨ Finishing Touches⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |



Translation capability for WLED. Google translated language files provided for JA, FR, DE. Has been tested on an ESP8266.
The coverage is high but not perfect; manual addition of text is required. A more robust solution using a screen scraper on a running WLED instance is probably a better way to go.
From the introduction to the I18N/tools (see wled00/I18N/tools/I18N.md for the details):
WLED Localization
Localization for WLED provides the ability to switch between display languages dynamically from the UI settings page. This setting is local to the browser, and is effective immediately (no Save or page refresh is required).
The rest of this document explains the process for providing this capability.
In summary, the UISimulator Web Server and a couple of python scripts are used to extract, translate, and test the translations on a static simulation of WLED. The translation files are then committed to Github, from which the L12N script included on each HTML page will access and apply the translation.
Summary by CodeRabbit
Release Notes
New Features
Chores