dosubot[bot] commented on issue #29479:
URL: https://github.com/apache/superset/issues/29479#issuecomment-2207874279

   <!-- Answer -->
   To make the "Label Position" dropdown menu options in the Chart Editor for 
Radar Charts translatable, you need to ensure that the choices for the 
`label_position` control are wrapped with the `t` function for translation. 
Here is the relevant part of the code with the necessary changes:
   
   ```tsx
   import { t } from '@superset-ui/core';
   import { LABEL_POSITION } from '../constants';
   
   // Assuming LABEL_POSITION is an array of label positions
   const TRANSLATED_LABEL_POSITION = LABEL_POSITION.map(position => [position, 
t(position)]);
   
   const config: ControlPanelConfig = {
     controlPanelSections: [
       // ... other sections
       {
         label: t('Chart Options'),
         expanded: true,
         controlSetRows: [
           // ... other controls
           [
             {
               name: 'label_position',
               config: {
                 type: 'SelectControl',
                 freeForm: false,
                 label: t('Label position'),
                 renderTrigger: true,
                 choices: TRANSLATED_LABEL_POSITION,
                 default: labelPosition,
                 description: D3_FORMAT_DOCS,
               },
             },
           ],
           // ... other controls
         ],
       },
     ],
     // ... other configurations
   };
   export default config;
   ```
   
   In this code, `TRANSLATED_LABEL_POSITION` is created by mapping over 
`LABEL_POSITION` and applying the `t` function to each position to make them 
translatable. This ensures that the dropdown menu options for "Label Position" 
are properly translated.
   
   Additionally, ensure that the translations for the label positions are 
included in the appropriate `.po` files. For example, in the `messages.po` 
file, you might have entries like:
   
   ```po
   #: 
superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx:122
   msgid "Label position"
   msgstr "Položaj oznake"
   ```
   
   This ensures that the translations are available and used correctly in the 
application 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/translations/sl/LC_MESSAGES/messages.po)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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]

Reply via email to