mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-22 11:42:57 -05:00
The menu bar has had a catalog since #229 (keyed by `(command, English label)`); everything below it - panel labels, buttons, field names, tooltips, the sentences a panel draws itself - was written straight into the code and stayed English in every language (#333). This adds `crates/ui-egui/src/i18n/ui.rs`: - Rows are keyed by the English source string, so a panel wraps a literal it already has instead of inventing an id, and a row that is missing falls back to English rather than to an empty label. - `tr("Rename")` translates a plain string; `tr_args("Proxy Use: {}", &[&quality])` fills the values of a row that carries them. `tr_args` writes into its own buffer, so it cannot panic on a mismatch, and a test keeps every row's placeholder count equal to its English source. - The language in force is set once per frame from the resolved interface language - the same value the CJK fonts are installed for - and kept in a thread-local, so the panels do not have to thread it through every function. The render threads never draw interface text. - Simplified and Traditional Chinese are complete (384 strings); the Japanese rows are still open, and the catalog takes them without any other change. Tests: the two Chinese catalogs must list the same source strings, no empty or duplicated rows, every row must be asked for by a converted panel, and a converted panel that gains a hard-coded string in a common call shape fails the build.