Repository navigation
i18n: translate effect parameter names - #2280
linzhang779-maker wants to merge 2 commits into
Conversation
Every parameter inside an effect drew the stored English name, so adding almost any effect turned a Chinese interface back into English: Bluriness, Threshold, Radius, Amount, Hue, Saturation, Turbulence, Whirl Center, Vibrance. A new catalog, `i18n::props`, holds these names - 426 of them, Simplified and Traditional in step - and Effect Controls asks it for the three places it draws one: the parameter row, the label of an inline boolean, and the "Click in the Composition panel to set ..." hint of the colour and position pickers. It is a separate catalog rather than more rows in `ui.rs` because a property name is not in a panel's source: it arrives at runtime, from the project, so `every_row_is_used_by_a_converted_panel` cannot see it and a row for it would read as an orphan. Nouns also repeat under different parents - `rotation` is `Rotation`, `Z Rotation`, `Environment Rotation` and `Segments: Rotation` - so rows are keyed by the stored name, as `effects.rs` is keyed by effect id. What is stored does not change: the project keeps `match_id`, expressions and scripts keep addressing properties in English, and automation ids keep their English keys. Only what is drawn is looked up, as in After Effects' own Chinese build.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Catalogs and name lookup crates/ui-egui/src/i18n.rs, crates/ui-egui/src/i18n/props.rs |
Adds lookup logic for Simplified and Traditional Chinese property names. Other languages and catalog entries without a translation fall back to the stored English name. Tests check catalog keys and entries. |
Effect control labels crates/ui-egui/src/panels/effect_controls.rs |
Uses localized names in property rows, Boolean parameter labels, and viewer-pick status messages. Stored parameter names remain unchanged. |
Priority:
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Feature
Possibly related PRs
- storytold/effectcraft#2281: Uses the property-name catalog for additional UI labels and adds localized search based on the same stored-English-name lookup contract.
Merge Risk: 
Minimal · up to 6050e
-
No actionable merge-blocking risk is established for the translated effect-control labels; merge after normal checks.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title "i18n: translate effect parameter names" matches the main change. The PR adds Simplified and Traditional Chinese translations for stored property names and wires them into Effect Controls parameter rows, status messages, and Boolean labels via
crate::i18n::props::name. The title is specific and short. It omits the Timeline work, which the PR defers to a follow-up, but that omission is expected for a title.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Hi @linzhang779-maker, thanks for this PR! Most of the conflict comes from the shared module layout (#2491), which moved or split files this PR touches:
When you rebase, please also make sure it fits the other recent changes:
CI ( |
eliets2
left a comment
There was a problem hiding this comment.
First-pass review notes (automated; combined from specialist angles: tests, performance, user experience, docs and text). Please treat as suggestions and verify before acting.
What this does: This adds a new Chinese catalog of 426 effect and layer property names in crates/ui-egui/src/i18n/props.rs and wires it into Effect Controls so parameter rows, inline boolean labels, and colour/position picker hints display Simplified or Traditional Chinese instead of the stored English name, while stored names, project files, expressions, and automation ids remain in English.
Logical units:
- New
props.rscatalog with Simplified and Traditional tables, aname()lookup with English fallback, and self-tests - Wiring in
panels/effect_controls.rsforprop_row, the inline boolean label, and thetoggle_pickstatus hint
Findings:
- [performance]
crates/ui-egui/src/i18n/props.rs,name(), called fromprop_rowincrates/ui-egui/src/panels/effect_controls.rson every parameter row on every frame: it returnsStringand allocates viaenglish.to_string()even for English or untranslated names, where the previous code borrowed&prop.name. ReturnCow<'_, str>instead, borrowing the&'static strtranslation on a hit and the inputenglishon a miss. - [user experience]
crates/ui-egui/src/panels/effect_controls.rs,prop_row: the visual label is translated butapp.auto.add(..., &prop.name)for the name and inline boolean value still passes English, so automation/screen-reader labels do not match what is drawn. Pass the translated name as the label while keeping the stored English name only in the id. - [user experience]
crates/ui-egui/src/panels/effect_controls.rs,toggle_pick: the status message keeps the English sentence template and only inserts the translated name, producing a mixed-language string in a Chinese UI. Localize the whole sentence, or keep the English name in the English sentence until the sentence is translated. - [user experience]
crates/ui-egui/src/i18n/props.rs,SIMPLIFIED_CHINESE/TRADITIONAL_CHINESE: distinct parameters collapse to identical labels, e.g.Color/Colors,Channel/Channels,Point/Points,Scale/Scaling,Smooth/Smoothing,Spread/Spreading,Shadows/Shadowing,Look/Looks,Dash/Dashes,Tint/Tones, so users cannot distinguish them. Give each distinct English name a distinct translation. - [tests]
crates/ui-egui/src/i18n/props.rs,name(): no test exercises the public lookup; tests only callcatalog()for two languages, so a brokenname()returning English for a known property or not falling back for an unknown one would pass. Add tests for a known name, an unknown name, and English, extracting a purename_for(language, english)helper so the test does not depend on the globalcurrent()locale. - [tests]
crates/ui-egui/src/i18n/props.rs,the_chinese_catalogs_agree: it only compares English keys, so copying the Simplified translations into the Traditional table would pass. Add a spot-check that known differing rows differ, e.g.RotationorAnchor Point, in the two tables. - [tests] [docs]
crates/ui-egui/src/i18n/props.rs,english_and_untranslated_languages_fall_back: despite its name and the PR description claiming untranslated languages fall back, it never tests an untranslated language orzh-hant, only assertingcatalog("en")isNoneandcatalog("zh-hans")isSome. Add assertions such ascatalog("fr").is_none(),catalog("zh-hant").is_some(), and an empty/unknown code to cover the_ => Nonearm, or rename the test to match what it checks. - [docs]
crates/ui-egui/src/i18n/props.rs, module docs: states the Timeline, Effect Controls and pickers all draw through this catalog, but this diff only wires Effect Controls and Timeline wiring is deferred. State only Effect Controls uses it now and note Timeline as pending. - [docs]
crates/ui-egui/src/i18n/props.rs,catalog()doc comment: says adding a language is "one table and one arm, and no panel changes" but gives no steps for keeping tables in sync, ordering, or which table is the source; the Traditional table notes OpenCC conversion, the Simplified table does not. Document that Simplified is the source, Traditional is converted from it, rows must be added to both in the same order, and the agreement test must be extended for a new language. - [docs]
crates/ui-egui/src/i18n/props.rs, module docs on repeats: "A repeat (Ellipse Path 1) is translated whole: the index belongs to the instance, not to the property, so it is carried across unchanged" is contradictory as written. Clarify that the trailing number is kept unchanged in the translation and that new numbered variants need their own rows.
Overlaps: PR #2253 also touches timeline.rs; Timeline wiring for these property names is deferred to a follow-up to keep the two PRs mergeable.
Verdict: needs changes. The 3 most important points are: (1) remove the per-row, per-frame allocation in name() by returning Cow<'_, str>; (2) fix the UX mismatches in prop_row automation labels and the mixed-language toggle_pick message, and the collapsed distinct labels; (3) add tests exercising name() itself, the untranslated-language fallback, and differing Simplified/Traditional rows.
What this does
Effect parameters read in Chinese. Every slider, angle, colour and drop-down inside an effect —
Bluriness, Threshold, Radius, Amount, Hue, Saturation, Turbulence, Whirl Center, Vibrance — was
drawn straight from the effect's stored English name, so a translated interface still showed
English the moment you added an effect.
How
A new catalog,
crates/ui-egui/src/i18n/props.rs, holds 426 names (Simplified and Traditional, instep).
panels/effect_controls.rsasks it for the three places it draws a parameter: theparameter row, the label of an inline boolean, and the "Click in the Composition panel to set …"
hint of the colour/position pickers.
Why its own catalog and not
ui.rsTwo reasons, one mechanical and one conceptual.
every_row_is_used_by_a_converted_panelasks whether the English string appears in the source ofa
CONVERTEDpanel. A property name does not: it arrives at runtime, from the project. A rowfor it would be an orphan by that test's rules.
RotationisRotation,Z Rotation,Environment RotationandSegments: Rotationunder differentparents.
ui.rsis keyed by the sentence around a string; this one is keyed by the stored name,the same way
effects.rsis keyed by effect id.props.rstherefore followseffects.rs: one table per language, one lookup, four self-tests(rows unique, translations non-empty, the two Chinese catalogs agree, English and untranslated
languages fall through).
What stays English
Everything that is not drawn. The project file keeps
match_id; expressions and scripts keepaddressing properties in English; automation ids keep their English keys. After Effects' own
Chinese build behaves the same way — it shows 位置 and writes
position.The rows also cover the layer and composition property names (Anchor Point, Position, Scale,
Rotation, Opacity, …) that the Timeline draws. Wiring the Timeline is left to a follow-up PR:
#2253 touches
timeline.rsas well, and keeping the two apart keeps both mergeable.Tests
cargo clippy --workspace --all-targets --release -- -D warningsis clean and theui-eguilibtests pass. Two tests in that crate fail before and after this change, both because they assert
English while the machine runs a Chinese locale:
native_menu::tests::every_engine_entry_is_in_the_native_menucompares the built menu againstthe catalog, and the catalog is Chinese here;
panels::templates::tests::my_custom_rgb_dialogassertsitem.label == "My Custom RGB…".Neither assertion is weakened by this PR.
Summary by CodeRabbit