This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch adopt-pr-33940-translatable-label-positions
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 950d922cac7782a549bcdd425875c35f47e30a04
Author: Evan Rusackas <[email protected]>
AuthorDate: Thu Feb 5 16:49:55 2026 -0800

    feat(translations): make Radar chart label positions translatable
    
    This enables label position options in the Radar chart control panel to
    be translated by wrapping them with the t() function. The LABEL_POSITION
    constant is removed from constants.ts and replaced with a local function
    getLabelPositionOptions() that returns translatable label strings.
    
    Fixes: https://github.com/apache/superset/issues/29479
    
    Originally by @rusackas in https://github.com/apache/superset/pull/33940
    
    Co-Authored-By: Evan Rusackas <[email protected]>
    Co-Authored-By: Claude Opus 4.5 <[email protected]>
---
 .../plugin-chart-echarts/src/Radar/controlPanel.tsx  | 20 ++++++++++++++++++--
 .../plugins/plugin-chart-echarts/src/constants.ts    | 17 -----------------
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx 
b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx
index 0c7dbc85229..0d2cb9a1fcc 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx
@@ -35,7 +35,7 @@ import {
   getStandardizedControls,
 } from '@superset-ui/chart-controls';
 import { DEFAULT_FORM_DATA } from './types';
-import { LABEL_POSITION } from '../constants';
+import { LabelPositionEnum } from '../types';
 import { legendSection } from '../controls';
 
 const { labelType, labelPosition, numberFormat, showLabels, isCircle } =
@@ -72,6 +72,22 @@ const radarMetricMinValue: { name: string; config: 
ControlFormItemSpec } = {
   },
 };
 
+const getLabelPositionOptions = (): [LabelPositionEnum, string][] => [
+  [LabelPositionEnum.Top, t('Top')],
+  [LabelPositionEnum.Left, t('Left')],
+  [LabelPositionEnum.Right, t('Right')],
+  [LabelPositionEnum.Bottom, t('Bottom')],
+  [LabelPositionEnum.Inside, t('Inside')],
+  [LabelPositionEnum.InsideLeft, t('Inside left')],
+  [LabelPositionEnum.InsideRight, t('Inside right')],
+  [LabelPositionEnum.InsideTop, t('Inside top')],
+  [LabelPositionEnum.InsideBottom, t('Inside bottom')],
+  [LabelPositionEnum.InsideTopLeft, t('Inside top left')],
+  [LabelPositionEnum.InsideBottomLeft, t('Inside bottom left')],
+  [LabelPositionEnum.InsideTopRight, t('Inside top right')],
+  [LabelPositionEnum.InsideBottomRight, t('Inside bottom right')],
+];
+
 const config: ControlPanelConfig = {
   controlPanelSections: [
     {
@@ -136,7 +152,7 @@ const config: ControlPanelConfig = {
               freeForm: false,
               label: t('Label position'),
               renderTrigger: true,
-              choices: LABEL_POSITION,
+              choices: getLabelPositionOptions(),
               default: labelPosition,
               description: D3_FORMAT_DOCS,
             },
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
index a6992323e45..718ca01a3b2 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
@@ -21,7 +21,6 @@ import { t } from '@apache-superset/core';
 import { JsonValue, TimeGranularity } from '@superset-ui/core';
 import { ReactNode } from 'react';
 import {
-  LabelPositionEnum,
   LegendFormData,
   LegendOrientation,
   LegendType,
@@ -50,22 +49,6 @@ export const TIMESERIES_CONSTANTS = {
   horizontalBarLabelRightPadding: 70,
 };
 
-export const LABEL_POSITION: [LabelPositionEnum, string][] = [
-  [LabelPositionEnum.Top, 'Top'],
-  [LabelPositionEnum.Left, 'Left'],
-  [LabelPositionEnum.Right, 'Right'],
-  [LabelPositionEnum.Bottom, 'Bottom'],
-  [LabelPositionEnum.Inside, 'Inside'],
-  [LabelPositionEnum.InsideLeft, 'Inside left'],
-  [LabelPositionEnum.InsideRight, 'Inside right'],
-  [LabelPositionEnum.InsideTop, 'Inside top'],
-  [LabelPositionEnum.InsideBottom, 'Inside bottom'],
-  [LabelPositionEnum.InsideTopLeft, 'Inside top left'],
-  [LabelPositionEnum.InsideBottomLeft, 'Inside bottom left'],
-  [LabelPositionEnum.InsideTopRight, 'Inside top right'],
-  [LabelPositionEnum.InsideBottomRight, 'Inside bottom right'],
-];
-
 export enum OpacityEnum {
   Transparent = 0,
   SemiTransparent = 0.3,

Reply via email to