diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx index e1ed5ff76dd..66da4bb9e28 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/sections/advancedAnalytics.tsx @@ -108,20 +108,18 @@ export const advancedAnalyticsControls: ControlPanelSectionConfig = { multi: true, freeForm: true, label: t('Time shift'), - choices: formatSelectOptions([ - '1 day ago', - '1 week ago', - '28 days ago', - '30 days ago', - '52 weeks ago', - '1 year ago', - '104 weeks ago', - '2 years ago', - '156 weeks ago', - '3 years ago', - '208 weeks ago', - '4 years ago', - ]), + choices: [ + ['1 day ago', t('1 day ago')], + ['1 week ago', t('1 week ago')], + ['28 days ago', t('28 days ago')], + ['30 days ago', t('30 days ago')], + ['52 weeks ago', t('52 weeks ago')], + ['1 year ago', t('1 year ago')], + ['104 weeks ago', t('104 weeks ago')], + ['2 years ago', t('2 years ago')], + ['156 weeks ago', t('156 weeks ago')], + ['3 years ago', t('3 years ago')], + ], description: t( 'Overlay one or more timeseries from a ' + 'relative time period. Expects relative time deltas ' + @@ -139,10 +137,10 @@ export const advancedAnalyticsControls: ControlPanelSectionConfig = { label: t('Calculation type'), default: 'values', choices: [ - [ComparisionType.Values, 'Actual values'], - [ComparisionType.Difference, 'Difference'], - [ComparisionType.Percentage, 'Percentage change'], - [ComparisionType.Ratio, 'Ratio'], + [ComparisionType.Values, t('Actual values')], + [ComparisionType.Difference, t('Difference')], + [ComparisionType.Percentage, t('Percentage change')], + [ComparisionType.Ratio, t('Ratio')], ], description: t( 'How to display time shifts: as individual lines; as the ' + @@ -162,14 +160,14 @@ export const advancedAnalyticsControls: ControlPanelSectionConfig = { label: t('Rule'), default: null, choices: [ - ['1T', '1 minutely frequency'], - ['1H', '1 hourly frequency'], - ['1D', '1 calendar day frequency'], - ['7D', '7 calendar day frequency'], - ['1MS', '1 month start frequency'], - ['1M', '1 month end frequency'], - ['1AS', '1 year start frequency'], - ['1A', '1 year end frequency'], + ['1T', t('1 minutely frequency')], + ['1H', t('1 hourly frequency')], + ['1D', t('1 calendar day frequency')], + ['7D', t('7 calendar day frequency')], + ['1MS', t('1 month start frequency')], + ['1M', t('1 month end frequency')], + ['1AS', t('1 year start frequency')], + ['1A', t('1 year end frequency')], ], description: t('Pandas resample rule'), }, diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/sections/chartTitle.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/sections/chartTitle.tsx index eda3ac33152..5e010c27e2f 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/sections/chartTitle.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/sections/chartTitle.tsx @@ -24,7 +24,10 @@ import { formatSelectOptions } from '../utils'; export const TITLE_MARGIN_OPTIONS: number[] = [ 15, 30, 50, 75, 100, 125, 150, 200, ]; -export const TITLE_POSITION_OPTIONS: string[] = ['Left', 'Top']; +export const TITLE_POSITION_OPTIONS: [string, string][] = [ + ['Left', t('Left')], + ['Top', t('Top')], +]; export const titleControls: ControlPanelSectionConfig = { label: t('Chart Title'), tabOverride: 'customize', @@ -95,8 +98,8 @@ export const titleControls: ControlPanelSectionConfig = { clearable: false, label: t('Y AXIS TITLE POSITION'), renderTrigger: true, - default: TITLE_POSITION_OPTIONS[0], - choices: formatSelectOptions(TITLE_POSITION_OPTIONS), + default: TITLE_POSITION_OPTIONS[0][0], + choices: TITLE_POSITION_OPTIONS, description: t('Changing this control takes effect instantly'), }, }, diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx index 45ca968c7e0..a2fb767f5f3 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx @@ -157,22 +157,22 @@ const granularity: SharedControlConfig<'SelectControl'> = { label: TIME_FILTER_LABELS.granularity, default: 'one day', choices: [ - [null, 'all'], - ['PT5S', '5 seconds'], - ['PT30S', '30 seconds'], - ['PT1M', '1 minute'], - ['PT5M', '5 minutes'], - ['PT30M', '30 minutes'], - ['PT1H', '1 hour'], - ['PT6H', '6 hour'], - ['P1D', '1 day'], - ['P7D', '7 days'], - ['P1W', 'week'], - ['week_starting_sunday', 'week starting Sunday'], - ['week_ending_saturday', 'week ending Saturday'], - ['P1M', 'month'], - ['P3M', 'quarter'], - ['P1Y', 'year'], + [null, t('all')], + ['PT5S', t('5 seconds')], + ['PT30S', t('30 seconds')], + ['PT1M', t('1 minute')], + ['PT5M', t('5 minutes')], + ['PT30M', t('30 minutes')], + ['PT1H', t('1 hour')], + ['PT6H', t('6 hour')], + ['P1D', t('1 day')], + ['P7D', t('7 days')], + ['P1W', t('week')], + ['week_starting_sunday', t('week starting Sunday')], + ['week_ending_saturday', t('week ending Saturday')], + ['P1M', t('month')], + ['P3M', t('quarter')], + ['P1Y', t('year')], ], description: t( 'The time granularity for the visualization. Note that you ' + diff --git a/superset-frontend/packages/superset-ui-core/src/chart/components/FallbackComponent.tsx b/superset-frontend/packages/superset-ui-core/src/chart/components/FallbackComponent.tsx index 5c22f920824..f7dcd8306e6 100644 --- a/superset-frontend/packages/superset-ui-core/src/chart/components/FallbackComponent.tsx +++ b/superset-frontend/packages/superset-ui-core/src/chart/components/FallbackComponent.tsx @@ -18,6 +18,7 @@ */ import React from 'react'; +import { t } from '@superset-ui/core'; import { SupersetTheme } from '../../style'; import { FallbackPropsWithDimension } from './SuperChart'; @@ -41,13 +42,13 @@ export default function FallbackComponent({ >
{error ? error.toString() : 'Unknown Error'}
{componentStack.split('\n').map((row: string) => (
{row}
diff --git a/superset-frontend/packages/superset-ui-core/src/chart/components/SuperChartCore.tsx b/superset-frontend/packages/superset-ui-core/src/chart/components/SuperChartCore.tsx
index 10e4cd18e68..d818890aa55 100644
--- a/superset-frontend/packages/superset-ui-core/src/chart/components/SuperChartCore.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/chart/components/SuperChartCore.tsx
@@ -19,6 +19,7 @@
/* eslint-disable react/jsx-sort-default-props */
import * as React from 'react';
+import { t } from '@superset-ui/core';
import { createSelector } from 'reselect';
import getChartComponentRegistry from '../registries/ChartComponentRegistrySingleton';
import getChartTransformPropsRegistry from '../registries/ChartTransformPropsRegistrySingleton';
@@ -167,7 +168,7 @@ export default class SuperChartCore extends React.PureComponent {
if (error) {
return (
- ERROR
+ {t('ERROR')}
chartType="{chartType}" —
{error.toString()}
diff --git a/superset-frontend/packages/superset-ui-demo/storybook/shared/components/VerifyCORS.tsx b/superset-frontend/packages/superset-ui-demo/storybook/shared/components/VerifyCORS.tsx
index de0b2ef8aba..3aa08218698 100644
--- a/superset-frontend/packages/superset-ui-demo/storybook/shared/components/VerifyCORS.tsx
+++ b/superset-frontend/packages/superset-ui-demo/storybook/shared/components/VerifyCORS.tsx
@@ -23,6 +23,7 @@ import {
Method,
makeApi,
SupersetApiError,
+ t,
} from '@superset-ui/core';
import ErrorMessage from './ErrorMessage';
@@ -121,7 +122,7 @@ export default class VerifyCORS extends React.Component {
className="btn btn-primary btn-sm"
onClick={this.handleVerify}
>
- Verify
+ {t('Verify')}
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts
index fe2c1bd1fc5..9071a278eeb 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts
@@ -21,7 +21,6 @@ import {
ControlPanelConfig,
D3_FORMAT_DOCS,
D3_TIME_FORMAT_OPTIONS,
- formatSelectOptions,
getStandardizedControls,
sections,
} from '@superset-ui/chart-controls';
@@ -40,13 +39,13 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Domain'),
default: 'month',
- choices: formatSelectOptions([
- 'hour',
- 'day',
- 'week',
- 'month',
- 'year',
- ]),
+ choices: [
+ ['hour', t('hour')],
+ ['day', t('day')],
+ ['week', t('week')],
+ ['month', t('month')],
+ ['year', t('year')],
+ ],
description: t('The time unit used for the grouping of blocks'),
},
},
@@ -56,13 +55,13 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Subdomain'),
default: 'day',
- choices: formatSelectOptions([
- 'min',
- 'hour',
- 'day',
- 'week',
- 'month',
- ]),
+ choices: [
+ ['min', t('min')],
+ ['hour', t('hour')],
+ ['day', t('day')],
+ ['week', t('week')],
+ ['month', t('month')],
+ ],
description: t(
'The time unit for each block. Should be a smaller unit than ' +
'domain_granularity. Should be larger or equal to Time Grain',
diff --git a/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/controlPanel.tsx b/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/controlPanel.tsx
index 09df0427e20..3032654ba26 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/controlPanel.tsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/controlPanel.tsx
@@ -27,7 +27,6 @@ import {
columnChoices,
ControlPanelConfig,
ControlPanelState,
- formatSelectOptions,
formatSelectOptionsForRange,
sections,
sharedControls,
@@ -72,7 +71,7 @@ const config: ControlPanelConfig = {
name: 'all_columns_x',
config: {
...columnsConfig,
- label: 'X Axis',
+ label: t('X Axis'),
},
},
],
@@ -81,7 +80,7 @@ const config: ControlPanelConfig = {
name: 'all_columns_y',
config: {
...columnsConfig,
- label: 'Y Axis',
+ label: t('Y Axis'),
},
},
],
@@ -148,8 +147,8 @@ const config: ControlPanelConfig = {
label: t('Rendering'),
renderTrigger: true,
choices: [
- ['pixelated', 'pixelated (Sharp)'],
- ['auto', 'auto (Smooth)'],
+ ['pixelated', t('pixelated (Sharp)')],
+ ['auto', t('auto (Smooth)')],
],
default: 'pixelated',
description: t(
@@ -166,9 +165,9 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Normalize Across'),
choices: [
- ['heatmap', 'heatmap'],
- ['x', 'x'],
- ['y', 'y'],
+ ['heatmap', t('heatmap')],
+ ['x', t('x')],
+ ['y', t('y')],
],
default: 'heatmap',
description: (
@@ -200,15 +199,15 @@ const config: ControlPanelConfig = {
freeForm: true,
clearable: false,
label: t('Left Margin'),
- choices: formatSelectOptions([
- 'auto',
- 50,
- 75,
- 100,
- 125,
- 150,
- 200,
- ]),
+ choices: [
+ ['auto', t('auto')],
+ [50, '50'],
+ [75, '75'],
+ [100, '100'],
+ [125, '125'],
+ [150, '150'],
+ [200, '200'],
+ ],
default: 'auto',
renderTrigger: true,
description: t(
@@ -225,15 +224,15 @@ const config: ControlPanelConfig = {
clearable: false,
freeForm: true,
label: t('Bottom Margin'),
- choices: formatSelectOptions([
- 'auto',
- 50,
- 75,
- 100,
- 125,
- 150,
- 200,
- ]),
+ choices: [
+ ['auto', t('auto')],
+ [50, '50'],
+ [75, '75'],
+ [100, '100'],
+ [125, '125'],
+ [150, '150'],
+ [200, '200'],
+ ],
default: 'auto',
renderTrigger: true,
description: t(
diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts
index ca18b712b82..c81e802b3dc 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts
@@ -82,9 +82,9 @@ const config: ControlPanelConfig = {
renderTrigger: true,
label: t('Value Domain'),
choices: [
- ['series', 'series'],
- ['overall', 'overall'],
- ['change', 'change'],
+ ['series', t('series')],
+ ['overall', t('overall')],
+ ['change', t('change')],
],
default: 'series',
description: t(
diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/controlPanel.ts
index 8d05cda0782..1dc75d96ef4 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/controlPanel.ts
@@ -40,12 +40,12 @@ const columnsConfig = isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
: allColumns;
const colorChoices = [
- ['rgb(0, 139, 139)', 'Dark Cyan'],
- ['rgb(128, 0, 128)', 'Purple'],
- ['rgb(255, 215, 0)', 'Gold'],
- ['rgb(69, 69, 69)', 'Dim Gray'],
- ['rgb(220, 20, 60)', 'Crimson'],
- ['rgb(34, 139, 34)', 'Forest Green'],
+ ['rgb(0, 139, 139)', t('Dark Cyan')],
+ ['rgb(128, 0, 128)', t('Purple')],
+ ['rgb(255, 215, 0)', t('Gold')],
+ ['rgb(69, 69, 69)', t('Dim Gray')],
+ ['rgb(220, 20, 60)', t('Crimson')],
+ ['rgb(34, 139, 34)', t('Forest Green')],
];
const config: ControlPanelConfig = {
@@ -124,9 +124,7 @@ const config: ControlPanelConfig = {
),
mapStateToProps: state => {
const datasourceChoices = columnChoices(state.datasource);
- const choices: [string, string][] = formatSelectOptions([
- 'Auto',
- ]);
+ const choices: [string, string][] = [['Auto', t('Auto')]];
return {
choices: choices.concat(datasourceChoices),
};
@@ -141,7 +139,11 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Point Radius Unit'),
default: 'Pixels',
- choices: formatSelectOptions(['Pixels', 'Miles', 'Kilometers']),
+ choices: [
+ ['Pixels', t('Pixels')],
+ ['Miles', t('Miles')],
+ ['Kilometers', t('Kilometers')],
+ ],
description: t(
'The unit of measure for the specified point radius',
),
@@ -180,14 +182,14 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Cluster label aggregator'),
clearable: false,
- choices: formatSelectOptions([
- 'sum',
- 'mean',
- 'min',
- 'max',
- 'std',
- 'var',
- ]),
+ choices: [
+ ['sum', t('sum')],
+ ['mean', t('mean')],
+ ['min', t('min')],
+ ['max', t('max')],
+ ['std', t('std')],
+ ['var', t('var')],
+ ],
default: 'sum',
description: t(
'Aggregate function applied to the list of points ' +
@@ -223,15 +225,15 @@ const config: ControlPanelConfig = {
clearable: false,
renderTrigger: true,
choices: [
- ['mapbox://styles/mapbox/streets-v9', 'Streets'],
- ['mapbox://styles/mapbox/dark-v9', 'Dark'],
- ['mapbox://styles/mapbox/light-v9', 'Light'],
+ ['mapbox://styles/mapbox/streets-v9', t('Streets')],
+ ['mapbox://styles/mapbox/dark-v9', t('Dark')],
+ ['mapbox://styles/mapbox/light-v9', t('Light')],
[
'mapbox://styles/mapbox/satellite-streets-v9',
- 'Satellite Streets',
+ t('Satellite Streets'),
],
- ['mapbox://styles/mapbox/satellite-v9', 'Satellite'],
- ['mapbox://styles/mapbox/outdoors-v9', 'Outdoors'],
+ ['mapbox://styles/mapbox/satellite-v9', t('Satellite')],
+ ['mapbox://styles/mapbox/outdoors-v9', t('Outdoors')],
],
default: 'mapbox://styles/mapbox/light-v9',
description: t('Base layer map style'),
diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx b/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx
index 92293737660..d983dca24af 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx
@@ -24,7 +24,6 @@ import {
D3_FORMAT_DOCS,
D3_FORMAT_OPTIONS,
D3_TIME_FORMAT_OPTIONS,
- formatSelectOptions,
getStandardizedControls,
sections,
} from '@superset-ui/chart-controls';
@@ -250,13 +249,13 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Rolling Function'),
default: 'None',
- choices: formatSelectOptions([
- 'None',
- 'mean',
- 'sum',
- 'std',
- 'cumsum',
- ]),
+ choices: [
+ ['None', t('None')],
+ ['mean', t('mean')],
+ ['sum', t('sum')],
+ ['std', t('std')],
+ ['cumsum', t('cumsum')],
+ ],
description: t(
'Defines a rolling window function to apply, works along ' +
'with the [Periods] text box',
@@ -303,20 +302,18 @@ const config: ControlPanelConfig = {
multi: true,
freeForm: true,
label: t('Time Shift'),
- choices: formatSelectOptions([
- '1 day',
- '1 week',
- '28 days',
- '30 days',
- '52 weeks',
- '1 year',
- '104 weeks',
- '2 years',
- '156 weeks',
- '3 years',
- '208 weeks',
- '4 years',
- ]),
+ choices: [
+ ['1 day', t('1 day')],
+ ['1 week', t('1 week')],
+ ['28 days', t('28 days')],
+ ['30 days', t('30 days')],
+ ['52 weeks', t('52 weeks')],
+ ['1 year', t('1 year')],
+ ['104 weeks', t('104 weeks')],
+ ['2 years', t('2 years')],
+ ['156 weeks', t('156 weeks')],
+ ['3 years', t('3 years')],
+ ],
description: t(
'Overlay one or more timeseries from a ' +
'relative time period. Expects relative time deltas ' +
@@ -354,14 +351,14 @@ const config: ControlPanelConfig = {
freeForm: true,
label: t('Rule'),
default: null,
- choices: formatSelectOptions([
- '1T',
- '1H',
- '1D',
- '7D',
- '1M',
- '1AS',
- ]),
+ choices: [
+ ['1T', t('1T')],
+ ['1H', t('1H')],
+ ['1D', t('1D')],
+ ['7D', t('7D')],
+ ['1M', t('1M')],
+ ['1AS', t('1AS')],
+ ],
description: t('Pandas resample rule'),
},
},
@@ -372,14 +369,14 @@ const config: ControlPanelConfig = {
freeForm: true,
label: t('Method'),
default: null,
- choices: formatSelectOptions([
- 'asfreq',
- 'bfill',
- 'ffill',
- 'median',
- 'mean',
- 'sum',
- ]),
+ choices: [
+ ['asfreq', t('asfreq')],
+ ['bfill', t('bfill')],
+ ['ffill', t('ffill')],
+ ['median', t('median')],
+ ['mean', t('mean')],
+ ['sum', t('sum')],
+ ],
description: t('Pandas resample method'),
},
},
diff --git a/superset-frontend/plugins/legacy-plugin-chart-pivot-table/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-pivot-table/src/controlPanel.ts
index e4c0b477c48..11daca1e942 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-pivot-table/src/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-pivot-table/src/controlPanel.ts
@@ -19,7 +19,6 @@
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
- formatSelectOptions,
D3_FORMAT_DOCS,
D3_FORMAT_OPTIONS,
D3_TIME_FORMAT_OPTIONS,
@@ -52,14 +51,14 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Aggregation function'),
clearable: false,
- choices: formatSelectOptions([
- 'sum',
- 'mean',
- 'min',
- 'max',
- 'std',
- 'var',
- ]),
+ choices: [
+ ['sum', t('sum')],
+ ['mean', t('mean')],
+ ['min', t('min')],
+ ['max', t('max')],
+ ['std', t('std')],
+ ['var', t('var')],
+ ],
default: 'sum',
description: t(
'Aggregate function to apply when pivoting and ' +
diff --git a/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx b/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx
index 12795385f34..11bb451d57f 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx
@@ -20,7 +20,6 @@ import React from 'react';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
- formatSelectOptions,
D3_FORMAT_DOCS,
D3_FORMAT_OPTIONS,
D3_TIME_FORMAT_OPTIONS,
@@ -132,13 +131,13 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Rolling Function'),
default: 'None',
- choices: formatSelectOptions([
- 'None',
- 'mean',
- 'sum',
- 'std',
- 'cumsum',
- ]),
+ choices: [
+ ['None', t('None')],
+ ['mean', t('mean')],
+ ['sum', t('sum')],
+ ['std', t('std')],
+ ['cumsum', t('cumsum')],
+ ],
description: t(
'Defines a rolling window function to apply, works along ' +
'with the [Periods] text box',
@@ -185,20 +184,18 @@ const config: ControlPanelConfig = {
multi: true,
freeForm: true,
label: t('Time Shift'),
- choices: formatSelectOptions([
- '1 day',
- '1 week',
- '28 days',
- '30 days',
- '52 weeks',
- '1 year',
- '104 weeks',
- '2 years',
- '156 weeks',
- '3 years',
- '208 weeks',
- '4 years',
- ]),
+ choices: [
+ ['1 day', t('1 day')],
+ ['1 week', t('1 week')],
+ ['28 days', t('28 days')],
+ ['30 days', t('30 days')],
+ ['52 weeks', t('52 weeks')],
+ ['1 year', t('1 year')],
+ ['104 weeks', t('104 weeks')],
+ ['2 years', t('2 years')],
+ ['156 weeks', t('156 weeks')],
+ ['3 years', t('3 years')],
+ ],
description: t(
'Overlay one or more timeseries from a ' +
'relative time period. Expects relative time deltas ' +
@@ -214,10 +211,10 @@ const config: ControlPanelConfig = {
label: t('Calculation type'),
default: 'values',
choices: [
- ['values', 'Actual Values'],
- ['absolute', 'Difference'],
- ['percentage', 'Percentage change'],
- ['ratio', 'Ratio'],
+ ['values', t('Actual Values')],
+ ['absolute', t('Difference')],
+ ['percentage', t('Percentage change')],
+ ['ratio', t('Ratio')],
],
description: t(
'How to display time shifts: as individual lines; as the ' +
@@ -236,14 +233,14 @@ const config: ControlPanelConfig = {
freeForm: true,
label: t('Rule'),
default: null,
- choices: formatSelectOptions([
- '1T',
- '1H',
- '1D',
- '7D',
- '1M',
- '1AS',
- ]),
+ choices: [
+ ['1T', t('1T')],
+ ['1H', t('1H')],
+ ['1D', t('1D')],
+ ['7D', t('7D')],
+ ['1M', t('1M')],
+ ['1AS', t('1AS')],
+ ],
description: t('Pandas resample rule'),
},
},
@@ -254,14 +251,14 @@ const config: ControlPanelConfig = {
freeForm: true,
label: t('Method'),
default: null,
- choices: formatSelectOptions([
- 'asfreq',
- 'bfill',
- 'ffill',
- 'median',
- 'mean',
- 'sum',
- ]),
+ choices: [
+ ['asfreq', t('asfreq')],
+ ['bfill', t('bfill')],
+ ['ffill', t('ffill')],
+ ['median', t('median')],
+ ['mean', t('mean')],
+ ['sum', t('sum')],
+ ],
description: t('Pandas resample method'),
},
},
diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts
index feea2e08481..b0f3be22c50 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts
@@ -41,10 +41,10 @@ const config: ControlPanelConfig = {
label: t('Country Field Type'),
default: 'cca2',
choices: [
- ['name', 'Full name'],
- ['cioc', 'code International Olympic Committee (cioc)'],
- ['cca2', 'code ISO 3166-1 alpha-2 (cca2)'],
- ['cca3', 'code ISO 3166-1 alpha-3 (cca3)'],
+ ['name', t('Full name')],
+ ['cioc', t('code International Olympic Committee (cioc)')],
+ ['cca2', t('code ISO 3166-1 alpha-2 (cca2)')],
+ ['cca3', t('code ISO 3166-1 alpha-3 (cca3)')],
],
description: t(
'The country code standard that Superset should expect ' +
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/Arc.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/Arc.jsx
index a2c8e614361..75cf8d09a18 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/Arc.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/Arc.jsx
@@ -37,11 +37,11 @@ function setTooltipContent(formData) {
return o => (
{formData.dimension && (
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/Grid.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/Grid.jsx
index de2a6036598..d19ef3edb16 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/Grid.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/Grid.jsx
@@ -30,11 +30,13 @@ function setTooltipContent(o) {
return (
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/Hex.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/Hex.jsx
index cd99138028f..a3c430acb19 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/Hex.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/Hex.jsx
@@ -30,11 +30,12 @@ function setTooltipContent(o) {
return (
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts
index eee7c341a19..2f9293c5218 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts
@@ -22,7 +22,6 @@ import {
sections,
} from '@superset-ui/chart-controls';
import { t } from '@superset-ui/core';
-import { formatSelectOptions } from '../../utilities/utils';
import {
autozoom,
extruded,
@@ -71,20 +70,20 @@ const config: ControlPanelConfig = {
default: 'sum',
clearable: false,
renderTrigger: true,
- choices: formatSelectOptions([
- 'sum',
- 'min',
- 'max',
- 'mean',
- 'median',
- 'count',
- 'variance',
- 'deviation',
- 'p1',
- 'p5',
- 'p95',
- 'p99',
- ]),
+ choices: [
+ ['sum', t('sum')],
+ ['min', t('min')],
+ ['max', t('max')],
+ ['mean', t('mean')],
+ ['median', t('median')],
+ ['count', t('count')],
+ ['variance', t('variance')],
+ ['deviation', t('deviation')],
+ ['p1', t('p1')],
+ ['p5', t('p5')],
+ ['p95', t('p95')],
+ ['p99', t('p99')],
+ ],
},
},
],
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/controlPanel.ts
index 99866115ab0..cdbb06746bc 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/controlPanel.ts
@@ -52,8 +52,8 @@ const config: ControlPanelConfig = {
config: {
...lineType.config,
choices: [
- ['polyline', 'Polyline'],
- ['json', 'JSON'],
+ ['polyline', t('Polyline')],
+ ['json', t('JSON')],
],
},
},
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.jsx
index bdd4f66bc11..125518da68c 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.jsx
@@ -22,6 +22,7 @@
/* eslint no-underscore-dangle: ["error", { "allow": ["", "__timestamp"] }] */
import React from 'react';
+import { t } from '@superset-ui/core';
import PropTypes from 'prop-types';
import { PolygonLayer } from 'deck.gl';
@@ -57,7 +58,11 @@ function setTooltipContent(formData) {
return (
{o.object.name && (
-
+
)}
{o.object[formData.line_column] && (
{o.object.cat_color && (
)}
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/controlPanel.ts
index 4932019bb7a..96bdd9e2540 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/controlPanel.ts
@@ -80,12 +80,12 @@ const config: ControlPanelConfig = {
default: 'square_m',
clearable: false,
choices: [
- ['square_m', 'Square meters'],
- ['square_km', 'Square kilometers'],
- ['square_miles', 'Square miles'],
- ['radius_m', 'Radius in meters'],
- ['radius_km', 'Radius in kilometers'],
- ['radius_miles', 'Radius in miles'],
+ ['square_m', t('Square meters')],
+ ['square_km', t('Square kilometers')],
+ ['square_miles', t('Square miles')],
+ ['radius_m', t('Radius in meters')],
+ ['radius_km', t('Radius in kilometers')],
+ ['radius_miles', t('Radius in miles')],
],
description: t(
'The unit of measure for the specified point radius',
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.jsx
index ca61ec0b81c..7883dda17ed 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.jsx
@@ -40,10 +40,15 @@ function setTooltipContent(o) {
return (
-
+
);
}
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.jsx
index f665c118eac..b1ef65b70d4 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.jsx
@@ -179,11 +179,11 @@ export const legendPosition = {
clearable: false,
default: 'tr',
choices: [
- [null, 'None'],
- ['tl', 'Top left'],
- ['tr', 'Top right'],
- ['bl', 'Bottom left'],
- ['br', 'Bottom right'],
+ [null, t('None')],
+ ['tl', t('Top left')],
+ ['tr', t('Top right')],
+ ['bl', t('Bottom left')],
+ ['br', t('Bottom right')],
],
renderTrigger: true,
},
@@ -270,7 +270,7 @@ export const extruded = {
label: t('Extruded'),
renderTrigger: true,
default: true,
- description: 'Whether to make the grid 3D',
+ description: t('Whether to make the grid 3D'),
},
};
@@ -347,9 +347,9 @@ export const lineType = {
default: 'json',
description: t('The encoding format of the lines'),
choices: [
- ['polyline', 'Polyline'],
- ['json', 'JSON'],
- ['geohash', 'geohash (square)'],
+ ['polyline', t('Polyline')],
+ ['json', t('JSON')],
+ ['geohash', t('geohash (square)')],
],
},
};
@@ -371,12 +371,12 @@ export const mapboxStyle = {
clearable: false,
renderTrigger: true,
choices: [
- ['mapbox://styles/mapbox/streets-v9', 'Streets'],
- ['mapbox://styles/mapbox/dark-v9', 'Dark'],
- ['mapbox://styles/mapbox/light-v9', 'Light'],
- ['mapbox://styles/mapbox/satellite-streets-v9', 'Satellite Streets'],
- ['mapbox://styles/mapbox/satellite-v9', 'Satellite'],
- ['mapbox://styles/mapbox/outdoors-v9', 'Outdoors'],
+ ['mapbox://styles/mapbox/streets-v9', t('Streets')],
+ ['mapbox://styles/mapbox/dark-v9', t('Dark')],
+ ['mapbox://styles/mapbox/light-v9', t('Light')],
+ ['mapbox://styles/mapbox/satellite-streets-v9', t('Satellite Streets')],
+ ['mapbox://styles/mapbox/satellite-v9', t('Satellite')],
+ ['mapbox://styles/mapbox/outdoors-v9', t('Outdoors')],
],
default: 'mapbox://styles/mapbox/light-v9',
description: t('Base layer map style'),
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts
index c3c08a23c02..d06883a222f 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts
@@ -52,9 +52,9 @@ const config: ControlPanelConfig = {
label: t('Stacked Style'),
renderTrigger: true,
choices: [
- ['stack', 'stack'],
- ['stream', 'stream'],
- ['expand', 'expand'],
+ ['stack', t('stack')],
+ ['stream', t('stream')],
+ ['expand', t('expand')],
],
default: 'stack',
description: '',
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx
index dc04720b1b7..b45d6de31a3 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx
@@ -23,7 +23,6 @@ import { t } from '@superset-ui/core';
import {
ControlPanelSectionConfig,
CustomControlItem,
- formatSelectOptions,
D3_TIME_FORMAT_OPTIONS,
D3_FORMAT_DOCS,
D3_FORMAT_OPTIONS,
@@ -75,7 +74,15 @@ export const leftMargin: CustomControlItem = {
freeForm: true,
clearable: false,
label: t('Left Margin'),
- choices: formatSelectOptions(['auto', 50, 75, 100, 125, 150, 200]),
+ choices: [
+ ['auto', t('auto')],
+ [50, '50'],
+ [75, '75'],
+ [100, '100'],
+ [125, '125'],
+ [150, '150'],
+ [200, '200'],
+ ],
default: 'auto',
renderTrigger: true,
description: t(
@@ -112,14 +119,14 @@ export const lineInterpolation: CustomControlItem = {
type: 'SelectControl',
label: t('Line Style'),
renderTrigger: true,
- choices: formatSelectOptions([
- 'linear',
- 'basis',
- 'cardinal',
- 'monotone',
- 'step-before',
- 'step-after',
- ]),
+ choices: [
+ ['linear', t('linear')],
+ ['basis', t('basis')],
+ ['cardinal', t('cardinal')],
+ ['monotone', t('monotone')],
+ ['step-before', t('step-before')],
+ ['step-after', t('step-after')],
+ ],
default: 'linear',
description: t('Line interpolation as defined by d3.js'),
},
@@ -134,9 +141,9 @@ export const showBrush: CustomControlItem = {
clearable: false,
default: 'auto',
choices: [
- ['yes', 'Yes'],
- ['no', 'No'],
- ['auto', 'Auto'],
+ ['yes', t('Yes')],
+ ['no', t('No')],
+ ['auto', t('Auto')],
],
description: t('Whether to display the time range interactive selector'),
},
@@ -185,7 +192,15 @@ export const bottomMargin: CustomControlItem = {
clearable: false,
freeForm: true,
label: t('Bottom Margin'),
- choices: formatSelectOptions(['auto', 50, 75, 100, 125, 150, 200]),
+ choices: [
+ ['auto', t('auto')],
+ [50, '50'],
+ [75, '75'],
+ [100, '100'],
+ [125, '125'],
+ [150, '150'],
+ [200, '200'],
+ ],
default: 'auto',
renderTrigger: true,
description: t(
@@ -199,7 +214,12 @@ export const xTicksLayout: CustomControlItem = {
config: {
type: 'SelectControl',
label: t('X Tick Layout'),
- choices: formatSelectOptions(['auto', 'flat', '45°', 'staggered']),
+ choices: [
+ ['auto', t('auto')],
+ ['flat', t('flat')],
+ ['45°', '45°'],
+ ['staggered', t('staggered')],
+ ],
default: 'auto',
clearable: false,
renderTrigger: true,
@@ -378,13 +398,13 @@ export const timeSeriesSection: ControlPanelSectionConfig[] = [
type: 'SelectControl',
label: t('Rolling Function'),
default: 'None',
- choices: formatSelectOptions([
- 'None',
- 'mean',
- 'sum',
- 'std',
- 'cumsum',
- ]),
+ choices: [
+ ['None', t('None')],
+ ['mean', t('mean')],
+ ['sum', t('sum')],
+ ['std', t('std')],
+ ['cumsum', t('cumsum')],
+ ],
description: t(
'Defines a rolling window function to apply, works along ' +
'with the [Periods] text box',
@@ -432,20 +452,18 @@ export const timeSeriesSection: ControlPanelSectionConfig[] = [
multi: true,
freeForm: true,
label: t('Time Shift'),
- choices: formatSelectOptions([
- '1 day',
- '1 week',
- '28 days',
- '30 days',
- '52 weeks',
- '1 year',
- '104 weeks',
- '2 years',
- '156 weeks',
- '3 years',
- '208 weeks',
- '4 years',
- ]),
+ choices: [
+ ['1 day', t('1 day')],
+ ['1 week', t('1 week')],
+ ['28 days', t('28 days')],
+ ['30 days', t('30 days')],
+ ['52 weeks', t('52 weeks')],
+ ['1 year', t('1 year')],
+ ['104 weeks', t('104 weeks')],
+ ['2 years', t('2 years')],
+ ['156 weeks', t('156 weeks')],
+ ['3 years', t('3 years')],
+ ],
description: t(
'Overlay one or more timeseries from a ' +
'relative time period. Expects relative time deltas ' +
@@ -485,7 +503,14 @@ export const timeSeriesSection: ControlPanelSectionConfig[] = [
freeForm: true,
label: t('Rule'),
default: null,
- choices: formatSelectOptions(['1T', '1H', '1D', '7D', '1M', '1AS']),
+ choices: [
+ ['1T', t('1T')],
+ ['1H', t('1H')],
+ ['1D', t('1D')],
+ ['7D', t('7D')],
+ ['1M', t('1M')],
+ ['1AS', t('1AS')],
+ ],
description: t('Pandas resample rule'),
},
},
@@ -498,14 +523,14 @@ export const timeSeriesSection: ControlPanelSectionConfig[] = [
freeForm: true,
label: t('Method'),
default: null,
- choices: formatSelectOptions([
- 'asfreq',
- 'bfill',
- 'ffill',
- 'median',
- 'mean',
- 'sum',
- ]),
+ choices: [
+ ['asfreq', t('asfreq')],
+ ['bfill', t('bfill')],
+ ['ffill', t('ffill')],
+ ['median', t('median')],
+ ['mean', t('mean')],
+ ['sum', t('sum')],
+ ],
description: t('Pandas resample method'),
},
},
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Pie/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Pie/controlPanel.ts
index 9145d5a8429..32052ee3d58 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Pie/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Pie/controlPanel.ts
@@ -48,12 +48,12 @@ const config: ControlPanelConfig = {
default: 'key',
renderTrigger: true,
choices: [
- ['key', 'Category Name'],
- ['value', 'Value'],
- ['percent', 'Percentage'],
- ['key_value', 'Category and Value'],
- ['key_percent', 'Category and Percentage'],
- ['key_value_percent', 'Category, Value and Percentage'],
+ ['key', t('Category Name')],
+ ['value', t('Value')],
+ ['percent', t('Percentage')],
+ ['key_value', t('Category and Value')],
+ ['key_percent', t('Category and Percentage')],
+ ['key_value_percent', t('Category, Value and Percentage')],
],
description: t('What should be shown on the label?'),
},
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/TimePivot/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/TimePivot/controlPanel.ts
index 36d6189c054..595d5d4b721 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/TimePivot/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/TimePivot/controlPanel.ts
@@ -56,12 +56,12 @@ const config: ControlPanelConfig = {
freeForm: true,
clearable: false,
choices: [
- ['AS', 'Year (freq=AS)'],
- ['52W-MON', '52 weeks starting Monday (freq=52W-MON)'],
- ['W-SUN', '1 week starting Sunday (freq=W-SUN)'],
- ['W-MON', '1 week starting Monday (freq=W-MON)'],
- ['D', 'Day (freq=D)'],
- ['4W-MON', '4 weeks (freq=4W-MON)'],
+ ['AS', t('Year (freq=AS)')],
+ ['52W-MON', t('52 weeks starting Monday (freq=52W-MON)')],
+ ['W-SUN', t('1 week starting Sunday (freq=W-SUN)')],
+ ['W-MON', t('1 week starting Monday (freq=W-MON)')],
+ ['D', t('Day (freq=D)')],
+ ['4W-MON', t('4 weeks (freq=4W-MON)')],
],
description: t(
`The periodicity over which to pivot time. Users can provide
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx
index b142dd1852e..81e6d201282 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx
@@ -21,7 +21,6 @@ import {
ControlPanelConfig,
D3_FORMAT_DOCS,
D3_TIME_FORMAT_OPTIONS,
- formatSelectOptions,
getStandardizedControls,
sections,
temporalColumnMixin,
@@ -179,13 +178,13 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Rolling Function'),
default: 'None',
- choices: formatSelectOptions([
- 'None',
- 'mean',
- 'sum',
- 'std',
- 'cumsum',
- ]),
+ choices: [
+ ['None', t('None')],
+ ['mean', t('mean')],
+ ['sum', t('sum')],
+ ['std', t('std')],
+ ['cumsum', t('cumsum')],
+ ],
description: t(
'Defines a rolling window function to apply, works along ' +
'with the [Periods] text box',
@@ -234,14 +233,14 @@ const config: ControlPanelConfig = {
label: t('Rule'),
default: null,
choices: [
- ['1T', '1 minutely frequency'],
- ['1H', '1 hourly frequency'],
- ['1D', '1 calendar day frequency'],
- ['7D', '7 calendar day frequency'],
- ['1MS', '1 month start frequency'],
- ['1M', '1 month end frequency'],
- ['1AS', '1 year start frequency'],
- ['1A', '1 year end frequency'],
+ ['1T', t('1 minutely frequency')],
+ ['1H', t('1 hourly frequency')],
+ ['1D', t('1 calendar day frequency')],
+ ['7D', t('7 calendar day frequency')],
+ ['1MS', t('1 month start frequency')],
+ ['1M', t('1 month end frequency')],
+ ['1AS', t('1 year start frequency')],
+ ['1A', t('1 year end frequency')],
],
description: t('Pandas resample rule'),
},
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts
index 9e97459066e..95b8e6d966e 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts
@@ -27,7 +27,6 @@ import {
D3_FORMAT_DOCS,
D3_FORMAT_OPTIONS,
D3_TIME_FORMAT_OPTIONS,
- formatSelectOptions,
sections,
emitFilterControl,
ControlPanelConfig,
@@ -93,12 +92,12 @@ const config: ControlPanelConfig = {
description: t(
'Determines how whiskers and outliers are calculated.',
),
- choices: formatSelectOptions([
- 'Tukey',
- 'Min/max (no outliers)',
- '2/98 percentiles',
- '9/91 percentiles',
- ]),
+ choices: [
+ ['Tukey', t('Tukey')],
+ ['Min/max (no outliers)', t('Min/max (no outliers)')],
+ ['2/98 percentiles', t('2/98 percentiles')],
+ ['9/91 percentiles', t('9/91 percentiles')],
+ ],
},
},
],
@@ -116,13 +115,13 @@ const config: ControlPanelConfig = {
config: {
type: 'SelectControl',
label: t('X Tick Layout'),
- choices: formatSelectOptions([
- 'auto',
- 'flat',
- '45°',
- '90°',
- 'staggered',
- ]),
+ choices: [
+ ['auto', t('auto')],
+ ['flat', t('flat')],
+ ['45°', '45°'],
+ ['90°', '90°'],
+ ['staggered', t('staggered')],
+ ],
default: 'auto',
clearable: false,
renderTrigger: true,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
index a1d3cf79f7f..f8acdcf6bef 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
@@ -87,17 +87,17 @@ const config: ControlPanelConfig = {
default: labelType,
renderTrigger: true,
choices: [
- [EchartsFunnelLabelTypeType.Key, 'Category Name'],
- [EchartsFunnelLabelTypeType.Value, 'Value'],
- [EchartsFunnelLabelTypeType.Percent, 'Percentage'],
- [EchartsFunnelLabelTypeType.KeyValue, 'Category and Value'],
+ [EchartsFunnelLabelTypeType.Key, t('Category Name')],
+ [EchartsFunnelLabelTypeType.Value, t('Value')],
+ [EchartsFunnelLabelTypeType.Percent, t('Percentage')],
+ [EchartsFunnelLabelTypeType.KeyValue, t('Category and Value')],
[
EchartsFunnelLabelTypeType.KeyPercent,
- 'Category and Percentage',
+ t('Category and Percentage'),
],
[
EchartsFunnelLabelTypeType.KeyValuePercent,
- 'Category, Value and Percentage',
+ t('Category, Value and Percentage'),
],
],
description: t('What should be shown on the label?'),
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx
index 619290a6962..6cbed6901bc 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx
@@ -147,13 +147,13 @@ function createCustomizeSection(
renderTrigger: true,
default: seriesType,
choices: [
- [EchartsTimeseriesSeriesType.Line, 'Line'],
- [EchartsTimeseriesSeriesType.Scatter, 'Scatter'],
- [EchartsTimeseriesSeriesType.Smooth, 'Smooth Line'],
- [EchartsTimeseriesSeriesType.Bar, 'Bar'],
- [EchartsTimeseriesSeriesType.Start, 'Step - start'],
- [EchartsTimeseriesSeriesType.Middle, 'Step - middle'],
- [EchartsTimeseriesSeriesType.End, 'Step - end'],
+ [EchartsTimeseriesSeriesType.Line, t('Line')],
+ [EchartsTimeseriesSeriesType.Scatter, t('Scatter')],
+ [EchartsTimeseriesSeriesType.Smooth, t('Smooth Line')],
+ [EchartsTimeseriesSeriesType.Bar, t('Bar')],
+ [EchartsTimeseriesSeriesType.Start, t('Step - start')],
+ [EchartsTimeseriesSeriesType.Middle, t('Step - middle')],
+ [EchartsTimeseriesSeriesType.End, t('Step - end')],
],
description: t('Series chart type (line, bar etc)'),
},
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx
index 1b73b95e7e7..c9f0f79d19e 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx
@@ -101,12 +101,12 @@ const config: ControlPanelConfig = {
default: labelType,
renderTrigger: true,
choices: [
- ['key', 'Category Name'],
- ['value', 'Value'],
- ['percent', 'Percentage'],
- ['key_value', 'Category and Value'],
- ['key_percent', 'Category and Percentage'],
- ['key_value_percent', 'Category, Value and Percentage'],
+ ['key', t('Category Name')],
+ ['value', t('Value')],
+ ['percent', t('Percentage')],
+ ['key_value', t('Category and Value')],
+ ['key_percent', t('Category and Percentage')],
+ ['key_value_percent', t('Category, Value and Percentage')],
],
description: t('What should be shown on the label?'),
},
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 4d03d07373d..32659bb20f6 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx
@@ -108,8 +108,8 @@ const config: ControlPanelConfig = {
default: labelType,
renderTrigger: true,
choices: [
- ['value', 'Value'],
- ['key_value', 'Category and Value'],
+ ['value', t('Value')],
+ ['key_value', t('Category and Value')],
],
description: t('What should be shown on the label?'),
},
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx
index 66bc2d0e79b..2f52bcce591 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx
@@ -72,11 +72,11 @@ const config: ControlPanelConfig = {
renderTrigger: true,
default: seriesType,
choices: [
- [EchartsTimeseriesSeriesType.Line, 'Line'],
- [EchartsTimeseriesSeriesType.Smooth, 'Smooth Line'],
- [EchartsTimeseriesSeriesType.Start, 'Step - start'],
- [EchartsTimeseriesSeriesType.Middle, 'Step - middle'],
- [EchartsTimeseriesSeriesType.End, 'Step - end'],
+ [EchartsTimeseriesSeriesType.Line, t('Line')],
+ [EchartsTimeseriesSeriesType.Smooth, t('Smooth Line')],
+ [EchartsTimeseriesSeriesType.Start, t('Step - start')],
+ [EchartsTimeseriesSeriesType.Middle, t('Step - middle')],
+ [EchartsTimeseriesSeriesType.End, t('Step - end')],
],
description: t('Series chart type (line, bar etc)'),
},
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
index bb628440641..3e1bb68f49d 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
@@ -126,8 +126,8 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
clearable: false,
label: t('AXIS TITLE POSITION'),
renderTrigger: true,
- default: sections.TITLE_POSITION_OPTIONS[0],
- choices: formatSelectOptions(sections.TITLE_POSITION_OPTIONS),
+ default: sections.TITLE_POSITION_OPTIONS[0][0],
+ choices: sections.TITLE_POSITION_OPTIONS,
description: t('Changing this control takes effect instantly'),
visibility: ({ controls }: ControlPanelsContainerProps) =>
isXAxis ? isHorizental(controls) : isVertical(controls),
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx
index 1b7357eaaa1..0fe9f6b5ac8 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx
@@ -71,13 +71,13 @@ const config: ControlPanelConfig = {
renderTrigger: true,
default: seriesType,
choices: [
- [EchartsTimeseriesSeriesType.Line, 'Line'],
- [EchartsTimeseriesSeriesType.Scatter, 'Scatter'],
- [EchartsTimeseriesSeriesType.Smooth, 'Smooth Line'],
- [EchartsTimeseriesSeriesType.Bar, 'Bar'],
- [EchartsTimeseriesSeriesType.Start, 'Step - start'],
- [EchartsTimeseriesSeriesType.Middle, 'Step - middle'],
- [EchartsTimeseriesSeriesType.End, 'Step - end'],
+ [EchartsTimeseriesSeriesType.Line, t('Line')],
+ [EchartsTimeseriesSeriesType.Scatter, t('Scatter')],
+ [EchartsTimeseriesSeriesType.Smooth, t('Smooth Line')],
+ [EchartsTimeseriesSeriesType.Bar, t('Bar')],
+ [EchartsTimeseriesSeriesType.Start, t('Step - start')],
+ [EchartsTimeseriesSeriesType.Middle, t('Step - middle')],
+ [EchartsTimeseriesSeriesType.End, t('Step - end')],
],
description: t('Series chart type (line, bar etc)'),
},
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx
index 8001acc5220..e71e4743352 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx
@@ -70,9 +70,9 @@ const config: ControlPanelConfig = {
renderTrigger: true,
default: EchartsTimeseriesSeriesType.Start,
choices: [
- [EchartsTimeseriesSeriesType.Start, 'Start'],
- [EchartsTimeseriesSeriesType.Middle, 'Middle'],
- [EchartsTimeseriesSeriesType.End, 'End'],
+ [EchartsTimeseriesSeriesType.Start, t('Start')],
+ [EchartsTimeseriesSeriesType.Middle, t('Middle')],
+ [EchartsTimeseriesSeriesType.End, t('End')],
],
description: t(
'Defines whether the step should appear at the beginning, middle or end between two data points',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx
index 2b816b3f25b..befdce1b10d 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx
@@ -97,9 +97,9 @@ const config: ControlPanelConfig = {
default: labelType,
renderTrigger: true,
choices: [
- ['Key', 'Key'],
- ['value', 'Value'],
- ['key_value', 'Category and Value'],
+ ['Key', t('Key')],
+ ['value', t('Value')],
+ ['key_value', t('Category and Value')],
],
description: t('What should be shown on the label?'),
},
diff --git a/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx b/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx
index 479da8ac91b..371b4f48f91 100644
--- a/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx
+++ b/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { SafeMarkdown, styled } from '@superset-ui/core';
+import { SafeMarkdown, styled, t } from '@superset-ui/core';
import Handlebars from 'handlebars';
import moment from 'moment';
import React, { useMemo, useState } from 'react';
@@ -71,7 +71,7 @@ export const HandlebarsViewer = ({
/>
);
}
- return Loading...
;
+ return {t('Loading...')}
;
};
// usage: {{dateFormat my_date format="MMMM YYYY"}}
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx
index a577fb6058d..28d6361507f 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx
@@ -30,7 +30,6 @@ import {
import {
ControlPanelConfig,
D3_TIME_FORMAT_OPTIONS,
- formatSelectOptions,
sections,
sharedControls,
emitFilterControl,
@@ -178,26 +177,29 @@ const config: ControlPanelConfig = {
type: 'SelectControl',
label: t('Aggregation function'),
clearable: false,
- choices: formatSelectOptions([
- 'Count',
- 'Count Unique Values',
- 'List Unique Values',
- 'Sum',
- 'Average',
- 'Median',
- 'Sample Variance',
- 'Sample Standard Deviation',
- 'Minimum',
- 'Maximum',
- 'First',
- 'Last',
- 'Sum as Fraction of Total',
- 'Sum as Fraction of Rows',
- 'Sum as Fraction of Columns',
- 'Count as Fraction of Total',
- 'Count as Fraction of Rows',
- 'Count as Fraction of Columns',
- ]),
+ choices: [
+ ['Count', t('Count')],
+ ['Count Unique Values', t('Count Unique Values')],
+ ['List Unique Values', t('List Unique Values')],
+ ['Sum', t('Sum')],
+ ['Average', t('Average')],
+ ['Median', t('Median')],
+ ['Sample Variance', t('Sample Variance')],
+ ['Sample Standard Deviation', t('Sample Standard Deviation')],
+ ['Minimum', t('Minimum')],
+ ['Maximum', t('Maximum')],
+ ['First', t('First')],
+ ['Last', t('Last')],
+ ['Sum as Fraction of Total', t('Sum as Fraction of Total')],
+ ['Sum as Fraction of Rows', t('Sum as Fraction of Rows')],
+ ['Sum as Fraction of Columns', t('Sum as Fraction of Columns')],
+ ['Count as Fraction of Total', t('Count as Fraction of Total')],
+ ['Count as Fraction of Rows', t('Count as Fraction of Rows')],
+ [
+ 'Count as Fraction of Columns',
+ t('Count as Fraction of Columns'),
+ ],
+ ],
default: 'Sum',
description: t(
'Aggregate function to apply when pivoting and computing the total rows and columns',
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx
index ea036e99e29..ebfc4a25366 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx
@@ -18,6 +18,7 @@
*/
import React from 'react';
+import { t } from '@superset-ui/core';
import PropTypes from 'prop-types';
import { PivotData, flatKey } from './utilities';
import { Styles } from './Styles';
@@ -462,7 +463,7 @@ export class TableRenderer extends React.Component {
true,
)}
>
- Subtotal
+ {t('Subtotal')}
,
);
}
@@ -658,7 +659,7 @@ export class TableRenderer extends React.Component {
true,
)}
>
- Subtotal
+ {t('Subtotal')}
) : null;
@@ -763,7 +764,10 @@ export class TableRenderer extends React.Component {
true,
)}
>
- {`Total (${this.props.aggregatorName})`}
+ {
+ // eslint-disable-next-line prefer-template
+ t('Total') + ` (${this.props.aggregatorName})`
+ }
);
diff --git a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
index 067da596301..af490395f36 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
+++ b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
@@ -513,7 +513,7 @@ export default function TableChart(
},
Header: ({ column: col, onClick, style, onDragStart, onDrop }) => (
{
@@ -60,9 +60,9 @@ const iconMap = {
};
const tooltipTitleMap = {
- pk: 'Primary key',
- fk: 'Foreign key',
- index: 'Index',
+ pk: t('Primary key'),
+ fk: t('Foreign key'),
+ index: t('Index'),
};
export type ColumnKeyTypeType = keyof typeof tooltipTitleMap;
diff --git a/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.tsx b/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.tsx
index ac9e8b2fb45..2fe1e14a078 100644
--- a/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.tsx
+++ b/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.tsx
@@ -86,7 +86,7 @@ const ExploreCtasResultsButton = ({
{' '}
{t('Explore')}
diff --git a/superset-frontend/src/SqlLab/components/ExploreResultsButton/index.tsx b/superset-frontend/src/SqlLab/components/ExploreResultsButton/index.tsx
index 4ab77777367..b3ee748218e 100644
--- a/superset-frontend/src/SqlLab/components/ExploreResultsButton/index.tsx
+++ b/superset-frontend/src/SqlLab/components/ExploreResultsButton/index.tsx
@@ -44,7 +44,7 @@ const ExploreResultsButton = ({
{' '}
{t('Create Chart')}
diff --git a/superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx b/superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx
index 9b45e4b3971..44e180bb274 100644
--- a/superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx
+++ b/superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx
@@ -18,8 +18,7 @@
*/
import React from 'react';
import { useDispatch } from 'react-redux';
-import { styled, useTheme } from '@superset-ui/core';
-
+import { styled, useTheme, t } from '@superset-ui/core';
import { AntdDropdown } from 'src/components';
import { Menu } from 'src/components/Menu';
import Icons from 'src/components/Icons';
@@ -99,7 +98,7 @@ const QueryLimitSelect = ({
trigger={['click']}
>