Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Translations related to the date range filter #26074

Merged
merged 31 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ec6a954
Update JS constants to match python values
Ralkion Nov 21, 2023
9fabc92
Replace improper f("{.}") babel syntax with %(".")
Ralkion Nov 21, 2023
90912d4
POT extraction
Ralkion Nov 21, 2023
cceb689
Translations (not all) added to FR .po file
Ralkion Nov 20, 2023
cd71659
Update FR po file based on POT
Ralkion Nov 21, 2023
4d0b0b8
Ran po2json for FR
Ralkion Nov 21, 2023
297bfd8
Translate value after selection for date label
Ralkion Nov 21, 2023
a844e44
un-fuzzy'd the "Last X" strings
Ralkion Nov 21, 2023
0b0b315
Generate all .po files
Ralkion Nov 21, 2023
052577b
Un-fuzzy all the languages for the new strings
Ralkion Nov 21, 2023
fd4d032
Run po2json for all languages
Ralkion Nov 21, 2023
7db779c
FIx post-merge conflict issues from apache
Ralkion Nov 21, 2023
871b5a7
Re-run babel_update
Ralkion Nov 21, 2023
9ad6b73
pylint: Line too long
Ralkion Nov 21, 2023
a0a494a
pylint: useless supressions
Ralkion Nov 21, 2023
e78cf61
Ran pre-commit
Ralkion Nov 22, 2023
e9b632a
Merge branch 'main' into discussion/25994-date-range-filter
Ralkion Nov 22, 2023
4d5db45
Fix invalid python placeholder formats
Ralkion Nov 22, 2023
047b542
Re-run babel_update.py for python strings
Ralkion Nov 22, 2023
7bc0152
Un-fuzzied translations due to the python formatting fix.
Ralkion Nov 22, 2023
19fd377
Run po2json for updated PO files
Ralkion Nov 22, 2023
e1d2a33
Fix E2E test looking for lowercase 'last year', even after sending up…
Ralkion Nov 22, 2023
b462905
Merge branch 'main' into issue/26061-date-range-filter
Ralkion Nov 22, 2023
5c08316
Merge branch 'main' into issue/26061-date-range-filter
Ralkion Feb 13, 2024
dd92af8
Merge branch 'main' into issue/26061-date-range-filter
Ralkion Feb 16, 2024
b7f30bc
Re-apply french translation updates
Ralkion Feb 16, 2024
93a3cc0
run babel_update
Ralkion Feb 16, 2024
308bbcf
Re-review .po file after babel update
Ralkion Feb 16, 2024
b5fed98
generate the .json files with scripts/po2json.sh
Ralkion Feb 16, 2024
1d9459d
Merge branch 'main' into issue/26061-date-range-filter
Ralkion Feb 21, 2024
cde535a
end-of-line issue
Ralkion Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ describe('Time range filter', () => {
.click()
.then(() => {
cy.get('.ant-radio-group').children().its('length').should('eq', 5);
cy.get('.ant-radio-checked + span').contains('last year');
cy.get('.ant-radio-checked + span').contains('Last year');
cy.get('[data-test=cancel-button]').click();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import React, { forwardRef, ReactNode, RefObject } from 'react';
import { css, styled, useTheme } from '@superset-ui/core';
import { css, styled, useTheme, t } from '@superset-ui/core';
import Icons from 'src/components/Icons';

export type DateLabelProps = {
Expand Down Expand Up @@ -88,7 +88,7 @@ export const DateLabel = forwardRef(
return (
<LabelContainer {...props} tabIndex={0}>
<span className="date-label-content" ref={ref}>
{props.label}
{typeof props.label === 'string' ? t(props.label) : props.label}
</span>
<Icons.CalendarOutlined
iconSize="s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export const FRAME_OPTIONS: SelectOptionType[] = [
];

export const COMMON_RANGE_OPTIONS: SelectOptionType[] = [
{ value: 'Last day', label: t('last day') },
{ value: 'Last week', label: t('last week') },
{ value: 'Last month', label: t('last month') },
{ value: 'Last quarter', label: t('last quarter') },
{ value: 'Last year', label: t('last year') },
{ value: 'Last day', label: t('Last day') },
{ value: 'Last week', label: t('Last week') },
{ value: 'Last month', label: t('Last month') },
{ value: 'Last quarter', label: t('Last quarter') },
{ value: 'Last year', label: t('Last year') },
];
export const COMMON_RANGE_VALUES_SET = new Set(
COMMON_RANGE_OPTIONS.map(({ value }) => value),
Expand Down
6 changes: 4 additions & 2 deletions superset/commands/chart/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ def validate(self) -> None:
if reports := ReportScheduleDAO.find_by_chart_ids(self._model_ids):
report_names = [report.name for report in reports]
raise ChartDeleteFailedReportsExistError(
_("There are associated alerts or reports: %(report_names)s")
% {"report_names": ",".join(report_names)}
_(
"There are associated alerts or reports: %(report_names)s",
report_names=",".join(report_names),
)
)
# Check ownership
for model in self._models:
Expand Down
6 changes: 4 additions & 2 deletions superset/commands/dashboard/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ def validate(self) -> None:
if reports := ReportScheduleDAO.find_by_dashboard_ids(self._model_ids):
report_names = [report.name for report in reports]
raise DashboardDeleteFailedReportsExistError(
_("There are associated alerts or reports: %(report_names)s")
% {"report_names": ",".join(report_names)}
_(
"There are associated alerts or reports: %(report_names)s",
report_names=",".join(report_names),
)
)
# Check ownership
for model in self._models:
Expand Down
6 changes: 4 additions & 2 deletions superset/commands/database/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ def validate(self) -> None:
if reports := ReportScheduleDAO.find_by_database_id(self._model_id):
report_names = [report.name for report in reports]
raise DatabaseDeleteFailedReportsExistError(
_("There are associated alerts or reports: %(report_names)s")
% {"report_names": ",".join(report_names)}
_(
"There are associated alerts or reports: %(report_names)s",
report_names=",".join(report_names),
)
)
# Check if there are datasets for this database
if self._model.tables:
Expand Down
13 changes: 8 additions & 5 deletions superset/commands/database/validate_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ def validate(self) -> None:
if not validators_by_engine or spec.engine not in validators_by_engine:
raise NoValidatorConfigFoundError(
SupersetError(
message=__("no SQL validator is configured for %(engine)s")
% {"engine": spec.engine},
message=__(
"no SQL validator is configured for %(engine_spec)s",
engine_spec=spec.engine,
),
error_type=SupersetErrorType.GENERIC_DB_ENGINE_ERROR,
level=ErrorLevel.ERROR,
),
Expand All @@ -110,9 +112,10 @@ def validate(self) -> None:
SupersetError(
message=__(
"No validator named %(validator_name)s found "
"(configured for the %(engine)s engine)"
)
% {"validator_name": validator_name, "engine": spec.engine},
"(configured for the %(engine_spec)s engine)",
validator_name=validator_name,
engine_spec=spec.engine,
),
error_type=SupersetErrorType.GENERIC_DB_ENGINE_ERROR,
level=ErrorLevel.ERROR,
),
Expand Down
8 changes: 4 additions & 4 deletions superset/commands/report/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,19 @@ def _validate_result(rows: np.recarray[Any, Any]) -> None:
if len(rows) > 1:
raise AlertQueryMultipleRowsError(
message=_(
"Alert query returned more than one row. %(num_rows)s rows returned"
"Alert query returned more than one row. %(num_rows)s rows returned",
num_rows=len(rows),
)
% {"num_rows": len(rows)}
)
# check if query returned more than one column
if len(rows[0]) > 2:
raise AlertQueryMultipleColumnsError(
# len is subtracted by 1 to discard pandas index column
_(
"Alert query returned more than one column. "
"%(num_columns)s columns returned"
"%(num_cols)s columns returned",
num_cols=(len(rows[0]) - 1),
)
% {"num_columns": len(rows[0]) - 1}
)

def _validate_operator(self, rows: np.recarray[Any, Any]) -> None:
Expand Down
Loading
Loading