Commit 92bf21f
committed
Add failing tests: placeholder gate rejects valid reordered human translations
TranslationValidator compares a source's positional and sequential specifier
views independently, so it only permits reordering when the source is ALREADY
positional. A non-positional source (`%@ … %@`) whose translation reorders via
positional specifiers (`%2$@ … %1$@`) is rejected — even though that is the
standard, Apple-documented iOS reordering mechanism and is correct at runtime
(`String(format:)` honors positional specifiers regardless of the source shape).
The human-translation gate added for the String Catalog fold
(`CatalogStrings.trusted_human`, `PluralStrings.human_forms_for`) inherits this,
so it rejects and downgrades valid, currently-shipping human translations to
machine/English. This is not hypothetical: the committed translated `.strings`
contain 23 key-as-source strings across 34 locales (513 cells) that positionalize
a bare-`%@` English source this way, e.g. ar "%@ of %@ used on your site" =>
"%1$@ من %2$@ على موقعك".
Two failing tests pin the correct behavior:
- translation_validator_test.rb — the root cause at the validator.
- catalog_strings_helper_test.rb — the user-facing downgrade in the fold.
The fix belongs in TranslationValidator (shared by AI, plurals, and regular
human strings): treat a non-positional source as implicitly numbered 1..N by
appearance order and accept a fully-positional candidate whose index→type map
matches. Existing tests already keep genuine breakage (sequential flip, type/
count change) rejected, so a correct fix cannot just drop the distinction.1 parent cd9b85f commit 92bf21f
2 files changed
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
76 | 91 | | |
77 | 92 | | |
78 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
26 | 44 | | |
27 | 45 | | |
28 | 46 | | |
| |||
0 commit comments