Repository navigation
i18n: File Info's control-characters error is translated for multi-line fields too - #7399
bflatastic merged 12 commits into
Conversation
…ne fields too
file.info refused a control character with one message built from an
optional suffix: "{k} has control characters" for Description and
Copyright Notice, and the same text plus " or line breaks" for the other
text fields and each keyword in a list. A catalog template cannot match an
empty final placeholder, so the multi-line form stayed in English in every
catalog, and the five catalogs with a row showed the single-line suffix in
English.
The two rules are now two complete messages with the same English text,
each with a row in every catalog that translates all status and error
messages. The old `{k} has control characters{_1}` rows in de, hi, it,
pt-br and sv are replaced.
…haracters row
The rows main added for `{k} has control characters{_1}` match no message the
engine now writes; the two complete messages already have rows in these catalogs.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Merged, thanks @dotCooCoo! It passed its CI checks. |
What and why
file.inforefuses a text value with control characters.text()incrates/engine/src/cmd/fileinfo.rsbuilt the error as"{k} has control characters{}", with an empty string for Description and Copyright Notice (which take line breaks and tabs) and" or line breaks"for the other fields. The message scan collected that as{k} has control characters{_1}, and the catalog matcher does not match a final placeholder against empty text, so "description has control characters" stayed English in every catalog. The catalogs that had the{_1}row (de, hi, it, pl, pt-br, sv, uk, zh-hans) showed the single-line form with " or line breaks" left in English, and the other complete-message catalogs had no row.text()now returns one of two whole messages:{k} has control charactersand{k} has control characters or line breaks. The English text of both errors is unchanged, and so is which characters each field refuses.{k} has control characters{_1}rows are removed.catalog.rsis unchanged, so no other message matches differently.docs/target-app-parity.mdhas one line for it.The only change users see is that both forms of the error now show in the interface language.
How it was tested
New tests, on
mainat446bf59:i18n::tests::file_info_control_character_refusals_translate_in_every_complete_catalog(crates/ui-egui/src/i18n/tests.rs): the message scan finds both keys;file.infowith a control character in each of the seven text paths (Description, Copyright Notice, Title, Author, Author Title, Copyright URL and a keyword in a list) gives the exact English error; and in every complete-message language the shown text keeps the field's key and has none of the rule's English words. It fails without the change: with the old source line it stops at the message scan.tests::fileinfo::control_characters_are_refused_with_the_field_rule(crates/engine/src/tests/fileinfo.rs): the exact error for each of the seven paths, and Description and Copyright Notice still take line breaks and tabs. It guards the English text and passes with or without the change.Focused checks on the tree that contains
mainat446bf59:cargo fmt --all -- --checkcargo check --workspace --testscargo clippy -p vectorcraft-engine --all-targets -- -D warningsandcargo clippy -p vectorcraft-ui-egui --all-targets -- -D warningscargo test -p vectorcraft-ui-egui --lib i18n: 116 passedcargo test -p vectorcraft-engine --lib fileinfo: 22 passedcargo xtask brands,cargo xtask layers(30 crates) andcargo xtask assets(337 files)After merging
mainat9ddbf25, which makes Danish a complete-message language, the branch adds the two Danish rows (0537975). On that tree:cargo fmt --all -- --checkcargo check --workspace --testscargo test -p vectorcraft-ui-egui --lib i18n: 124 passedcargo xtask ciruns in this pull request's CI.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md.Summary by CodeRabbit