superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: make some text localizable, mainly in dashboard, explore, datasource editor, webpage title (#5685)
Date Tue, 21 Aug 2018 17:10:13 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e5360f  make some text localizable, mainly in dashboard, explore, datasource editor,
webpage title (#5685)
5e5360f is described below

commit 5e5360fc11b8c3a54bfbc0013b407b240c66c07b
Author: hitdemo <hit.demo@gmail.com>
AuthorDate: Wed Aug 22 01:10:09 2018 +0800

    make some text localizable, mainly in dashboard, explore, datasource editor, webpage title
(#5685)
---
 superset/assets/src/dashboard/components/AddSliceCard.jsx      |  6 +++---
 .../src/dashboard/components/gridComponents/new/NewColumn.jsx  |  3 ++-
 .../src/dashboard/components/gridComponents/new/NewDivider.jsx |  3 ++-
 .../src/dashboard/components/gridComponents/new/NewHeader.jsx  |  3 ++-
 .../src/dashboard/components/gridComponents/new/NewRow.jsx     |  3 ++-
 .../src/dashboard/components/gridComponents/new/NewTabs.jsx    |  3 ++-
 superset/assets/src/datasource/DatasourceEditor.jsx            | 10 +++++-----
 .../assets/src/explore/components/ControlPanelsContainer.jsx   |  5 +++--
 superset/assets/src/explore/components/SaveModal.jsx           |  2 +-
 .../assets/src/explore/components/controls/VizTypeControl.jsx  |  2 +-
 superset/views/core.py                                         |  4 ++--
 11 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/superset/assets/src/dashboard/components/AddSliceCard.jsx b/superset/assets/src/dashboard/components/AddSliceCard.jsx
index c8266ad..a98546c 100644
--- a/superset/assets/src/dashboard/components/AddSliceCard.jsx
+++ b/superset/assets/src/dashboard/components/AddSliceCard.jsx
@@ -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 }}
             />
diff --git a/superset/assets/src/dashboard/components/gridComponents/new/NewColumn.jsx b/superset/assets/src/dashboard/components/gridComponents/new/NewColumn.jsx
index f624e58..4698736 100644
--- a/superset/assets/src/dashboard/components/gridComponents/new/NewColumn.jsx
+++ b/superset/assets/src/dashboard/components/gridComponents/new/NewColumn.jsx
@@ -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"
     />
   );
diff --git a/superset/assets/src/dashboard/components/gridComponents/new/NewDivider.jsx b/superset/assets/src/dashboard/components/gridComponents/new/NewDivider.jsx
index de07a24..93518db 100644
--- a/superset/assets/src/dashboard/components/gridComponents/new/NewDivider.jsx
+++ b/superset/assets/src/dashboard/components/gridComponents/new/NewDivider.jsx
@@ -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"
     />
   );
diff --git a/superset/assets/src/dashboard/components/gridComponents/new/NewHeader.jsx b/superset/assets/src/dashboard/components/gridComponents/new/NewHeader.jsx
index 50bd600..8acf853 100644
--- a/superset/assets/src/dashboard/components/gridComponents/new/NewHeader.jsx
+++ b/superset/assets/src/dashboard/components/gridComponents/new/NewHeader.jsx
@@ -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"
     />
   );
diff --git a/superset/assets/src/dashboard/components/gridComponents/new/NewRow.jsx b/superset/assets/src/dashboard/components/gridComponents/new/NewRow.jsx
index 81bdc93..7a2ae01 100644
--- a/superset/assets/src/dashboard/components/gridComponents/new/NewRow.jsx
+++ b/superset/assets/src/dashboard/components/gridComponents/new/NewRow.jsx
@@ -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"
     />
   );
diff --git a/superset/assets/src/dashboard/components/gridComponents/new/NewTabs.jsx b/superset/assets/src/dashboard/components/gridComponents/new/NewTabs.jsx
index fd9366b..a77b65e 100644
--- a/superset/assets/src/dashboard/components/gridComponents/new/NewTabs.jsx
+++ b/superset/assets/src/dashboard/components/gridComponents/new/NewTabs.jsx
@@ -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"
     />
   );
diff --git a/superset/assets/src/datasource/DatasourceEditor.jsx b/superset/assets/src/datasource/DatasourceEditor.jsx
index 1bb2082..10523ea 100644
--- a/superset/assets/src/datasource/DatasourceEditor.jsx
+++ b/superset/assets/src/datasource/DatasourceEditor.jsx
@@ -56,7 +56,7 @@ function ColumnCollectionTable({
             {showExpression &&
               <Field
                 fieldKey="expression"
-                label="SQL Expression"
+                label={t('SQL Expression')}
                 control={<TextControl />}
               />}
             <Field
@@ -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 ')}
@@ -89,7 +89,7 @@ function ColumnCollectionTable({
             />
             <Field
               fieldKey="database_expression"
-              label="Database Expression"
+              label={t('Database Expression')}
               descr={
                 <div>
                   {t(`
@@ -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')}
@@ -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"
diff --git a/superset/assets/src/explore/components/ControlPanelsContainer.jsx b/superset/assets/src/explore/components/ControlPanelsContainer.jsx
index 0eac0cf..d188bfe 100644
--- a/superset/assets/src/explore/components/ControlPanelsContainer.jsx
+++ b/superset/assets/src/explore/components/ControlPanelsContainer.jsx
@@ -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,
@@ -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>
             }
diff --git a/superset/assets/src/explore/components/SaveModal.jsx b/superset/assets/src/explore/components/SaveModal.jsx
index 7ff106a..7748cac 100644
--- a/superset/assets/src/explore/components/SaveModal.jsx
+++ b/superset/assets/src/explore/components/SaveModal.jsx
@@ -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
diff --git a/superset/assets/src/explore/components/controls/VizTypeControl.jsx b/superset/assets/src/explore/components/controls/VizTypeControl.jsx
index 74ba759..3fb871e 100644
--- a/superset/assets/src/explore/components/controls/VizTypeControl.jsx
+++ b/superset/assets/src/explore/components/controls/VizTypeControl.jsx
@@ -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' }}>
diff --git a/superset/views/core.py b/superset/views/core.py
index 5e46a0c..64b58b6 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1310,7 +1310,7 @@ class Superset(BaseSupersetView):
         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),
@@ -2698,7 +2698,7 @@ class Superset(BaseSupersetView):
 
         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),
         )


Mime
View raw message