Skip to content

Refresh shared UI i18n handling#32

Open
52sanmao wants to merge 5 commits into
vrtmrz:mainfrom
52sanmao:i18n-runtime-refresh
Open

Refresh shared UI i18n handling#32
52sanmao wants to merge 5 commits into
vrtmrz:mainfrom
52sanmao:i18n-runtime-refresh

Conversation

@52sanmao

@52sanmao 52sanmao commented May 9, 2026

Copy link
Copy Markdown
Contributor

Background

This is the companion shared UI i18n change for vrtmrz/obsidian-livesync#878.

The parent PR uses shared setup UI components with i18n message keys. Those components also need to remain safe for existing callers that pass literal or dynamic strings.

Purpose

  • Let shared UI controls translate known message keys automatically.
  • Avoid false missing-translation noise when a prop is plain text rather than an i18n key.
  • Complete and refresh the shared translation resources used by the parent runtime-language update.
  • Keep shared setup components usable from both translated and non-translated call sites.

Changed Files

  • src/UI/components/**

    • Routes label-like props through translateIfAvailable().
    • This keeps component callers simple: they can pass message keys when available, while plain strings still render as-is.
  • src/common/i18n.ts

    • Provides the safe translation helper used by shared components.
    • The helper exists so components do not need to decide whether a string is always a key.
  • src/common/messagesYAML/**

    • Adds or updates shared UI translation entries used by the setup/settings i18n flow.
  • src/common/messages/** and src/common/messagesJson/**

    • Refreshes generated message output from the updated translation source files.
    • Keeps the generated resources aligned with the supported runtime languages.

Verification

Verified through the parent obsidian-livesync build using this submodule commit:

  • npm run tsc-check
  • npm run svelte-check
  • npm run build
  • git diff --check
  • git -C src/lib diff --check

Compatibility / Notes

52sanmao and others added 4 commits May 10, 2026 00:25
- Add Ui.SetupWizard.Fetch.*, Rebuild.*, Bucket.*, CouchDB.*, P2P.*, CouchDBCheck.* keys to en.yaml
- Add Setup.ScanQRCode.*, UseSetupURI.*, RemoteE2EE.*, Bucket.*, CouchDB.*, P2P.* keys to en.yaml
- Regenerate all language JSON files from YAML sources
- Bake combinedMessages.prod.ts from dev sources
- Update Guidance.svelte and Instruction.svelte with message prop auto-translation
- Add all missing $msg() keys referenced by TS settings panes
- Add better English values for common labels (Back, Delete, Configure, etc.)
- All 841 en.json keys now cover all $msg() calls in codebase
- zh: +93 keys
- ja: +96 keys
- ko: +133 keys
- es: +238 keys
- ru: +93 keys
- de: +670 keys
- zh-tw: +670 keys

All 841 keys now present in every language file.
Non-translated keys use English as placeholder.
@vrtmrz

vrtmrz commented May 11, 2026

Copy link
Copy Markdown
Owner

Thank you for your PR!
I have merged the other PRs one by one, but I am afraid this PR has resulted in quite a few differences.
I would have merged it myself if it were any other file, but unfortunately, I am not very good at Chinese, so may I ask you to compare it with the latest main branch and resolve it using the correct version, please?

@vrtmrz

vrtmrz commented Jun 9, 2026

Copy link
Copy Markdown
Owner

@52sanmao Sorry for not getting in touch.

As I had made a significant diff, I have made some adjustments to align your PR with the Main branch.

I am not entirely sure if I have managed to preserve the content of your PR, so would you please check it for me? If it looks OK, I will l merge it!

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.

2 participants