Open goldjee opened 2 months ago
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:
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:
#: 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 [1][2].
To continue talking to Dosu, mention @dosu.
Screenshot
Description
The editor for Radar Chart uses "Label Position" dropdown to adjust where labels should be drawn as depicted on the attached screenshot. It seems that the contents of this dropdown are not able to be translated as I haven't found corresponding lines in messages.po files.
Design input