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

chore(translations): Add missing i18n #17525

Merged
merged 10 commits into from
Nov 27, 2021
Merged
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions superset-frontend/src/SqlLab/actions/sqlLab.js
Original file line number Diff line number Diff line change
@@ -406,9 +406,7 @@ export function postStopQuery(query) {
.then(() => dispatch(stopQuery(query)))
.then(() => dispatch(addSuccessToast(t('Query was stopped.'))))
.catch(() =>
dispatch(
addDangerToast(`${t('Failed at stopping query. ')}'${query.id}'`),
),
dispatch(addDangerToast(t('Failed at stopping query. %s', query.id))),
);
};
}
Original file line number Diff line number Diff line change
@@ -257,9 +257,9 @@ class TabbedSqlEditors extends React.PureComponent {
);
const warning = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? ''
: `${t(
'-- Note: Unless you save your query, these tabs will NOT persist if you clear your cookies or change browsers.',
)}\n\n`;
: t(
'-- Note: Unless you save your query, these tabs will NOT persist if you clear your cookies or change browsers.\n\n',
);
const qe = {
title: t('Untitled Query %s', queryCount),
dbId:
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ function TemplateParamsEditor({
trigger={['hover']}
>
<div role="button">
{`${t('Parameters')} `}
{t('Parameters ')}
<Badge count={paramCount} />
{!isValid && (
<InfoTooltipWithTrigger
Original file line number Diff line number Diff line change
@@ -77,9 +77,12 @@ function DatabaseErrorMessage({

const copyText =
extra && extra.issue_codes
? `${message}
${t('This may be triggered by:')}
${extra.issue_codes.map(issueCode => issueCode.message).join('\n')}`
? t('%(message)s\nThis may be triggered by: \n%(issues)s', {
message,
issues: extra.issue_codes
.map(issueCode => issueCode.message)
.join('\n'),
})
: message;

return (
Original file line number Diff line number Diff line change
@@ -88,9 +88,10 @@ function TimeoutErrorMessage({
</>
);

const copyText = `${subtitle}
${t('This may be triggered by:')}
${extra.issue_codes.map(issueCode => issueCode.message).join('\n')}`;
const copyText = t('%(subtitle)s\nThis may be triggered by:\n %(issue)s', {
subtitle,
issue: extra.issue_codes.map(issueCode => issueCode.message).join('\n'),
});

return (
<ErrorAlert
5 changes: 4 additions & 1 deletion superset-frontend/src/components/Menu/MenuRight.tsx
Original file line number Diff line number Diff line change
@@ -129,7 +129,10 @@ const RightMenu = ({
)}
</SubMenu>
)}
<SubMenu title="Settings" icon={<Icons.TriangleDown iconSize="xl" />}>
<SubMenu
title={t('Settings')}
icon={<Icons.TriangleDown iconSize="xl" />}
>
{settings.map((section, index) => [
<Menu.ItemGroup key={`${section.label}`} title={section.label}>
{section.childs?.map(child => {
4 changes: 1 addition & 3 deletions superset-frontend/src/dashboard/actions/dashboardState.js
Original file line number Diff line number Diff line change
@@ -235,9 +235,7 @@ export function saveDashboardRequest(data, id, saveType) {
getClientErrorObject(response).then(({ error }) =>
dispatch(
addDangerToast(
`${t(
'Sorry, there was an error saving this dashboard: ',
)} ${error}`,
t('Sorry, there was an error saving this dashboard: %s', error),
),
),
),
2 changes: 1 addition & 1 deletion superset-frontend/src/dashboard/components/SliceAdder.jsx
Original file line number Diff line number Diff line change
@@ -253,7 +253,7 @@ class SliceAdder extends React.Component {
value={this.state.sortBy}
onChange={this.handleSelect}
options={Object.entries(KEYS_TO_SORT).map(([key, label]) => ({
label: `${t('Sort by')} ${label}`,
label: t('Sort by %s', label),
value: key,
}))}
placeholder={t('Sort by')}
Original file line number Diff line number Diff line change
@@ -250,7 +250,7 @@ class SliceHeaderControls extends React.PureComponent<
const refreshTooltip = refreshTooltipData.map((item, index) => (
<div key={`tooltip-${index}`}>
{refreshTooltipData.length > 1
? `${t('Query')} ${index + 1}: ${item}`
? t('Query %s: %s', index + 1, item)
: item}
</div>
));
Original file line number Diff line number Diff line change
@@ -156,9 +156,7 @@ const FilterControls: FC<FilterControlsProps> = ({
`}
>
<Collapse.Panel
header={`${t('Filters out of scope')} (${
filtersOutOfScope.length
})`}
header={t('Filters out of scope (%d)', filtersOutOfScope.length)}
key="1"
>
{filtersOutOfScope.map(filter => {
Original file line number Diff line number Diff line change
@@ -60,14 +60,14 @@ export const CALENDAR_RANGE_VALUES_SET = new Set(
);

const GRAIN_OPTIONS = [
{ value: 'second', label: (rel: string) => `${t('Seconds')} ${rel}` },
{ value: 'minute', label: (rel: string) => `${t('Minutes')} ${rel}` },
{ value: 'hour', label: (rel: string) => `${t('Hours')} ${rel}` },
{ value: 'day', label: (rel: string) => `${t('Days')} ${rel}` },
{ value: 'week', label: (rel: string) => `${t('Weeks')} ${rel}` },
{ value: 'month', label: (rel: string) => `${t('Months')} ${rel}` },
{ value: 'quarter', label: (rel: string) => `${t('Quarters')} ${rel}` },
{ value: 'year', label: (rel: string) => `${t('Years')} ${rel}` },
{ value: 'second', label: (rel: string) => t('Seconds %s', rel) },
{ value: 'minute', label: (rel: string) => t('Minutes %s', rel) },
{ value: 'hour', label: (rel: string) => t('Hours %s', rel) },
{ value: 'day', label: (rel: string) => t('Days %s', rel) },
{ value: 'week', label: (rel: string) => t('Weeks %s', rel) },
{ value: 'month', label: (rel: string) => t('Months %s', rel) },
{ value: 'quarter', label: (rel: string) => t('Quarters %s', rel) },
{ value: 'year', label: (rel: string) => t('Years %s', rel) },
];

export const SINCE_GRAIN_OPTIONS: SelectOptionType[] = GRAIN_OPTIONS.map(
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ const SelectAsyncControl = ({
const onError = (response: Response) =>
getClientErrorObject(response).then(e => {
const { error } = e;
addDangerToast(`${t('Error while fetching data')}: ${error}`);
addDangerToast(t('Error while fetching data: %s', error));
});
const loadOptions = () =>
SupersetClient.get({
Original file line number Diff line number Diff line change
@@ -119,8 +119,7 @@ export default function PluginFilterSelect(props: PluginFilterSelectProps) {
const emptyFilter =
enableEmptyFilter && !inverseSelection && !values?.length;

const suffix =
inverseSelection && values?.length ? ` (${t('excluded')})` : '';
const suffix = inverseSelection && values?.length ? t(' (excluded)') : '';

dispatchDataMask({
type: 'filterState',
Original file line number Diff line number Diff line change
@@ -42,9 +42,9 @@ export const hostField = ({
)}
validationMethods={{ onBlur: getValidation }}
errorMessage={validationErrors?.host}
placeholder="e.g. 127.0.0.1"
placeholder={t('e.g. 127.0.0.1')}
className="form-group-w-50"
label="Host"
label={t('Host')}
onChange={changeMethods.onParametersChange}
/>
);
@@ -64,7 +64,7 @@ export const portField = ({
value={db?.parameters?.port as number}
validationMethods={{ onBlur: getValidation }}
errorMessage={validationErrors?.port}
placeholder="e.g. 5432"
placeholder={t('e.g. 5432')}
className="form-group-w-50"
label="Port"
onChange={changeMethods.onParametersChange}
@@ -85,8 +85,8 @@ export const databaseField = ({
value={db?.parameters?.database}
validationMethods={{ onBlur: getValidation }}
errorMessage={validationErrors?.database}
placeholder="e.g. world_population"
label="Database name"
placeholder={t('e.g. world_population')}
label={t('Database name')}
onChange={changeMethods.onParametersChange}
helpText={t('Copy the name of the database you are trying to connect to.')}
/>
@@ -105,8 +105,8 @@ export const usernameField = ({
value={db?.parameters?.username}
validationMethods={{ onBlur: getValidation }}
errorMessage={validationErrors?.username}
placeholder="e.g. Analytics"
label="Username"
placeholder={t('e.g. Analytics')}
label={t('Username')}
onChange={changeMethods.onParametersChange}
/>
);
@@ -126,8 +126,8 @@ export const passwordField = ({
value={db?.parameters?.password}
validationMethods={{ onBlur: getValidation }}
errorMessage={validationErrors?.password}
placeholder="e.g. ********"
label="Password"
placeholder={t('e.g. ********')}
label={t('Password')}
onChange={changeMethods.onParametersChange}
/>
);
@@ -169,8 +169,8 @@ export const queryField = ({
value={db?.query_input || ''}
validationMethods={{ onBlur: getValidation }}
errorMessage={validationErrors?.query}
placeholder="e.g. param1=value1&param2=value2"
label="Additional Parameters"
placeholder={t('e.g. param1=value1&param2=value2')}
label={t('Additional Parameters')}
onChange={changeMethods.onQueryChange}
helpText={t('Add additional custom parameters')}
/>
Loading