From f21ba68a304787a196eb03a31ccd64405e375c72 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt <33317356+villebro@users.noreply.github.com> Date: Mon, 11 Apr 2022 13:02:20 +0300 Subject: [PATCH] chore: clean up dynamic translation strings (#19641) --- .../plugins/plugin-chart-echarts/src/Pie/transformProps.ts | 2 +- superset-frontend/src/dashboard/actions/dashboardLayout.js | 2 +- .../nativeFilters/FiltersConfigModal/Footer/Footer.tsx | 2 +- superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx | 4 ++-- .../src/views/CRUD/annotation/AnnotationList.tsx | 2 +- .../src/views/CRUD/data/database/DatabaseModal/index.tsx | 2 +- superset-frontend/src/views/CRUD/welcome/EmptyState.tsx | 3 +-- 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts index aeeec088b05c4..cf40ce7e1be94 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts @@ -316,7 +316,7 @@ export default function transformProps( type: 'text', ...getTotalValuePadding({ chartPadding, donut, width, height }), style: { - text: t(`Total: ${numberFormatter(totalValue)}`), + text: t('Total: %s', numberFormatter(totalValue)), fontSize: 16, fontWeight: 'bold', }, diff --git a/superset-frontend/src/dashboard/actions/dashboardLayout.js b/superset-frontend/src/dashboard/actions/dashboardLayout.js index e0cbe7aa00c77..8d4b3fa56c944 100644 --- a/superset-frontend/src/dashboard/actions/dashboardLayout.js +++ b/superset-frontend/src/dashboard/actions/dashboardLayout.js @@ -210,7 +210,7 @@ export function handleComponentDrop(dropResult) { destination.id !== rootChildId ) { return dispatch( - addWarningToast(t(`Can not move top level tab into nested tabs`)), + addWarningToast(t('Can not move top level tab into nested tabs')), ); } else if ( destination && diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/Footer.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/Footer.tsx index 4c2f774a62758..aed85af3a2500 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/Footer.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/Footer.tsx @@ -46,7 +46,7 @@ const Footer: FC = ({ onConfirm={onConfirmCancel} onDismiss={onDismiss} > - {t(`Are you sure you want to cancel?`)} + {t('Are you sure you want to cancel?')} ); } diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 7a68b2663fe0e..66b4b390062bb 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -557,7 +557,7 @@ const AlertReportModal: FunctionComponent = ({ return; } - addSuccessToast(t(`${data.type} updated`)); + addSuccessToast(t('%s updated', data.type)); if (onAdd) { onAdd(); @@ -573,7 +573,7 @@ const AlertReportModal: FunctionComponent = ({ return; } - addSuccessToast(t(`${data.type} updated`)); + addSuccessToast(t('%s updated', data.type)); if (onAdd) { onAdd(response); diff --git a/superset-frontend/src/views/CRUD/annotation/AnnotationList.tsx b/superset-frontend/src/views/CRUD/annotation/AnnotationList.tsx index 413373aefce68..c91099a6d59cd 100644 --- a/superset-frontend/src/views/CRUD/annotation/AnnotationList.tsx +++ b/superset-frontend/src/views/CRUD/annotation/AnnotationList.tsx @@ -262,7 +262,7 @@ function AnnotationList({ - {t(`Annotation Layer ${annotationLayerName}`)} + {t('Annotation Layer %s', annotationLayerName)} {hasHistory ? ( Back to all diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index 583b540579e99..dee6f4dd3f9dc 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -1035,7 +1035,7 @@ const DatabaseModal: FunctionComponent = ({ } validationMethods={{ onBlur: () => {} }} errorMessage={validationErrors?.password_needed} - label={t(`${database.slice(10)} PASSWORD`)} + label={t('%s PASSWORD', database.slice(10))} css={formScrollableStyles} /> diff --git a/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx b/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx index 379fbe3995a1d..525c9ef62e803 100644 --- a/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx +++ b/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx @@ -122,11 +122,10 @@ export default function EmptyState({ tableName, tab }: EmptyStateProps) { {tableName === 'SAVED_QUERIES' ? t('SQL query') - : t(`${tableName + : tableName .split('') .slice(0, tableName.length - 1) .join('')} - `)} )}