Skip to content

i18n: translate effect parameter names - #2280

Open
linzhang779-maker wants to merge 2 commits into
storytold:mainfrom
linzhang779-maker:props-names
Open

linzhang779-maker wants to merge 2 commits into
storytold:mainfrom
linzhang779-maker:props-names

Conversation

@linzhang779-maker

@linzhang779-maker linzhang779-maker commented Oct 24, 2026 •

Copy link
Copy Markdown

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, in
step). panels/effect_controls.rs asks it for the three places it draws a parameter: the
parameter 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.rs

Two reasons, one mechanical and one conceptual.

  • every_row_is_used_by_a_converted_panel asks whether the English string appears in the source of
    a CONVERTED panel. A property name does not: it arrives at runtime, from the project. A row
    for it would be an orphan by that test's rules.
  • Property names are data nouns, not interface prose, and they are shared — Rotation is
    Rotation, Z Rotation, Environment Rotation and Segments: Rotation under different
    parents. ui.rs is keyed by the sentence around a string; this one is keyed by the stored name,
    the same way effects.rs is keyed by effect id.

props.rs therefore follows effects.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 keep
addressing 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.rs as well, and keeping the two apart keeps both mergeable.

Tests

cargo clippy --workspace --all-targets --release -- -D warnings is clean and the ui-egui lib
tests 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_menu compares the built menu against
    the catalog, and the catalog is Chinese here;
  • panels::templates::tests::my_custom_rgb_dialog asserts item.label == "My Custom RGB…".

Neither assertion is weakened by this PR.

Summary by CodeRabbit

  • New Features
    • Property and parameter names in Effect Controls are now displayed in Simplified or Traditional Chinese when translations are available. This includes property rows, Boolean parameter labels, and status messages shown when arming point and color picks.
    • English names remain visible for English, unsupported languages, or properties without a translation. Stored parameter names and other UI metadata are unchanged.

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.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between cb127e2 and 6050e6f.

Files selected for processing: 1
  • crates/ui-egui/src/panels/effect_controls.rs
Files skipped from review as they are similar to previous changes: 1
  • crates/ui-egui/src/panels/effect_controls.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

The UI adds Simplified and Traditional Chinese property-name catalogs. Effect controls use localized names in property rows, Boolean parameter labels, and viewer-pick status messages. Names without a translation, and names displayed for unsupported languages, fall back to the stored English name.

Changes: Property name localization

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: Normal

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: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 pa…
Docstring Coverage Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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.

@bflatastic

Copy link
Copy Markdown
Member

Hi @linzhang779-maker, thanks for this PR! main has changed a lot since it was opened, and it now conflicts with main, so it needs a rebase before we can review it for merging.

Most of the conflict comes from the shared module layout (#2491), which moved or split files this PR touches:

  • crates/ui-egui/src/panels/effect_controls.rs was split: most of its code is now in panels/effect_controls/*.rs

When you rebase, please also make sure it fits the other recent changes:

CI (cargo xtask ci) now runs on PRs. Once it's green on the rebased branch, we'll take a look. Thank you!

@eliets2 eliets2 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.rs catalog with Simplified and Traditional tables, a name() lookup with English fallback, and self-tests
  • Wiring in panels/effect_controls.rs for prop_row, the inline boolean label, and the toggle_pick status hint

Findings:

  • [performance] crates/ui-egui/src/i18n/props.rs, name(), called from prop_row in crates/ui-egui/src/panels/effect_controls.rs on every parameter row on every frame: it returns String and allocates via english.to_string() even for English or untranslated names, where the previous code borrowed &prop.name. Return Cow<'_, str> instead, borrowing the &'static str translation on a hit and the input english on a miss.
  • [user experience] crates/ui-egui/src/panels/effect_controls.rs, prop_row: the visual label is translated but app.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 call catalog() for two languages, so a broken name() 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 pure name_for(language, english) helper so the test does not depend on the global current() 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. Rotation or Anchor 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 or zh-hant, only asserting catalog("en") is None and catalog("zh-hans") is Some. Add assertions such as catalog("fr").is_none(), catalog("zh-hant").is_some(), and an empty/unknown code to cover the _ => None arm, 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.

This branch has not been deployed

No deployments
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.

3 participants