Skip to content

fix(i18n): split parameter-suggestion plural into two messages - #46049

Merged
rusackas merged 3 commits into
apache:masterfrom
AmoghAtreya:fix/i18n-parameter-suggestion-plural
Nov 21, 2026
Merged

rusackas merged 3 commits into
apache:masterfrom
AmoghAtreya:fix/i18n-parameter-suggestion-plural

Conversation

@AmoghAtreya

@AmoghAtreya AmoghAtreya commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

ParameterErrorMessage built its "Did you mean" line with a tn() plural whose singular and plural forms used different placeholders (%(suggestion)s and %(firstSuggestions)s / %(lastSuggestion)s). gettext requires every msgstr[N] to use the placeholders declared in msgid_plural, so translators fell into one of three outcomes:

  • 20 catalogs used %(suggestion)s. That's the natural choice, but msgfmt --check rejects it: fatal today in fr, it, pt and sl, and latent in the 16 fuzzy catalogs.
  • 5 catalogs (lv, ru, sr, sr_Latn, uk) used %(firstSuggestions)s %(lastSuggestion)s. That passes the check, but renders a leading gap or a dangling "or" for a single suggestion.
  • 4 catalogs used %(lastSuggestion)s alone. 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

  • Replace the tn() call with two t() messages, one for a single suggestion and one for several, chosen by templateKeys.length === 1. Each message declares only its own placeholders, so no translation can mismatch them.
  • Add i18n: translator comments explaining each placeholder. These are extracted into the .pot and every catalog.
  • Fix the English typo: "%(undefinedParameter)s?" becomes "%(undefinedParameter)s"?.
  • Migrate the existing translations into the two new entries in all 29 catalogs instead of dropping them:
    • Single suggestion: the form each locale used for n=1, normalised to %(suggestion)s.
    • Several suggestions: the form each locale used for n=2.
    • Fuzzy flags are preserved.
    • The misplaced ? is corrected where the catalog's own plural form showed the intended placement.
    • pt and pt_BR: the untranslated English "or" is replaced with "ou".
  • The new catalog entries match babel_update.sh output exactly, so the pot-drift check stays clean.

Known gaps

  • ja, ko, th, tr, zh, zh_TW and nl never translated the several-suggestions form, so that message shows in English until the next backfill. Their single-suggestion translation is kept.
  • A few catalogs (ta, ko, th, nl, pt, pt_BR, cs, sk, uk) keep a "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:

Locale Before After
en "state" instead of "stat?" "state" instead of "stat"?
ru ␣или "state" вместо "stat"? (dangling "or") "state" вместо "stat"?
lv ␣"state" vietā "stat"? (leading gap) "state" vietā "stat"?
fr catalog fails msgfmt --check "state" au lieu de "stat"?

TESTING INSTRUCTIONS

  1. Run the unit tests:
    npm run test -- src/components/ErrorMessage/ParameterErrorMessage.test.tsx
  2. Validate the catalogs, including fuzzy entries. None should report an error on this message, and the previously failing fr, it, pt and sl catalogs now pass:
    for f in superset/translations/*/LC_MESSAGES/messages.po; do
      msgfmt --check --use-fuzzy -o /dev/null "$f"
    done
  3. Confirm extraction is stable: run ./scripts/translations/babel_update.sh and check that the suggestion entries are unchanged.
  4. Manually: in SQL Lab, with template parameters {"state": "CA"}, run SELECT '{{ stat }}', open "See more", and check the suggestion line in English and in a translated locale such as ru or fr.

ADDITIONAL INFORMATION

@github-actions github-actions Bot added i18n Namespace | Anything related to localization i18n:spanish Translation related to Spanish language i18n:italian Translation related to Italian language i18n:french Translation related to French language i18n:chinese Translation related to Chinese language i18n:japanese Translation related to Japanese language i18n:russian Translation related to Russian language i18n:korean Translation related to Korean language i18n:dutch i18n:slovak i18n:ukrainian i18n:portuguese i18n:brazilian i18n:traditional-chinese i18n:persian i18n:czech i18n:latvian labels Nov 6, 2026
@netlify

netlify Bot commented Nov 6, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4d29922
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aed79f89cac79063a1e1f0d
😎 Deploy Preview https://deploy-preview-46049--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@AmoghAtreya

Copy link
Copy Markdown
Contributor Author

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:

  • In English, the ? moves outside the quotes ("stat?" becomes "stat"?).
  • In ru, lv, sr, sr_Latn and uk, the stray gap or dangling "or" is gone.
  • In ja, ko, th, tr, zh, zh_TW and nl, the several-suggestions line shows in English until it's translated.

The before/after table in the description shows these as text. Happy to tick the box or add screenshots if reviewers prefer.

@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: f3333f274b73

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.92%. Comparing base (29b6d4c) to head (e8b1ed5).

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     
Flag Coverage Δ
hive 33.88% <ø> (ø)
javascript 82.74% <100.00%> (-0.01%) ⬇️
mysql 51.56% <ø> (ø)
postgres 51.59% <ø> (ø)
presto 35.56% <ø> (ø)
python 88.42% <ø> (+36.54%) ⬆️
sqlite 51.26% <ø> (ø)
unit 83.82% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sadpandajoe
sadpandajoe requested a review from rusackas November 6, 2026 18:21
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Nov 13, 2026

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

@github-actions github-actions Bot added i18n:german Translation related to German language i18n:slovenian i18n:arabic labels Nov 21, 2026
…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
@AmoghAtreya

Copy link
Copy Markdown
Contributor Author

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?

Thanks @rusackas! My apologies, that was from my local setup and I committed that to the PR by mistake. Dropped .codex/hooks.json in the latest commit.

@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 21, 2026

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @AmoghAtreya for cleaning up the stray file and catching up with master. LGTM!

@rusackas
rusackas merged commit 45f1aa7 into apache:master Nov 21, 2026
79 checks passed
jprinet added a commit to jprinet/superset that referenced this pull request Nov 23, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n:arabic i18n:brazilian i18n:catalan i18n:chinese Translation related to Chinese language i18n:czech i18n:dutch i18n:finnish i18n:french Translation related to French language i18n:german Translation related to German language i18n:italian Translation related to Italian language i18n:japanese Translation related to Japanese language i18n:korean Translation related to Korean language i18n:latvian i18n:maori i18n:persian i18n:polish i18n:portuguese i18n:romanian i18n:russian Translation related to Russian language i18n:serbian i18n:serbian-latin i18n:slovak i18n:slovenian i18n:spanish Translation related to Spanish language i18n:tamil i18n:thai i18n:traditional-chinese i18n:turkish i18n:ukrainian i18n Namespace | Anything related to localization size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[i18n] The parameter-suggestion message invites a translation gettext rejects — 20 of 29 catalogs took it

2 participants