Skip to content

Commit

Permalink
fix: untranslated text content of Dashboard page (#13024)
Browse files Browse the repository at this point in the history
* fix: fix the untranslated text content of Dashboard page

* fix: add the untranslated text content of Dashboard page in messages.pot

* fix linting error

Co-authored-by: chenx <yuxiang1989>
  • Loading branch information
cdmikechen authored Feb 9, 2021
1 parent d2b0362 commit 4ba98bf
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 13 deletions.
4 changes: 2 additions & 2 deletions superset-frontend/src/components/ListView/CardSortSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React, { useState } from 'react';
import { styled, withTheme, SupersetThemeProps } from '@superset-ui/core';
import { styled, withTheme, SupersetThemeProps, t } from '@superset-ui/core';
import { PartialThemeConfig, Select } from 'src/components/Select';
import { CardSortSelectOption, FetchDataConfig, SortColumn } from './types';
import { filterSelectStyles } from './utils';
Expand Down Expand Up @@ -100,7 +100,7 @@ export const CardSortSelect = ({

return (
<SortContainer>
<SortTitle>Sort:</SortTitle>
<SortTitle>{t('Sort:')}</SortTitle>
<StyledCardSortSelect
onChange={(value: CardSortSelectOption) => handleOnChange(value)}
options={options}
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/components/ListView/ListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ function ListView<T extends object = any>({
<EmptyWrapper className={viewMode}>
<Empty
image={<EmptyImage />}
description={emptyState.message || 'No data'}
description={emptyState.message || t('No Data')}
>
{emptyState.slot || null}
</Empty>
Expand Down
6 changes: 3 additions & 3 deletions superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function DashboardCard({
}
data-test="dashboard-card-option-edit-button"
>
<ListViewCard.MenuIcon name="edit-alt" /> Edit
<ListViewCard.MenuIcon name="edit-alt" /> {t('Edit')}
</Menu.Item>
)}
{canExport && (
Expand All @@ -85,7 +85,7 @@ function DashboardCard({
tabIndex={0}
onClick={() => handleBulkDashboardExport([dashboard])}
>
<ListViewCard.MenuIcon name="share" /> Export
<ListViewCard.MenuIcon name="share" /> {t('Export')}
</Menu.Item>
)}
{canDelete && (
Expand Down Expand Up @@ -117,7 +117,7 @@ function DashboardCard({
onClick={confirmDelete}
data-test="dashboard-card-option-delete-button"
>
<ListViewCard.MenuIcon name="trash" /> Delete
<ListViewCard.MenuIcon name="trash" /> {t('Delete')}
</div>
)}
</ConfirmStatusChange>
Expand Down
14 changes: 7 additions & 7 deletions superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ function DashboardList(props: DashboardListProps) {
id: 'owners',
input: 'select',
operator: FilterOperators.relationManyMany,
unfilteredLabel: 'All',
unfilteredLabel: t('All'),
fetchSelects: createFetchRelated(
'dashboard',
'owners',
Expand All @@ -382,7 +382,7 @@ function DashboardList(props: DashboardListProps) {
id: 'created_by',
input: 'select',
operator: FilterOperators.relationOneMany,
unfilteredLabel: 'All',
unfilteredLabel: t('All'),
fetchSelects: createFetchRelated(
'dashboard',
'created_by',
Expand All @@ -403,7 +403,7 @@ function DashboardList(props: DashboardListProps) {
id: 'published',
input: 'select',
operator: FilterOperators.equals,
unfilteredLabel: 'Any',
unfilteredLabel: t('Any'),
selects: [
{ label: t('Published'), value: true },
{ label: t('Unpublished'), value: false },
Expand All @@ -415,7 +415,7 @@ function DashboardList(props: DashboardListProps) {
urlDisplay: 'favorite',
input: 'select',
operator: FilterOperators.dashboardIsFav,
unfilteredLabel: 'Any',
unfilteredLabel: t('Any'),
selects: [
{ label: t('Yes'), value: true },
{ label: t('No'), value: false },
Expand All @@ -433,19 +433,19 @@ function DashboardList(props: DashboardListProps) {
{
desc: false,
id: 'dashboard_title',
label: 'Alphabetical',
label: t('Alphabetical'),
value: 'alphabetical',
},
{
desc: true,
id: 'changed_on_delta_humanized',
label: 'Recently modified',
label: t('Recently modified'),
value: 'recently_modified',
},
{
desc: false,
id: 'changed_on_delta_humanized',
label: 'Least recently modified',
label: t('Least recently modified'),
value: 'least_recently_modified',
},
];
Expand Down
29 changes: 29 additions & 0 deletions superset/translations/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2342,6 +2342,7 @@ msgstr ""
#: superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx:444
#: superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx:230
#: superset/views/base.py:446
#: superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx:120
msgid "Delete"
msgstr ""

Expand Down Expand Up @@ -2783,6 +2784,7 @@ msgstr ""
#: superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx:346
#: superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx:600
#: superset/views/dashboard/views.py:66
#: superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx:88
msgid "Export"
msgstr ""

Expand Down Expand Up @@ -3545,6 +3547,7 @@ msgstr ""
#: superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx:329
#: superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx:362
#: superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx:211
#: superset-frontend/src/views/CRUD/dashboard/DashboardCard.tsx:79
msgid "Edit"
msgstr ""

Expand Down Expand Up @@ -7739,3 +7742,29 @@ msgstr ""
#: superset-frontend/src/visualizations/TimeTable/TimeTableChartPlugin.js:24
msgid "Time-series Table"
msgstr ""

#: superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx:385
#: superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx:364
msgid "All"
msgstr ""

#: superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx:406
#: superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx:418
msgid "Any"
msgstr ""

#: superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx:436
msgid "Alphabetical"
msgstr ""

#: superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx:442
msgid "Recently modified"
msgstr ""

#: superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx:448
msgid "Least recently modified"
msgstr ""

#: superset-frontend/src/components/ListView/ListView.tsx:393
msgid "No Data"
msgstr ""

0 comments on commit 4ba98bf

Please sign in to comment.