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 explore, query (#5735)
Date Sun, 26 Aug 2018 18:03:05 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 9a6595d  make some text localizable, mainly in explore, query (#5735)
9a6595d is described below

commit 9a6595d0e982456a4def1cefbfdcd4e492c89a39
Author: hitdemo <hit.demo@gmail.com>
AuthorDate: Mon Aug 27 02:02:56 2018 +0800

    make some text localizable, mainly in explore, query (#5735)
---
 .../components/controls/AnnotationLayer.jsx        | 32 +++++++++++-----------
 superset/views/core.py                             |  4 +--
 superset/views/sql_lab.py                          |  6 ++++
 3 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/superset/assets/src/explore/components/controls/AnnotationLayer.jsx b/superset/assets/src/explore/components/controls/AnnotationLayer.jsx
index 9e31e6c..812882c 100644
--- a/superset/assets/src/explore/components/controls/AnnotationLayer.jsx
+++ b/superset/assets/src/explore/components/controls/AnnotationLayer.jsx
@@ -272,20 +272,20 @@ export default class AnnotationLayer extends React.PureComponent {
     let description = '';
     if (requiresQuery(sourceType)) {
       if (sourceType === ANNOTATION_SOURCE_TYPES.NATIVE) {
-        label = 'Annotation Layer';
-        description = 'Select the Annotation Layer you would like to use.';
+        label = t('Annotation Layer');
+        description = t('Select the Annotation Layer you would like to use.');
       } else {
-        label = 'Slice';
-        description = `Use a pre defined Superset Slice as a source for annotations and overlays.

+        label = t('Chart');
+        description = `Use a pre defined Superset Chart as a source for annotations and overlays.

         'your chart must be one of these visualization types:
         '[${getSupportedSourceTypes(annotationType)
             .map(x => vizTypes[x].label).join(', ')}]'`;
       }
     } else if (annotationType === AnnotationTypes.FORMULA) {
-      label = 'Formula';
-      description = `Expects a formula with depending time parameter 'x'
+      label = t('Formula');
+      description = t(`Expects a formula with depending time parameter 'x'
         in milliseconds since epoch. mathjs is used to evaluate the formulas.
-        Example: '2x+5'`;
+        Example: '2x+5'`);
     }
     if (requiresQuery(sourceType)) {
       return (
@@ -300,7 +300,7 @@ export default class AnnotationLayer extends React.PureComponent {
           isLoading={isLoadingOptions}
           value={value}
           onChange={this.handleValue}
-          validationErrors={!value ? ['Mandatory'] : []}
+          validationErrors={!value ? [t('Mandatory')] : []}
         />
       );
     } if (annotationType === AnnotationTypes.FORMULA) {
@@ -314,7 +314,7 @@ export default class AnnotationLayer extends React.PureComponent {
           placeholder=""
           value={value}
           onChange={this.handleValue}
-          validationErrors={this.isValidFormula(value, annotationType) ? ['Bad formula.']
: []}
+          validationErrors={this.isValidFormula(value, annotationType) ? [t('Bad formula.')]
: []}
         />
       );
     }
@@ -530,7 +530,7 @@ export default class AnnotationLayer extends React.PureComponent {
               bsSize="xsmall"
               onClick={() => this.setState({ color: AUTOMATIC_COLOR })}
             >
-              Automatic Color
+              {t('Automatic Color')}
             </Button>
           </div>
         </div>
@@ -545,8 +545,8 @@ export default class AnnotationLayer extends React.PureComponent {
         <CheckboxControl
           hovered
           name="annotation-layer-show-markers"
-          label="Show Markers"
-          description={'Shows or hides markers for the time series'}
+          label={t('Show Markers')}
+          description={t('Shows or hides markers for the time series')}
           value={showMarkers}
           onChange={v => this.setState({ showMarkers: v })}
         />
@@ -555,8 +555,8 @@ export default class AnnotationLayer extends React.PureComponent {
         <CheckboxControl
           hovered
           name="annotation-layer-hide-line"
-          label="Hide Line"
-          description={'Hides the Line for the time series'}
+          label={t('Hide Line')}
+          description={t('Hides the Line for the time series')}
           value={hideLine}
           onChange={v => this.setState({ hideLine: v })}
         />
@@ -612,8 +612,8 @@ export default class AnnotationLayer extends React.PureComponent {
               {!!getSupportedSourceTypes(annotationType).length &&
                 <SelectControl
                   hovered
-                  description="Choose the source of your annotations"
-                  label="Annotation Source"
+                  description={t('Choose the source of your annotations')}
+                  label={t('Annotation Source')}
                   name="annotation-source-type"
                   options={getSupportedSourceTypes(annotationType).map(
                         x => ({ value: x, label: getAnnotationSourceTypeLabels(x) }))}
diff --git a/superset/views/core.py b/superset/views/core.py
index 2e4a8e8..3b22a49 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1431,7 +1431,7 @@ class Superset(BaseSupersetView):
 
     def save_slice(self, slc):
         session = db.session()
-        msg = 'Slice [{}] has been saved'.format(slc.slice_name)
+        msg = _('Chart [{}] has been saved').format(slc.slice_name)
         session.add(slc)
         session.commit()
         flash(msg, 'info')
@@ -1440,7 +1440,7 @@ class Superset(BaseSupersetView):
         session = db.session()
         session.merge(slc)
         session.commit()
-        msg = 'Slice [{}] has been overwritten'.format(slc.slice_name)
+        msg = _('Chart [{}] has been overwritten').format(slc.slice_name)
         flash(msg, 'info')
 
     @api
diff --git a/superset/views/sql_lab.py b/superset/views/sql_lab.py
index faa2f16..f6452b9 100644
--- a/superset/views/sql_lab.py
+++ b/superset/views/sql_lab.py
@@ -18,6 +18,12 @@ from .base import BaseSupersetView, DeleteMixin, SupersetModelView
 
 class QueryView(SupersetModelView):
     datamodel = SQLAInterface(Query)
+
+    list_title = _('List Query')
+    show_title = _('Show Query')
+    add_title = _('Add Query')
+    edit_title = _('Edit Query')
+
     list_columns = ['user', 'database', 'status', 'start_time', 'end_time']
     label_columns = {
         'user': _('User'),


Mime
View raw message