From 773d2a54a3fc50b26d55604076b70192607415b7 Mon Sep 17 00:00:00 2001 From: Artem Shumeiko <53895552+artemonsh@users.noreply.github.com> Date: Tue, 7 Feb 2023 19:21:23 +0300 Subject: [PATCH] chore: Localization of superset pt. 3 (#22938) Co-authored-by: Evan Rusackas --- .../src/utils/D3Formatting.ts | 7 +++++++ .../src/Pie/controlPanel.ts | 8 +++----- .../src/BoxPlot/controlPanel.ts | 5 ++--- .../src/Funnel/controlPanel.tsx | 6 +++--- .../src/Pie/controlPanel.tsx | 5 ++--- .../src/Radar/controlPanel.tsx | 5 ++--- .../src/Sunburst/controlPanel.tsx | 5 ++--- .../src/Timeseries/Area/controlPanel.tsx | 6 ++---- .../Timeseries/Regular/Bar/controlPanel.tsx | 9 +++++---- .../Timeseries/Regular/Line/controlPanel.tsx | 9 +++++---- .../Regular/Scatter/controlPanel.tsx | 9 +++++---- .../Regular/SmoothLine/controlPanel.tsx | 9 +++++---- .../src/Timeseries/Step/controlPanel.tsx | 6 ++---- .../src/Timeseries/constants.ts | 5 +++++ .../src/Treemap/controlPanel.tsx | 5 ++--- .../src/SqlLab/components/QueryTable/index.tsx | 15 ++++++++++++++- .../SqlLab/components/TableElement/index.tsx | 3 ++- .../Chart/DrillDetail/DrillDetailMenuItems.tsx | 13 +++++++------ .../src/components/Select/Select.tsx | 1 + .../components/gridComponents/Markdown.jsx | 1 + .../dashboard/util/getSliceHeaderTooltip.tsx | 2 +- .../src/explore/components/ControlHeader.tsx | 2 +- .../src/pages/ChartCreation/index.tsx | 9 +++++---- .../database/DatabaseModal/ExtraOptions.tsx | 2 +- .../views/CRUD/data/dataset/DatasetList.tsx | 2 +- .../src/views/CRUD/welcome/EmptyState.tsx | 18 ++++++++++++++---- 26 files changed, 100 insertions(+), 67 deletions(-) diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts b/superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts index 0e30f82d7b..be703f9734 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts @@ -23,6 +23,13 @@ export const D3_FORMAT_DOCS = t( 'D3 format syntax: https://github.com/d3/d3-format', ); +export const D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT = t( + 'Only applies when "Label Type" is set to show values.', +); +export const D3_NUMBER_FORMAT_DESCRIPTION_PERCENTAGE_TEXT = t( + 'Only applies when "Label Type" is not set to a percentage.', +); + // input choices & options export const D3_FORMAT_OPTIONS: [string, string][] = [ [NumberFormats.SMART_NUMBER, t('Adaptive formatting')], 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 4e174dfe08..ca4bf66062 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 @@ -19,7 +19,9 @@ import { t } from '@superset-ui/core'; import { ControlPanelConfig, + D3_FORMAT_DOCS, D3_FORMAT_OPTIONS, + D3_NUMBER_FORMAT_DESCRIPTION_PERCENTAGE_TEXT, } from '@superset-ui/chart-controls'; import { showLegend } from '../NVD3Controls'; @@ -67,11 +69,7 @@ const config: ControlPanelConfig = { renderTrigger: true, default: 'SMART_NUMBER', choices: D3_FORMAT_OPTIONS, - description: `${t( - 'D3 format syntax: https://github.com/d3/d3-format', - )} ${t( - 'Only applies when the "Label Type" is not set to a percentage.', - )}`, + description: `${D3_FORMAT_DOCS} ${D3_NUMBER_FORMAT_DESCRIPTION_PERCENTAGE_TEXT}`, }, }, ], 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 f1db7534d0..da21e3cfef 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts @@ -25,6 +25,7 @@ import { } from '@superset-ui/core'; import { D3_FORMAT_DOCS, + D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, sections, @@ -137,9 +138,7 @@ const config: ControlPanelConfig = { renderTrigger: true, default: 'SMART_NUMBER', choices: D3_FORMAT_OPTIONS, - description: `${t( - 'D3 format syntax: https://github.com/d3/d3-format', - )} ${t('Only applies when "Label Type" is set to show values.')}`, + description: `${D3_FORMAT_DOCS} ${D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT}`, }, }, ], 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 929069b2ed..203b86e219 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx @@ -21,10 +21,12 @@ import { t } from '@superset-ui/core'; import { ControlPanelConfig, D3_FORMAT_OPTIONS, + D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, sections, sharedControls, ControlStateMapping, getStandardizedControls, + D3_FORMAT_DOCS, } from '@superset-ui/chart-controls'; import { DEFAULT_FORM_DATA, EchartsFunnelLabelTypeType } from './types'; import { legendSection } from '../controls'; @@ -112,9 +114,7 @@ const config: ControlPanelConfig = { renderTrigger: true, default: numberFormat, choices: D3_FORMAT_OPTIONS, - description: `${t( - 'D3 format syntax: https://github.com/d3/d3-format', - )} ${t('Only applies when "Label Type" is set to show values.')}`, + description: `${D3_FORMAT_DOCS} ${D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT}`, }, }, ], 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 1a2d230b74..952419e83b 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx @@ -22,6 +22,7 @@ import { ControlPanelConfig, ControlPanelsContainerProps, D3_FORMAT_DOCS, + D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, sections, @@ -120,9 +121,7 @@ const config: ControlPanelConfig = { renderTrigger: true, default: numberFormat, choices: D3_FORMAT_OPTIONS, - description: `${t( - 'D3 format syntax: https://github.com/d3/d3-format', - )} ${t('Only applies when "Label Type" is set to show values.')}`, + description: `${D3_FORMAT_DOCS} ${D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT}`, tokenSeparators: ['\n', '\t', ';'], }, }, 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 68b9a17345..61ac18209a 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx @@ -27,6 +27,7 @@ import { import { ControlPanelConfig, D3_FORMAT_DOCS, + D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, sections, @@ -137,9 +138,7 @@ const config: ControlPanelConfig = { renderTrigger: true, default: numberFormat, choices: D3_FORMAT_OPTIONS, - description: `${t( - 'D3 format syntax: https://github.com/d3/d3-format. ', - )} ${t('Only applies when "Label Type" is set to show values.')}`, + description: `${D3_FORMAT_DOCS} ${D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT}`, }, }, ], diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/controlPanel.tsx index 2c90dff452..1187fee0a8 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/controlPanel.tsx @@ -22,6 +22,7 @@ import { ControlPanelConfig, ControlPanelsContainerProps, D3_FORMAT_DOCS, + D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, getStandardizedControls, @@ -130,9 +131,7 @@ const config: ControlPanelConfig = { renderTrigger: true, default: numberFormat, choices: D3_FORMAT_OPTIONS, - description: `${t( - 'D3 format syntax: https://github.com/d3/d3-format', - )} ${t('Only applies when "Label Type" is set to show values.')}`, + description: `${D3_FORMAT_DOCS} ${D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT}`, }, }, ], 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 2f52bcce59..82ca0b585d 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 @@ -28,7 +28,7 @@ import { } from '@superset-ui/chart-controls'; import { EchartsTimeseriesSeriesType } from '../types'; -import { DEFAULT_FORM_DATA } from '../constants'; +import { DEFAULT_FORM_DATA, TIME_SERIES_DESCRIPTION_TEXT } from '../constants'; import { legendSection, onlyTotalControl, @@ -182,9 +182,7 @@ const config: ControlPanelConfig = { config: { ...sharedControls.x_axis_time_format, default: 'smart_date', - description: `${D3_TIME_FORMAT_DOCS}. ${t( - 'When using other than adaptive formatting, labels may overlap.', - )}`, + description: `${D3_TIME_FORMAT_DOCS}. ${TIME_SERIES_DESCRIPTION_TEXT}`, }, }, ], 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 ae0dd2409c..509dc6c815 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 @@ -31,7 +31,10 @@ import { } from '@superset-ui/chart-controls'; import { OrientationType } from '../../types'; -import { DEFAULT_FORM_DATA } from '../../constants'; +import { + DEFAULT_FORM_DATA, + TIME_SERIES_DESCRIPTION_TEXT, +} from '../../constants'; import { legendSection, richTooltipSection, @@ -150,9 +153,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { config: { ...sharedControls.x_axis_time_format, default: 'smart_date', - description: `${D3_TIME_FORMAT_DOCS}. ${t( - 'When using other than adaptive formatting, labels may overlap.', - )}`, + description: `${D3_TIME_FORMAT_DOCS}. ${TIME_SERIES_DESCRIPTION_TEXT}`, visibility: ({ controls }: ControlPanelsContainerProps) => isXAxis ? isVertical(controls) : isHorizontal(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 0fe9f6b5ac..0ceb518b88 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 @@ -28,7 +28,10 @@ import { } from '@superset-ui/chart-controls'; import { EchartsTimeseriesSeriesType } from '../../types'; -import { DEFAULT_FORM_DATA } from '../../constants'; +import { + DEFAULT_FORM_DATA, + TIME_SERIES_DESCRIPTION_TEXT, +} from '../../constants'; import { legendSection, richTooltipSection, @@ -169,9 +172,7 @@ const config: ControlPanelConfig = { config: { ...sharedControls.x_axis_time_format, default: 'smart_date', - description: `${D3_TIME_FORMAT_DOCS}. ${t( - 'When using other than adaptive formatting, labels may overlap.', - )}`, + description: `${D3_TIME_FORMAT_DOCS}. ${TIME_SERIES_DESCRIPTION_TEXT}`, }, }, ], diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx index 379840ae3c..9e36db0d3b 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx @@ -27,7 +27,10 @@ import { sharedControls, } from '@superset-ui/chart-controls'; -import { DEFAULT_FORM_DATA } from '../../constants'; +import { + DEFAULT_FORM_DATA, + TIME_SERIES_DESCRIPTION_TEXT, +} from '../../constants'; import { legendSection, richTooltipSection, @@ -112,9 +115,7 @@ const config: ControlPanelConfig = { config: { ...sharedControls.x_axis_time_format, default: 'smart_date', - description: `${D3_TIME_FORMAT_DOCS}. ${t( - 'When using other than adaptive formatting, labels may overlap.', - )}`, + description: `${D3_TIME_FORMAT_DOCS}. ${TIME_SERIES_DESCRIPTION_TEXT}`, }, }, ], diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx index f758249572..bfb7671ddb 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx @@ -27,7 +27,10 @@ import { sharedControls, } from '@superset-ui/chart-controls'; -import { DEFAULT_FORM_DATA } from '../../constants'; +import { + DEFAULT_FORM_DATA, + TIME_SERIES_DESCRIPTION_TEXT, +} from '../../constants'; import { legendSection, richTooltipSection, @@ -111,9 +114,7 @@ const config: ControlPanelConfig = { config: { ...sharedControls.x_axis_time_format, default: 'smart_date', - description: `${D3_TIME_FORMAT_DOCS}. ${t( - 'When using other than adaptive formatting, labels may overlap.', - )}`, + description: `${D3_TIME_FORMAT_DOCS}. ${TIME_SERIES_DESCRIPTION_TEXT}`, }, }, ], 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 e71e474335..6a8e6eef17 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 @@ -28,7 +28,7 @@ import { } from '@superset-ui/chart-controls'; import { EchartsTimeseriesSeriesType } from '../../types'; -import { DEFAULT_FORM_DATA } from '../constants'; +import { DEFAULT_FORM_DATA, TIME_SERIES_DESCRIPTION_TEXT } from '../constants'; import { legendSection, richTooltipSection, @@ -166,9 +166,7 @@ const config: ControlPanelConfig = { config: { ...sharedControls.x_axis_time_format, default: 'smart_date', - description: `${D3_TIME_FORMAT_DOCS}. ${t( - 'When using other than adaptive formatting, labels may overlap.', - )}`, + description: `${D3_TIME_FORMAT_DOCS}. ${TIME_SERIES_DESCRIPTION_TEXT}`, }, }, ], diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts index 67a3b23416..1d7b871944 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts @@ -17,6 +17,7 @@ * under the License. */ import { sections } from '@superset-ui/chart-controls'; +import { t } from '@superset-ui/core'; import { OrientationType, EchartsTimeseriesSeriesType, @@ -63,3 +64,7 @@ export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = { percentageThreshold: 0, orientation: OrientationType.vertical, }; + +export const TIME_SERIES_DESCRIPTION_TEXT: string = t( + 'When using other than adaptive formatting, labels may overlap', +); 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 dbe2e97e6e..e5f4704701 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx @@ -21,6 +21,7 @@ import { t } from '@superset-ui/core'; import { ControlPanelConfig, D3_FORMAT_DOCS, + D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, sections, @@ -113,9 +114,7 @@ const config: ControlPanelConfig = { renderTrigger: true, default: numberFormat, choices: D3_FORMAT_OPTIONS, - description: `${t( - 'D3 format syntax: https://github.com/d3/d3-format. ', - )} ${t('Only applies when "Label Type" is set to show values.')}`, + description: `${D3_FORMAT_DOCS} ${D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT}`, }, }, ], diff --git a/superset-frontend/src/SqlLab/components/QueryTable/index.tsx b/superset-frontend/src/SqlLab/components/QueryTable/index.tsx index 26c395f26a..96e1f4568d 100644 --- a/superset-frontend/src/SqlLab/components/QueryTable/index.tsx +++ b/superset-frontend/src/SqlLab/components/QueryTable/index.tsx @@ -76,17 +76,30 @@ const QueryTable = ({ const theme = useTheme(); const dispatch = useDispatch(); + const QUERY_HISTORY_TABLE_HEADERS_LOCALIZED = { + state: t('State'), + started: t('Started'), + duration: t('Duration'), + progress: t('Progress'), + rows: t('Rows'), + sql: t('SQL'), + results: t('Results'), + actions: t('Actions'), + }; + const setHeaders = (column: string) => { if (column === 'sql') { return column.toUpperCase(); } return column.charAt(0).toUpperCase().concat(column.slice(1)); }; + const columnsOfTable = useMemo( () => columns.map(column => ({ accessor: column, - Header: () => setHeaders(column), + Header: + QUERY_HISTORY_TABLE_HEADERS_LOCALIZED[column] || setHeaders(column), disableSortBy: true, })), [columns], diff --git a/superset-frontend/src/SqlLab/components/TableElement/index.tsx b/superset-frontend/src/SqlLab/components/TableElement/index.tsx index 7d6e1ec6cd..0f1140f9e8 100644 --- a/superset-frontend/src/SqlLab/components/TableElement/index.tsx +++ b/superset-frontend/src/SqlLab/components/TableElement/index.tsx @@ -182,10 +182,11 @@ const TableElement = ({ table, ...props }: TableElementProps) => { const renderControls = () => { let keyLink; + const KEYS_FOR_TABLE_TEXT = t('Keys for table'); if (table?.indexes?.length) { keyLink = ( (
{JSON.stringify(ix, null, '  ')}
))} diff --git a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailMenuItems.tsx b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailMenuItems.tsx index 30f27ed818..6159e212e3 100644 --- a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailMenuItems.tsx +++ b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailMenuItems.tsx @@ -37,6 +37,7 @@ import DrillDetailModal from './DrillDetailModal'; import { getMenuAdjustedY, MENU_ITEM_HEIGHT } from '../utils'; const MENU_PADDING = 4; +const DRILL_TO_DETAIL_TEXT = t('Drill to detail by'); const DisabledMenuItemTooltip = ({ title }: { title: ReactNode }) => ( @@ -163,7 +164,7 @@ const DrillDetailMenuItems = ({ if (!handlesDimensionContextMenu) { drillToDetailByMenuItem = ( - {t('Drill to detail by')} + {DRILL_TO_DETAIL_TEXT} - {t('Drill to detail by')} + {DRILL_TO_DETAIL_TEXT} ); } @@ -195,7 +196,7 @@ const DrillDetailMenuItems = ({
{filters.map((filter, i) => ( @@ -204,7 +205,7 @@ const DrillDetailMenuItems = ({ key={`drill-detail-filter-${i}`} onClick={openModal.bind(null, [filter])} > - {`${t('Drill to detail by')} `} + {`${DRILL_TO_DETAIL_TEXT} `} {filter.formattedVal} ))} @@ -214,7 +215,7 @@ const DrillDetailMenuItems = ({ key="drill-detail-filter-all" onClick={openModal.bind(null, filters)} > - {`${t('Drill to detail by')} `} + {`${DRILL_TO_DETAIL_TEXT} `} {t('all')} )} @@ -226,7 +227,7 @@ const DrillDetailMenuItems = ({ if (handlesDimensionContextMenu && !noAggregations && !filters?.length) { drillToDetailByMenuItem = ( - {t('Drill to detail by')} + {DRILL_TO_DETAIL_TEXT} () => + // TODO: localize `${SELECT_ALL_VALUE} (${formatNumber( NumberFormats.INTEGER, fullSelectOptions.length, diff --git a/superset-frontend/src/dashboard/components/gridComponents/Markdown.jsx b/superset-frontend/src/dashboard/components/gridComponents/Markdown.jsx index 1d358529b5..9febfacf90 100644 --- a/superset-frontend/src/dashboard/components/gridComponents/Markdown.jsx +++ b/superset-frontend/src/dashboard/components/gridComponents/Markdown.jsx @@ -73,6 +73,7 @@ const propTypes = { const defaultProps = {}; +// TODO: localize const MARKDOWN_PLACE_HOLDER = `# ✨Header 1 ## ✨Header 2 ### ✨Header 3 diff --git a/superset-frontend/src/dashboard/util/getSliceHeaderTooltip.tsx b/superset-frontend/src/dashboard/util/getSliceHeaderTooltip.tsx index a34ad61722..57def408b6 100644 --- a/superset-frontend/src/dashboard/util/getSliceHeaderTooltip.tsx +++ b/superset-frontend/src/dashboard/util/getSliceHeaderTooltip.tsx @@ -33,7 +33,7 @@ export const getSliceHeaderTooltip = (sliceName: string | undefined) => { : t('Click to edit chart.'); const secondLine = t( 'Use %s to open in a new tab.', - isMac ? '⌘ + click' : 'ctrl + click', + isMac ? t('⌘ + click') : t('ctrl + click'), ); return ( <> diff --git a/superset-frontend/src/explore/components/ControlHeader.tsx b/superset-frontend/src/explore/components/ControlHeader.tsx index 71f0f4b838..3bc16d94a5 100644 --- a/superset-frontend/src/explore/components/ControlHeader.tsx +++ b/superset-frontend/src/explore/components/ControlHeader.tsx @@ -105,7 +105,7 @@ const ControlHeader: FC = ({ {description && ( diff --git a/superset-frontend/src/pages/ChartCreation/index.tsx b/superset-frontend/src/pages/ChartCreation/index.tsx index bea530fd3a..2a01a9123a 100644 --- a/superset-frontend/src/pages/ChartCreation/index.tsx +++ b/superset-frontend/src/pages/ChartCreation/index.tsx @@ -335,19 +335,20 @@ export class ChartCreation extends React.PureComponent< render() { const isButtonDisabled = this.isBtnDisabled(); + const VIEW_INSTRUCTIONS_TEXT = t('view instructions'); const datasetHelpText = this.state.canCreateDataset ? ( - {t('Add a dataset')} + {t('Add a dataset')}{' '} - {` ${t('or')} `} + {t('or')}{' '} - {`${t('view instructions')} `} + {`${VIEW_INSTRUCTIONS_TEXT} `} . @@ -359,7 +360,7 @@ export class ChartCreation extends React.PureComponent< rel="noopener noreferrer" target="_blank" > - {`${t('View instructions')} `} + {`${VIEW_INSTRUCTIONS_TEXT} `} . diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx index 6077c288a5..f50d7597f2 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx @@ -218,7 +218,7 @@ const ExtraOptions = ({

{t('Performance')}

- Adjust performance settings of this database. + {t('Adjust performance settings of this database.')}

} diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx index 0906776506..594973389a 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx +++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx @@ -332,7 +332,7 @@ const DatasetList: FunctionComponent = ({ row: { original: { kind }, }, - }: any) => kind[0]?.toUpperCase() + kind.slice(1), + }: any) => (kind === 'physical' ? t('Physical') : t('Virtual')), Header: t('Type'), accessor: 'kind', disableSortBy: true, diff --git a/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx b/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx index 9427c537dd..47e7817ae3 100644 --- a/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx +++ b/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx @@ -37,6 +37,18 @@ const welcomeTableEmpty: Record = { [WelcomeTable.SavedQueries]: t('No saved queries yet'), }; +const welcomeTableWillAppear: Record string> = + { + [WelcomeTable.Charts]: (other: string) => + t('%(other)s charts will appear here', { other }), + [WelcomeTable.Dashboards]: (other: string) => + t('%(other)s dashboards will appear here', { other }), + [WelcomeTable.Recents]: (other: string) => + t('%(other)s recents will appear here', { other }), + [WelcomeTable.SavedQueries]: (other: string) => + t('%(other)s saved queries will appear here', { other }), + }; + export interface EmptyStateProps { tableName: WelcomeTable; tab?: string; @@ -97,10 +109,8 @@ export default function EmptyState({ ); } if (tab === TableTab.Other) { - return t('%(other)s %(tableName)s will appear here', { - other: otherTabTitle || t('Other'), - tableName: tableName.toLowerCase(), - }); + const other = otherTabTitle || t('Other'); + return welcomeTableWillAppear[tableName](other); } if (tab === TableTab.Edited) { return t(