Skip to content

Commit

Permalink
make some text localizable, mainly in dashboard, explore, datasource …
Browse files Browse the repository at this point in the history
…editor, webpage title (apache#5685)
  • Loading branch information
hitdemo authored and mistercrunch committed Aug 21, 2018
1 parent d0fa279 commit 30b5447
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 19 deletions.
6 changes: 3 additions & 3 deletions superset/assets/src/dashboard/components/AddSliceCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ function AddSliceCard({
<div className="card-title">{sliceName}</div>
<div className="card-body">
<div className="item">
<span>Modified </span>
<span>{t('Modified')} </span>
<span>{lastModified}</span>
</div>
<div className="item">
<span>Visualization </span>
<span>{t('Visualization')} </span>
<span>{visType}</span>
</div>
<div className="item">
<span>Data source </span>
<span>{t('Data source')} </span>
<span // eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: datasourceLink }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import React from 'react';
import { COLUMN_TYPE } from '../../../util/componentTypes';
import { NEW_COLUMN_ID } from '../../../util/constants';
import DraggableNewComponent from './DraggableNewComponent';
import { t } from '../../../../locales';

export default function DraggableNewColumn() {
return (
<DraggableNewComponent
id={NEW_COLUMN_ID}
type={COLUMN_TYPE}
label="Column"
label={t('Column')}
className="fa fa-long-arrow-down"
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import React from 'react';
import { DIVIDER_TYPE } from '../../../util/componentTypes';
import { NEW_DIVIDER_ID } from '../../../util/constants';
import DraggableNewComponent from './DraggableNewComponent';
import { t } from '../../../../locales';

export default function DraggableNewDivider() {
return (
<DraggableNewComponent
id={NEW_DIVIDER_ID}
type={DIVIDER_TYPE}
label="Divider"
label={t('Divider')}
className="divider-placeholder"
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import React from 'react';
import { HEADER_TYPE } from '../../../util/componentTypes';
import { NEW_HEADER_ID } from '../../../util/constants';
import DraggableNewComponent from './DraggableNewComponent';
import { t } from '../../../../locales';

export default function DraggableNewHeader() {
return (
<DraggableNewComponent
id={NEW_HEADER_ID}
type={HEADER_TYPE}
label="Header"
label={t('Header')}
className="fa fa-header"
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import React from 'react';
import { ROW_TYPE } from '../../../util/componentTypes';
import { NEW_ROW_ID } from '../../../util/constants';
import DraggableNewComponent from './DraggableNewComponent';
import { t } from '../../../../locales';

export default function DraggableNewRow() {
return (
<DraggableNewComponent
id={NEW_ROW_ID}
type={ROW_TYPE}
label="Row"
label={t('Row')}
className="fa fa-long-arrow-right"
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import React from 'react';
import { TABS_TYPE } from '../../../util/componentTypes';
import { NEW_TABS_ID } from '../../../util/constants';
import DraggableNewComponent from './DraggableNewComponent';
import { t } from '../../../../locales';

export default function DraggableNewTabs() {
return (
<DraggableNewComponent
id={NEW_TABS_ID}
type={TABS_TYPE}
label="Tabs"
label={t('Tabs')}
className="fa fa-window-restore"
/>
);
Expand Down
10 changes: 5 additions & 5 deletions superset/assets/src/datasource/DatasourceEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function ColumnCollectionTable({
{showExpression &&
<Field
fieldKey="expression"
label="SQL Expression"
label={t('SQL Expression')}
control={<TextControl />}
/>}
<Field
Expand All @@ -72,7 +72,7 @@ function ColumnCollectionTable({
/>}
<Field
fieldKey="python_date_format"
label="Datetime Format"
label={t('Datetime Format')}
descr={
<div>
{t('The pattern of the timestamp format, use ')}
Expand All @@ -89,7 +89,7 @@ function ColumnCollectionTable({
/>
<Field
fieldKey="database_expression"
label="Database Expression"
label={t('Database Expression')}
descr={
<div>
{t(`
Expand Down Expand Up @@ -316,7 +316,7 @@ export class DatasourceEditor extends React.PureComponent {
renderSettingsFieldset() {
const datasource = this.state.datasource;
return (
<Fieldset title="Basic" item={datasource} onChange={this.onDatasourceChange}>
<Fieldset title={t('Basic')} item={datasource} onChange={this.onDatasourceChange}>
<Field
fieldKey="description"
label={t('Description')}
Expand Down Expand Up @@ -356,7 +356,7 @@ export class DatasourceEditor extends React.PureComponent {
renderAdvancedFieldset() {
const datasource = this.state.datasource;
return (
<Fieldset title="Advanced" item={datasource} onChange={this.onDatasourceChange}>
<Fieldset title={t('Advanced')} item={datasource} onChange={this.onDatasourceChange}>
{ this.state.isSqla &&
<Field
fieldKey="sql"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ControlRow from './ControlRow';
import Control from './Control';
import controls from '../controls';
import * as actions from '../actions/exploreActions';
import { t } from '../../locales';

const propTypes = {
actions: PropTypes.object.isRequired,
Expand Down Expand Up @@ -129,11 +130,11 @@ class ControlPanelsContainer extends React.Component {
</Alert>
}
<Tabs id="controlSections">
<Tab eventKey="query" title="Data">
<Tab eventKey="query" title={t('Data')}>
{querySectionsToRender.map(this.renderControlPanelSection)}
</Tab>
{displaySectionsToRender.length > 0 &&
<Tab eventKey="display" title="Style">
<Tab eventKey="display" title={t('Style')}>
{displaySectionsToRender.map(this.renderControlPanelSection)}
</Tab>
}
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/explore/components/SaveModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class SaveModal extends React.Component {
onChange={this.onChange.bind(this, 'saveToDashboardId')}
autoSize={false}
value={this.state.saveToDashboardId}
placeholder="Select Dashboard"
placeholder={t('Select Dashboard')}
/>

<Radio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default class VizTypeControl extends React.PureComponent {
<OverlayTrigger
placement="right"
overlay={
<Tooltip id={'error-tooltip'}>Click to change visualization type</Tooltip>
<Tooltip id={'error-tooltip'}>{t('Click to change visualization type')}</Tooltip>
}
>
<Label onClick={this.toggleModal} style={{ cursor: 'pointer' }}>
Expand Down
4 changes: 2 additions & 2 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ def explore(self, datasource_type=None, datasource_id=None):
if slc:
title = slc.slice_name
else:
title = 'Explore - ' + table_name
title = _('Explore - %(table)s', table=table_name)
return self.render_template(
'superset/basic.html',
bootstrap_data=json.dumps(bootstrap_data),
Expand Down Expand Up @@ -2698,7 +2698,7 @@ def profile(self, username):

return self.render_template(
'superset/basic.html',
title=username + "'s profile",
title=_("%(user)s's profile", user=username),
entry='profile',
bootstrap_data=json.dumps(payload, default=utils.json_iso_dttm_ser),
)
Expand Down

0 comments on commit 30b5447

Please sign in to comment.