Skip to content

refactor(native): vendor web and desktop i18n catalogs for standalone builds - #471

Merged
rynfar merged 1 commit into
nativefrom
nw/h5-standalone-i18n
Nov 20, 2026
Merged

rynfar merged 1 commit into
nativefrom
nw/h5-standalone-i18n

Conversation

@rynfar

@rynfar rynfar commented Nov 20, 2026

Copy link
Copy Markdown
Owner

apps/native/crates/core/src/i18n/mod.rs previously embedded web and desktop translation catalogs with include_str!("../../../../../{web,desktop}/src/i18n/translations/*.json"), breaking standalone apps/native compilation whenever the parent monorepo directories are absent.

Changes

  • Vendored all 10 web and 10 desktop locale JSON catalogs (en, de, es, fr, ja, ko, pt-BR, ru, sv, zh) under apps/native/crates/core/src/i18n/translations/{web,desktop}/.
  • Switched RAW_EN_BUNDLE, NON_DEFAULT_BUNDLES, RAW_DESKTOP_EN_BUNDLE, and NON_DEFAULT_DESKTOP_BUNDLES in apps/native/crates/core/src/i18n/mod.rs to local include_str!("translations/{web,desktop}/...") paths so t3-core has zero escaping include_str!/include_bytes! paths.
  • Updated embedded_translation_catalogs_match_web_json_exactly and embedded_desktop_catalogs_match_desktop_json_exactly to always validate the vendored catalogs and lookup coverage, while enforcing byte-for-byte parity against apps/{web,desktop}/src/i18n/translations/*.json whenever the monorepo directories are present and succeeding cleanly in standalone apps/native checkouts.
  • Added executable POSIX sh script apps/native/scripts/sync-i18n.sh (default copies all 20 catalogs from apps/{web,desktop}; --check verifies byte equality via cmp -s in monorepo checkouts and presence/non-emptiness in standalone checkouts, exiting non-zero on drift).

Verification

  • sh apps/native/scripts/sync-i18n.sh --check — pass (20 files checked), plus tested standalone --check, standalone sync error, and drift detection.
  • CARGO_INCREMENTAL=0 cargo clippy --manifest-path apps/native/Cargo.toml --workspace --all-targets -- -D warnings — pass (0 warnings).
  • T3_NATIVE_HOME=$(mktemp -d) CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-core --lib — 1894 passed, 0 failed.
  • Standalone t3-core i18n::tests build & run in an isolated temp copy without parent monorepo dirs — 9 passed, 0 failed.
  • Audited include_str!/include_bytes! across apps/native/crates/core: 0 escaping paths. (Note: apps/native/crates/app/src/snapshot_capture/macos.rs and apps/native/crates/app/src/updates/mod.rs still have unrelated parent-relative includes outside this PR's scope.)

Generated with Antigravity (h5-standalone-i18n).

@rynfar
rynfar merged commit 824e2f2 into native Nov 20, 2026
2 checks passed
@rynfar
rynfar deleted the nw/h5-standalone-i18n branch November 20, 2026 17:49
@rynfar rynfar mentioned this pull request Nov 20, 2026
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