Repository navigation
fix(i18n): split parameter-suggestion plural into two messages - #46049
Conversation
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Note on the "Changes UI" checkbox: I left it unchecked because there are no layout, styling or component changes. The only user-visible difference is the wording of the existing "Did you mean" line in the parameter error message:
The before/after table in the description shows these as text. Happy to tick the box or add screenshots if reviewers prefer. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #46049 +/- ##
===========================================
+ Coverage 65.70% 85.92% +20.21%
===========================================
Files 3122 3122
Lines 216867 216874 +7
Branches 51420 51421 +1
===========================================
+ Hits 142486 186342 +43856
+ Misses 71103 27115 -43988
- Partials 3278 3417 +139
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rusackas
left a comment
There was a problem hiding this comment.
Thanks @AmoghAtreya! Splitting this into two messages makes a lot of sense, and nice to see the existing translations carried over rather than dropped.
One thing before approving... .codex/hooks.json looks like it tagged along from a local setup and isn't related to this fix. Mind dropping it from the PR?
Co-authored-by: Cursor <[email protected]>
…suggestion-plural Co-authored-by: Cursor <[email protected]> # Conflicts: # superset/translations/ar/LC_MESSAGES/messages.po # superset/translations/fa/LC_MESSAGES/messages.po # superset/translations/nl/LC_MESSAGES/messages.po # superset/translations/pl/LC_MESSAGES/messages.po
Thanks @rusackas! My apologies, that was from my local setup and I committed that to the PR by mistake. Dropped |
rusackas
left a comment
There was a problem hiding this comment.
Thanks @AmoghAtreya for cleaning up the stray file and catching up with master. LGTM!
* origin/master: (393 commits) fix(a11y): name the semantic view description input (apache#46458) docs(semantic): explain datasource list modification eligibility (apache#46462) docs(semantic-layer): document NULL-preserving exclusion filters (apache#46447) fix(uploads): skip folder and system entries in columnar ZIP uploads (apache#45617) fix(i18n-es): promote 47 of the zero-context backfill entries (apache#45847) fix(mcp): return structured ChartError on SQLAlchemyError in get_chart_sql (apache#44351) fix(datasets): follow semantic view modification permissions (apache#46448) fix(docker): account for container memory limits in frontend-mem-nag.sh (apache#46373) fix(reports): carry the report's native filters in the email and Slack link (apache#46062) fix(explore): apply the dataset timezone to grained temporal filter values (apache#46175) fix(i18n): enforce the do-not-translate registry across the catalogs (apache#45974) chore(logging): log unparseable virtual dataset SQL at debug in the RLS lookup (apache#46139) fix(i18n): split parameter-suggestion plural into two messages (apache#46049) test(partition-mapping): cover Hive/Impala mirrored SQL, cache outage and migration (apache#46319) perf(dashboard): look up the dashboard once per filter_state read (apache#46314) fix(i18n): load the dayjs locale for every language with a catalog (apache#45982) test(semantic-layer): make date export parametrization deterministic (apache#46449) fix(oauth2): idempotent OAuth2 completion and resilient listener (apache#40292) fix(explore): prevent full table scan when SQL expression is used as x-axis (apache#41339) feat(mcp): radar chart type plugin (apache#43571) ... # Conflicts: # .github/workflows/docker.yml # .github/workflows/superset-frontend.yml
SUMMARY
ParameterErrorMessagebuilt its "Did you mean" line with atn()plural whose singular and plural forms used different placeholders (%(suggestion)sand%(firstSuggestions)s/%(lastSuggestion)s). gettext requires everymsgstr[N]to use the placeholders declared inmsgid_plural, so translators fell into one of three outcomes:%(suggestion)s. That's the natural choice, butmsgfmt --checkrejects it: fatal today in fr, it, pt and sl, and latent in the 16 fuzzy catalogs.%(firstSuggestions)s %(lastSuggestion)s. That passes the check, but renders a leading gap or a dangling "or" for a single suggestion.%(lastSuggestion)salone. That is valid and correct, but nothing in the source points to it.There was also a logic bug:
tn()picks a form by the locale's plural rules, not by "one versus several" suggestions. In Russian, for example, 21 suggestions select the singular form.Changes
tn()call with twot()messages, one for a single suggestion and one for several, chosen bytemplateKeys.length === 1. Each message declares only its own placeholders, so no translation can mismatch them.i18n:translator comments explaining each placeholder. These are extracted into the.potand every catalog."%(undefinedParameter)s?"becomes"%(undefinedParameter)s"?.%(suggestion)s.?is corrected where the catalog's own plural form showed the intended placement.babel_update.shoutput exactly, so the pot-drift check stays clean.Known gaps
"X?"quote placement copied from the old English string, because there was no in-catalog evidence of the intended form. Native reviewers can adjust these.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Single suggestion, rendered text:
"state" instead of "stat?""state" instead of "stat"?␣или "state" вместо "stat"?(dangling "or")"state" вместо "stat"?␣"state" vietā "stat"?(leading gap)"state" vietā "stat"?msgfmt --check"state" au lieu de "stat"?TESTING INSTRUCTIONS
npm run test -- src/components/ErrorMessage/ParameterErrorMessage.test.tsx./scripts/translations/babel_update.shand check that the suggestion entries are unchanged.{"state": "CA"}, runSELECT '{{ stat }}', open "See more", and check the suggestion line in English and in a translated locale such as ru or fr.ADDITIONAL INFORMATION