mirror of
https://github.com/apache/superset.git
synced 2026-04-24 18:44:53 +00:00
chore: Localization of superset pt. 2 (#22772)
This commit is contained in:
@@ -1412,7 +1412,7 @@ export function popQuery(queryId) {
|
||||
dbId: queryData.database.id,
|
||||
schema: queryData.schema,
|
||||
sql: queryData.sql,
|
||||
name: `Copy of ${queryData.tab_name}`,
|
||||
name: t('Copy of %s', queryData.tab_name),
|
||||
autorun: false,
|
||||
};
|
||||
return dispatch(addQueryEditor(queryEditorProps));
|
||||
@@ -1422,6 +1422,7 @@ export function popQuery(queryId) {
|
||||
}
|
||||
export function popDatasourceQuery(datasourceKey, sql) {
|
||||
return function (dispatch) {
|
||||
const QUERY_TEXT = t('Query');
|
||||
const datasetId = datasourceKey.split('__')[0];
|
||||
return SupersetClient.get({
|
||||
endpoint: `/api/v1/dataset/${datasetId}?q=(keys:!(none))`,
|
||||
@@ -1429,7 +1430,7 @@ export function popDatasourceQuery(datasourceKey, sql) {
|
||||
.then(({ json }) =>
|
||||
dispatch(
|
||||
addQueryEditor({
|
||||
name: `Query ${json.result.name}`,
|
||||
name: `${QUERY_TEXT} ${json.result.name}`,
|
||||
dbId: json.result.database.id,
|
||||
schema: json.result.schema,
|
||||
autorun: sql !== undefined,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
import React from 'react';
|
||||
import Label from 'src/components/Label';
|
||||
import { STATE_TYPE_MAP } from 'src/SqlLab/constants';
|
||||
import { STATE_TYPE_MAP, STATE_TYPE_MAP_LOCALIZED } from 'src/SqlLab/constants';
|
||||
import { styled, Query } from '@superset-ui/core';
|
||||
|
||||
interface QueryStateLabelProps {
|
||||
@@ -31,6 +31,8 @@ const StyledLabel = styled(Label)`
|
||||
|
||||
export default function QueryStateLabel({ query }: QueryStateLabelProps) {
|
||||
return (
|
||||
<StyledLabel type={STATE_TYPE_MAP[query.state]}>{query.state}</StyledLabel>
|
||||
<StyledLabel type={STATE_TYPE_MAP[query.state]}>
|
||||
{STATE_TYPE_MAP_LOCALIZED[query.state]}
|
||||
</StyledLabel>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -360,8 +360,8 @@ const ResultSet = ({
|
||||
message={t('%(rows)d rows returned', { rows })}
|
||||
onClose={() => setAlertIsOpen(false)}
|
||||
description={t(
|
||||
'The number of rows displayed is limited to %s by the dropdown.',
|
||||
rows,
|
||||
'The number of rows displayed is limited to %(rows)d by the dropdown.',
|
||||
{ rows },
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
STATUS_OPTIONS,
|
||||
STATE_TYPE_MAP,
|
||||
LOCALSTORAGE_MAX_QUERY_AGE_MS,
|
||||
STATUS_OPTIONS_LOCALIZED,
|
||||
} from '../../constants';
|
||||
|
||||
const TAB_HEIGHT = 140;
|
||||
@@ -145,7 +146,7 @@ const SouthPane = ({
|
||||
};
|
||||
const renderOfflineStatus = () => (
|
||||
<Label className="m-r-3" type={STATE_TYPE_MAP[STATUS_OPTIONS.offline]}>
|
||||
{STATUS_OPTIONS.offline}
|
||||
{STATUS_OPTIONS_LOCALIZED.offline}
|
||||
</Label>
|
||||
);
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t } from '@superset-ui/core';
|
||||
|
||||
export const STATE_TYPE_MAP = {
|
||||
offline: 'danger',
|
||||
failed: 'danger',
|
||||
@@ -26,6 +28,16 @@ export const STATE_TYPE_MAP = {
|
||||
success: 'success',
|
||||
};
|
||||
|
||||
export const STATE_TYPE_MAP_LOCALIZED = {
|
||||
offline: t('offline'),
|
||||
failed: t('failed'),
|
||||
pending: t('pending'),
|
||||
fetching: t('fetching'),
|
||||
running: t('running'),
|
||||
stopped: t('stopped'),
|
||||
success: t('success'),
|
||||
};
|
||||
|
||||
export const STATUS_OPTIONS = {
|
||||
success: 'success',
|
||||
failed: 'failed',
|
||||
@@ -34,6 +46,14 @@ export const STATUS_OPTIONS = {
|
||||
pending: 'pending',
|
||||
};
|
||||
|
||||
export const STATUS_OPTIONS_LOCALIZED = {
|
||||
success: t('success'),
|
||||
failed: t('failed'),
|
||||
running: t('running'),
|
||||
offline: t('offline'),
|
||||
pending: t('pending'),
|
||||
};
|
||||
|
||||
export const TIME_OPTIONS = [
|
||||
'now',
|
||||
'1 hour ago',
|
||||
|
||||
Reference in New Issue
Block a user