codeant-ai-for-open-source[bot] commented on code in PR #37403:
URL: https://github.com/apache/superset/pull/37403#discussion_r2744172668
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx:
##########
@@ -243,10 +243,12 @@ function createAxisControl(axis: 'x' | 'y'):
ControlSetRow[] {
name: 'truncateYAxis',
config: {
type: 'CheckboxControl',
- label: t('Truncate Axis'),
+ label: t('Truncate Y Axis'),
default: truncateYAxis,
renderTrigger: true,
- description: t('It’s not recommended to truncate axis in Bar
chart.'),
+ description: t(
+ 'It’s not recommended to truncate Y axis in Bar chart.',
+ ),
Review Comment:
**Suggestion:** The description uses a typographic (curly) apostrophe (').
Translation keys are the raw strings passed to `t(...)`, so using a different
apostrophe character will produce a different translation key than the ASCII
version and likely break existing translations; replace the curly apostrophe
with a plain ASCII apostrophe and normalize casing to match other description
strings. [possible bug]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Truncate Y Axis description may show untranslated text.
- ⚠️ Translation key mismatch across deployed locales.
- ⚠️ Inconsistent user-facing label strings in UI.
```
</details>
```suggestion
description: t("It's not recommended to truncate Y axis in bar
chart."),
```
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Open the file
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
and inspect the Truncate Y axis control description at lines 249-251. The
code calls
t(...) with the text string used as the translation key.
2. The translation function t(...) is implemented at
packages/superset-core/src/ui/translation/TranslatorSingleton.ts:66-68
(function t(input:
string, ...args: unknown[]) { return getInstance().translate(input,
...args); }). The
exact characters of the input string determine the lookup key.
3. If the deployed translations include an entry for the ASCII-apostrophe
key "It's not
recommended to truncate Y axis in Bar chart." but the code uses a curly
apostrophe variant
(as seen in the final file), the translator will not find the ASCII key and
will fall back
to the raw input string or English, causing a missing/incorrect translation
in the UI.
4. To observe: build/run the app, open the Bar chart control panel (Chart
Options → Y Axis
→ Truncate Y Axis) and compare the displayed description against the
expected localized
string. The mismatch will reproduce the missing translation because
TranslatorSingleton.translate() will not match the ASCII key.
```
</details>
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
**Line:** 249:251
**Comment:**
*Possible Bug: The description uses a typographic (curly) apostrophe
('). Translation keys are the raw strings passed to `t(...)`, so using a
different apostrophe character will produce a different translation key than
the ASCII version and likely break existing translations; replace the curly
apostrophe with a plain ASCII apostrophe and normalize casing to match other
description 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.
```
</details>
--
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]