Replace UI text with Chinese (zh) translation#5671
Conversation
已翻译文件: - 404.htm, dmxmap.htm, edit.htm, index.htm - liveview.htm, liveviewws2D.htm, msg.htm - settings.htm, settings_2D.htm, settings_dmx.htm - settings_leds.htm, settings_pin.htm, settings_pininfo.htm - settings_sec.htm, settings_sync.htm, settings_time.htm - settings_ui.htm, settings_um.htm, settings_wifi.htm - update.htm, usermod.htm, welcome.htm 翻译内容:标题、按钮、标签、提示文字、错误信息 保持不变:HTML结构、JS代码、CSS、变量名、URL
WalkthroughAll web UI files under wled00/data/ were localized from English to Chinese: each page’s root ChangesComplete Web UI Chinese Localization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
wled00/data/settings_leds.htm (1)
2-2:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate document language metadata to Chinese.
Line 2 is still
lang="en"while the page content is localized to Chinese; switch tolang="zh"to keep accessibility and language detection correct.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wled00/data/settings_leds.htm` at line 2, The page's HTML root element still declares lang="en" while the content is Chinese; update the <html> element in settings_leds.htm from lang="en" to lang="zh" (or a more specific variant like lang="zh-CN" if appropriate) so language metadata matches the localized content and aids accessibility and language detection.wled00/data/update.htm (1)
99-101:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winLocalize auto-update “firmware not found” status
When no matching asset is found, the status message is still English (
Firmware not found... Available...). This is user-visible in the Chinese workflow and should be translated.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wled00/data/update.htm` around lines 99 - 101, The status message shown when no matching asset is found uses hardcoded English in the assignment to status.textContent (currently using `Firmware not found (*${assetSuffix}). Available: ${available}`); replace that literal with the localized string lookup used elsewhere (e.g., call the project's i18n function or lookup table) and format it with assetSuffix and available, so the message is translated for other locales; ensure you still set btn.disabled = false and keep the `available` and `assetSuffix` variables in the formatted localized message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@wled00/data/settings_dmx.htm`:
- Line 58: The label text contains an English word "Universe" breaking
localization; update the string in the settings_dmx.htm line that renders "代理
Universe <input name=PU ..." (input name=PU) to a fully localized Chinese term
(e.g., "代理 宇宙 <input name=PU ...> 从 E1.31 到 DMX(0=禁用)") so the UI is consistent.
In `@wled00/data/settings_sec.htm`:
- Line 50: The tooltip for the PIN input is in English; update the input element
with id="PIN" (the PIN <input> element) to use a Chinese title string instead of
"Please enter a 4 digit number" so it matches the localized page (e.g. "请输入4位数字"
or similar), keeping the other attributes (type, id, name, size, maxlength,
minlength, onkeydown, pattern, inputmode) unchanged.
- Line 77: Replace the literal English "Upload" button labels with the Chinese
localized text by changing the button text nodes for the buttons that call
uploadFile (the <button ... onclick="uploadFile(...)"> elements) to "上传" (or the
project's Chinese localization token if one exists); update both occurrences
noted (the buttons near the file input for presets and the other at line 79) and
keep the onclick/uploadFile calls and attributes unchanged so functionality is
preserved.
In `@wled00/data/settings_sync.htm`:
- Line 218: The label text containing the English word "presets" should be
localized; locate the HTML snippet containing the input element with name="AP"
and replace the trailing English word "presets" with the Chinese localized term
(e.g., "预设") so the line reads consistently in Chinese and preserves the
existing input markup.
In `@wled00/data/settings_wifi.htm`:
- Line 263: The AP password input element (name="AP", pattern="(.{8,63})|()")
currently uses an English title "Empty or min. 8 characters"; update that title
to the Chinese translation so the validation hint is localized (e.g.
"为空或至少8个字符") while leaving the pattern and maxlength unchanged.
- Around line 126-130: The encryption option labels in the template string
assigned to encryptionTypeField are still in English; update the displayed
option text for option elements (the ones rendered for id/name "ET${i}") to use
localized strings or bilingual wording consistent with the page (e.g., replace
"None/WPA/WPA2" and "WPA/WPA2-Enterprise" with localized equivalents or add the
translated text alongside the English text). Ensure the change updates the
template that builds the select for ET${i} so the selected logic ((type==0) /
(type==1)) remains intact and onchange="E(${i})" continues to work.
In `@wled00/data/update.htm`:
- Around line 136-139: The placeholders "Loading..." and "Checking..." are still
in English; update the HTML in update.htm to use Chinese localized text (e.g.,
"加载中..." for class="sip installed-version" and class="sip release-name", and
"检查中..." for the span with id="Norelease-download") so the UI is consistent;
adjust the content for the span id="release-download" if it contains any English
placeholder text as well and ensure all three referenced elements ("sip
installed-version", "sip release-name", "Norelease-download", and
"release-download") display the Chinese strings.
---
Outside diff comments:
In `@wled00/data/settings_leds.htm`:
- Line 2: The page's HTML root element still declares lang="en" while the
content is Chinese; update the <html> element in settings_leds.htm from
lang="en" to lang="zh" (or a more specific variant like lang="zh-CN" if
appropriate) so language metadata matches the localized content and aids
accessibility and language detection.
In `@wled00/data/update.htm`:
- Around line 99-101: The status message shown when no matching asset is found
uses hardcoded English in the assignment to status.textContent (currently using
`Firmware not found (*${assetSuffix}). Available: ${available}`); replace that
literal with the localized string lookup used elsewhere (e.g., call the
project's i18n function or lookup table) and format it with assetSuffix and
available, so the message is translated for other locales; ensure you still set
btn.disabled = false and keep the `available` and `assetSuffix` variables in the
formatted localized message.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 065507ad-8cc4-4391-974f-e6041ae4e794
📒 Files selected for processing (22)
wled00/data/404.htmwled00/data/dmxmap.htmwled00/data/edit.htmwled00/data/index.htmwled00/data/liveview.htmwled00/data/liveviewws2D.htmwled00/data/msg.htmwled00/data/settings.htmwled00/data/settings_2D.htmwled00/data/settings_dmx.htmwled00/data/settings_leds.htmwled00/data/settings_pin.htmwled00/data/settings_pininfo.htmwled00/data/settings_sec.htmwled00/data/settings_sync.htmwled00/data/settings_time.htmwled00/data/settings_ui.htmwled00/data/settings_um.htmwled00/data/settings_wifi.htmwled00/data/update.htmwled00/data/usermod.htmwled00/data/welcome.htm
| Proxy Universe <input name=PU type=number min=0 max=63999 required> from E1.31 to DMX (0=disabled)<br> | ||
| <i>This will disable the LED data output to DMX configurable below</i><br><br> | ||
| <i>Number of fixtures is taken from LED config page</i><br> | ||
| 代理 Universe <input name=PU type=number min=0 max=63999 required> 从 E1.31 到 DMX(0=禁用)<br> |
There was a problem hiding this comment.
Translate mixed-language label for consistency
Line 58 still contains Universe in English (代理 Universe ...), which breaks the otherwise fully localized UI on this page.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wled00/data/settings_dmx.htm` at line 58, The label text contains an English
word "Universe" breaking localization; update the string in the settings_dmx.htm
line that renders "代理 Universe <input name=PU ..." (input name=PU) to a fully
localized Chinese term (e.g., "代理 宇宙 <input name=PU ...> 从 E1.31 到 DMX(0=禁用)")
so the UI is consistent.
- settings_leds.htm: lang=en → lang=zh - settings_dmx.htm: Universe 补冒号 - settings_sec.htm: PIN 提示、Upload 按钮翻译 - settings_sync.htm: presets → 个预设 - settings_wifi.htm: AP 密码提示、加密类型翻译 - update.htm: Loading/Checking/Firmware not found 翻译
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
thanks, but it is not "add" but "replace with". There is currently no way for multi language support, this has been attempted several times already for other languages but simply replacing everything is not acceptable. You can keep this in your fork though. |
|
Hi @DedeHai, thanks for the feedback. I understand that directly replacing all English text is not acceptable for upstream. I have a question about the multi-language approach: would a build-time locale approach be viable? The idea is:
This avoids the runtime switching problem entirely. The trade-off is that users need to pick their language at build time, but for non-English users this is usually a one-time choice. Is this something the project would accept? If so, I can rework this PR along those lines. If not, could you share what approach (if any) would be acceptable for getting non-English support into upstream? Thanks! |
|
In theory yes but it eludes me on how you want to do that. Like replace the htm files with different versions at compile time? how to maintain that? |
|
Good question. Here is the concrete approach I have in mind: Implementation: PlatformIO pre-build script
Maintenance:
Flash impact:
What the user gets:
Would this approach work for you? If so, I can rework this PR to implement it. The current 22 translated HTML files would be converted into one |
|
@netmindz what do you think of the approach proposed? |
|
You are right to question the approach. After thinking more carefully, here is a better design that avoids touching the original HTML entirely: Core idea: External toolchain using an HTML parser (BeautifulSoup), not regex. The problem with regex-based string replacement is that it is fragile — any HTML structure change breaks it. Instead, we use BeautifulSoup to parse the DOM tree, extract translatable text with its DOM path, and replace precisely by node location. How it works:
Why this is better than regex:
Zero impact on WLED codebase:
WLED contributors do not need to care about translations at all. They edit English HTML as always. The toolchain handles everything externally. Would you accept a PR that adds this toolchain to |
Description
Complete Chinese (Simplified) translation of all 22 WLED Web UI HTML files.
Changes
lang="en"tolang="zh"in all filesTranslated Files (22 total)
Summary by CodeRabbit