Add English/Chinese UI internationalization#5
Open
wendaining wants to merge 24 commits into
Open
Conversation
…chedule, statistics pages
- Add data-i18n attributes to all hardcoded text in index.html (web page headings, buttons, placeholders, labels, import dropdown, schedule controls, statistics panels) - Replace hardcoded English strings with t() calls throughout app.js (pomodoro modal, preview, presets, allowance rows, exceptions, block list cards, dashboard empty states) - Add missing translation keys: websites import/export dropdown, placeholder texts, common.noOptions, statistics.cycleUnit - Ensure modal titles, confirm dialog buttons, and sidebar status text use i18n - Chinese translations updated for all new keys
…detect New users should always see English first. Language can be manually switched to Chinese in Settings. This prevents a jarring experience for international users and ensures consistent default behavior.
…r navigateTo The root cause: _applyToDOM() was called BEFORE navigateTo(). When navigateTo regenerated page content, the new DOM elements kept their English fallback text and were never translated. Fix: - In setLocale: call navigateTo first (generates new DOM), then _applyToDOM (translates the freshly generated static elements) - Remove duplicate ui.navigateTo in the click handler (setLocale already handles navigation) - Use requestAnimationFrame to ensure DOM paint before translation
Close the Tauri get_setting fallback block so locale normalization and translation JSON loading run after a saved ui_language value is read successfully.
Make navigateTo await its page refresh work so setLocale applies translations after dynamic DOM updates finish. Also sync custom dropdown labels after option text is translated.
When the NSIS delete-app-data checkbox is selected, remove the real Windows ProjectDirs paths used by focuser-ui and focuser-service for focuser.db. Tauri's generated cleanup only removes bundle-id based directories, which left block rules and ui_language behind.
Move ProjectDirs cleanup into the NSIS post-uninstall hook and skip it during update mode, so data is only removed after the app files and running-app checks complete.
Document how JSON translation keys map to data-i18n attributes and t() calls, including key structure, placeholders, locale parity, and review checklist for future i18n work.
wendaining
marked this pull request as ready for review
June 8, 2026 14:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a lightweight i18n layer for the Tauri UI and translates the existing interface into English and Simplified Chinese.
Changes include:
i18n.jsfor locale loading, key lookup, parameter interpolation, DOM translation, and persisted language selection.en.jsonandzh.jsontranslation files with matching nested key structures.data-i18n,data-i18n-placeholder,data-i18n-title, anddata-i18n-html.app.jsto uset(...)for user-facing text.ui_languagesetting exists.<option>text changes.I18N.mdwith translation authoring guidelines for future contributors.ProjectDirsdata directory, including savedui_languageand block rules.Notes
The uninstall cleanup fix is included because stale
ui_languageand saved block data made fresh-install i18n validation misleading: after uninstalling with "Delete app data", the app could still reopen with the previous language and rules.Testing
node --check crates/focuser-ui/ui/app.jsnode --check crates/focuser-ui/ui/i18n.jsui_language; verified locale defaults toenanddashboard.titleresolves toDashboard.cargo fmt --all -- --checkcargo clippy --workspace -- -D warningscargo test --workspacecargo tauri build --config '{"bundle":{"createUpdaterArtifacts":false}}'The Tauri build disables updater artifact generation locally because signing requires
TAURI_SIGNING_PRIVATE_KEY.