codeant-ai-for-open-source[bot] commented on code in PR #40635:
URL: https://github.com/apache/superset/pull/40635#discussion_r3591163269
##########
superset/translations/messages.pot:
##########
@@ -189,16 +189,13 @@ msgstr ""
msgid "\"%s\" is now the system default theme"
msgstr ""
-#, no-python-format
-msgid "% calculation"
+msgid "%% calculation"
msgstr ""
-#, no-python-format
-msgid "% of parent"
+msgid "%% of parent"
msgstr ""
-#, no-python-format
-msgid "% of total"
+msgid "%% of total"
Review Comment:
**Suggestion:** These msgids use `%%` but the frontend calls `t('%
calculation')`, `t('% of parent')`, and `t('% of total')` with a single `%`.
Because gettext lookup is exact, these entries will not match the runtime keys,
so French (and other locale) translations for these labels will not be found.
Use single-`%` msgids so the catalog keys match the source strings. [api
mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Funnel chart percent label cannot be localized properly.
- ⚠️ Sunburst tooltip percent labels remain untranslated for locales.
- ⚠️ Future translations for these keys will silently not apply.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Observe the frontend source strings using gettext: in
`superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx`
line 74
(grep/read output line 15 with offset 60), the `percent_calculation_type`
control is
labeled with `label: t('% calculation')`; in
`superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/transformProps.ts`
lines 137
and 142, tooltip rows are created with `t('% of total')` and `t('% of
parent')`.
2. Inspect the translation template: in `superset/translations/messages.pot`
lines 33–39
(read output with offset 160), the corresponding entries are `msgid "%%
calculation"`,
`msgid "%% of parent"`, and `msgid "%% of total"`, i.e. the msgids contain
double percent
signs instead of the single `%` used in the source code.
3. Note that gettext lookups are keyed by the exact `msgid` string produced
from the
source; at runtime the JS translation function `t()` will look up the keys
`'%
calculation'`, `'% of parent'`, and `'% of total'`, but the catalog
generated from
`messages.pot` will only contain `%% calculation`, `%% of parent`, and `%%
of total`, so
these keys never match.
4. Build and run Superset with a non-English locale (e.g. French) where
translators have
filled in `msgstr` for the `%% calculation`/`%% of parent`/`%% of total`
entries in the
`.po` derived from `superset/translations/messages.pot`: open the Funnel
chart control
panel (Funnel plugin using `controlPanel.tsx`) or view a Sunburst chart
tooltip
(`transformProps.ts`), and observe that these labels remain in the original
English text
instead of the provided translations because the runtime translations are
looked up by
single-`%` keys that do not exist in the catalog.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b4732301c5574248836e7818e6819cca&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b4732301c5574248836e7818e6819cca&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/translations/messages.pot
**Line:** 192:198
**Comment:**
*Api Mismatch: These msgids use `%%` but the frontend calls `t('%
calculation')`, `t('% of parent')`, and `t('% of total')` with a single `%`.
Because gettext lookup is exact, these entries will not match the runtime keys,
so French (and other locale) translations for these labels will not be found.
Use single-`%` msgids so the catalog keys match the source strings.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40635&comment_hash=c7f0757d2c19bb070e8535d108819617a047c9b2def5b5e95982be47b15e4d1b&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40635&comment_hash=c7f0757d2c19bb070e8535d108819617a047c9b2def5b5e95982be47b15e4d1b&reaction=dislike'>👎</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]