You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/08/12 12:58:04 UTC

[GitHub] hitdemo closed pull request #5607: make some text localizable

hitdemo closed pull request #5607: make some text localizable
URL: https://github.com/apache/incubator-superset/pull/5607
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/src/dashboard/components/SliceAdder.jsx b/superset/assets/src/dashboard/components/SliceAdder.jsx
index f237a06dd2..31ad79745c 100644
--- a/superset/assets/src/dashboard/components/SliceAdder.jsx
+++ b/superset/assets/src/dashboard/components/SliceAdder.jsx
@@ -12,6 +12,7 @@ import Loading from '../../components/Loading';
 import { CHART_TYPE, NEW_COMPONENT_SOURCE_TYPE } from '../util/componentTypes';
 import { NEW_CHART_ID, NEW_COMPONENTS_SOURCE_ID } from '../util/constants';
 import { slicePropShape } from '../util/propShapes';
+import { t } from '../../locales';
 
 const propTypes = {
   fetchAllSlices: PropTypes.func.isRequired,
@@ -204,7 +205,7 @@ class SliceAdder extends React.Component {
       <div className="slice-adder-container">
         <div className="controls">
           <SearchInput
-            placeholder="Filter your charts"
+            placeholder={t('Filter your charts')}
             className="search-input"
             onChange={this.searchUpdated}
             onKeyPress={this.handleKeyPress}
diff --git a/superset/assets/src/dashboard/components/gridComponents/new/DraggableNewComponent.jsx b/superset/assets/src/dashboard/components/gridComponents/new/DraggableNewComponent.jsx
index d579dc1624..543b4eca41 100644
--- a/superset/assets/src/dashboard/components/gridComponents/new/DraggableNewComponent.jsx
+++ b/superset/assets/src/dashboard/components/gridComponents/new/DraggableNewComponent.jsx
@@ -6,6 +6,8 @@ import DragDroppable from '../../dnd/DragDroppable';
 import { NEW_COMPONENTS_SOURCE_ID } from '../../../util/constants';
 import { NEW_COMPONENT_SOURCE_TYPE } from '../../../util/componentTypes';
 
+import { t } from '../../../../locales';
+
 const propTypes = {
   id: PropTypes.string.isRequired,
   type: PropTypes.string.isRequired,
@@ -34,7 +36,7 @@ export default class DraggableNewComponent extends React.PureComponent {
         {({ dragSourceRef }) => (
           <div ref={dragSourceRef} className="new-component">
             <div className={cx('new-component-placeholder', className)} />
-            {label}
+            {t(label)}
           </div>
         )}
       </DragDroppable>
diff --git a/superset/assets/src/explore/components/DisplayQueryButton.jsx b/superset/assets/src/explore/components/DisplayQueryButton.jsx
index e098643af5..ec30c5bda2 100644
--- a/superset/assets/src/explore/components/DisplayQueryButton.jsx
+++ b/superset/assets/src/explore/components/DisplayQueryButton.jsx
@@ -142,7 +142,7 @@ export default class DisplayQueryButton extends React.PureComponent {
         <ModalTrigger
           isMenuItem
           animation={this.props.animation}
-          triggerNode={<span>View query</span>}
+          triggerNode={<span>{t('View query')}</span>}
           modalTitle={t('View query')}
           bsSize="large"
           beforeOpen={this.beforeOpen}
@@ -152,7 +152,7 @@ export default class DisplayQueryButton extends React.PureComponent {
         <ModalTrigger
           isMenuItem
           animation={this.props.animation}
-          triggerNode={<span>View results</span>}
+          triggerNode={<span>{t('View results')}</span>}
           modalTitle={t('View results')}
           bsSize="large"
           beforeOpen={this.beforeOpen}
@@ -163,7 +163,7 @@ export default class DisplayQueryButton extends React.PureComponent {
           eventKey="3"
           onClick={this.redirectSQLLab.bind(this)}
         >
-          Run in SQL Lab
+          {t('Run in SQL Lab')}
         </MenuItem>}
       </DropdownButton>
     );
diff --git a/superset/assets/src/explore/components/controls/AnnotationLayer.jsx b/superset/assets/src/explore/components/controls/AnnotationLayer.jsx
index 6cb2f2d209..9e31e6c856 100644
--- a/superset/assets/src/explore/components/controls/AnnotationLayer.jsx
+++ b/superset/assets/src/explore/components/controls/AnnotationLayer.jsx
@@ -26,6 +26,8 @@ import ControlHeader from '../ControlHeader';
 import { nonEmpty } from '../../validators';
 import vizTypes from '../../visTypes';
 
+import { t } from '../../../locales';
+
 const AUTOMATIC_COLOR = '';
 
 const propTypes = {
@@ -485,12 +487,12 @@ export default class AnnotationLayer extends React.PureComponent {
       <PopoverSection
         isSelected
         onSelect={() => {}}
-        title="Display configuration"
-        info="Configure your how you overlay is displayed here."
+        title={t('Display configuration')}
+        info={t('Configure your how you overlay is displayed here.')}
       >
         <SelectControl
           name="annotation-layer-stroke"
-          label="Style"
+          label={t('Style')}
             // see '../../../visualizations/nvd3_vis.css'
           options={[
               { value: 'solid', label: 'Solid' },
@@ -503,7 +505,7 @@ export default class AnnotationLayer extends React.PureComponent {
         />
         <SelectControl
           name="annotation-layer-opacity"
-          label="Opacity"
+          label={t('Opacity')}
             // see '../../../visualizations/nvd3_vis.css'
           options={[
               { value: '', label: 'Solid' },
@@ -515,7 +517,7 @@ export default class AnnotationLayer extends React.PureComponent {
           onChange={v => this.setState({ opacity: v })}
         />
         <div>
-          <ControlHeader label="Color" />
+          <ControlHeader label={t('Color')} />
           <div style={{ display: 'flex', flexDirection: 'column' }}>
             <CompactPicker
               color={color}
@@ -534,7 +536,7 @@ export default class AnnotationLayer extends React.PureComponent {
         </div>
         <TextControl
           name="annotation-layer-stroke-width"
-          label="Line Width"
+          label={t('Line Width')}
           isInt
           value={width}
           onChange={v => this.setState({ width: v })}
@@ -580,27 +582,27 @@ export default class AnnotationLayer extends React.PureComponent {
             <PopoverSection
               isSelected
               onSelect={() => {}}
-              title="Layer Configuration"
-              info="Configure the basics of your Annotation Layer."
+              title={t('Layer Configuration')}
+              info={t('Configure the basics of your Annotation Layer.')}
             >
               <TextControl
                 name="annotation-layer-name"
-                label="Name"
+                label={t('Name')}
                 placeholder=""
                 value={name}
                 onChange={v => this.setState({ name: v })}
-                validationErrors={!name ? ['Mandatory'] : []}
+                validationErrors={!name ? [t('Mandatory')] : []}
               />
               <CheckboxControl
                 name="annotation-layer-hide"
-                label="Hide Layer"
+                label={t('Hide Layer')}
                 value={!show}
                 onChange={v => this.setState({ show: !v })}
               />
               <SelectControl
                 hovered
-                description="Choose the Annotation Layer Type"
-                label="Annotation Layer Type"
+                description={t('Choose the Annotation Layer Type')}
+                label={t('Annotation Layer Type')}
                 name="annotation-layer-type"
                 options={getSupportedAnnotationTypes(this.props.vizType).map(
                     x => ({ value: x, label: getAnnotationTypeLabel(x) }))}
@@ -630,7 +632,7 @@ export default class AnnotationLayer extends React.PureComponent {
             bsSize="sm"
             onClick={this.deleteAnnotation}
           >
-            { !isNew ? 'Remove' : 'Cancel' }
+            { !isNew ? t('Remove') : t('Cancel') }
           </Button>
           <div>
             <Button
@@ -638,7 +640,7 @@ export default class AnnotationLayer extends React.PureComponent {
               disabled={!isValid}
               onClick={this.applyAnnotation}
             >
-              Apply
+              {t('Apply')}
             </Button>
 
             <Button
@@ -646,7 +648,7 @@ export default class AnnotationLayer extends React.PureComponent {
               disabled={!isValid}
               onClick={this.submitAnnotation}
             >
-              OK
+              {t('OK')}
             </Button>
           </div>
         </div>
diff --git a/superset/assets/src/explore/components/controls/AnnotationLayerControl.jsx b/superset/assets/src/explore/components/controls/AnnotationLayerControl.jsx
index 3e4cd24e31..b33dab0195 100644
--- a/superset/assets/src/explore/components/controls/AnnotationLayerControl.jsx
+++ b/superset/assets/src/explore/components/controls/AnnotationLayerControl.jsx
@@ -75,7 +75,7 @@ class AnnotationLayerControl extends React.PureComponent {
     return (
       <Popover
         style={{ maxWidth: 'none' }}
-        title={annotation ? 'Edit Annotation Layer' : 'Add Annotation Layer'}
+        title={annotation ? t('Edit Annotation Layer') : t('Add Annotation Layer')}
         id={`annotation-pop-${id}`}
       >
         <AnnotationLayer
diff --git a/superset/assets/src/explore/visTypes.jsx b/superset/assets/src/explore/visTypes.jsx
index f9cc723eeb..acddf3e4ec 100644
--- a/superset/assets/src/explore/visTypes.jsx
+++ b/superset/assets/src/explore/visTypes.jsx
@@ -67,11 +67,11 @@ export const sections = {
       'that allow for advanced analytical post processing ' +
       'of query results'),
       controlSetRows: [
-        [<h1 className="section-header">Moving Average</h1>],
+        [<h1 className="section-header">{t('Moving Average')}</h1>],
         ['rolling_type', 'rolling_periods', 'min_periods'],
-        [<h1 className="section-header">Time Comparison</h1>],
+        [<h1 className="section-header">{t('Time Comparison')}</h1>],
         ['time_compare', 'comparison_type'],
-        [<h1 className="section-header">Python Functions</h1>],
+        [<h1 className="section-header">{t('Python Functions')}</h1>],
         [<h2 className="section-header">pandas.resample</h2>],
         ['resample_how', 'resample_rule', 'resample_fillmethod'],
       ],
@@ -1833,7 +1833,7 @@ export const visTypes = {
   },
 
   partition: {
-    label: 'Partition Diagram',
+    label: t('Partition Diagram'),
     showOnExplore: true,
     controlPanelSections: [
       sections.NVD3TimeSeries[0],
diff --git a/superset/connectors/druid/views.py b/superset/connectors/druid/views.py
index 5e5ba0da93..cc0cea9a08 100644
--- a/superset/connectors/druid/views.py
+++ b/superset/connectors/druid/views.py
@@ -56,6 +56,8 @@ class DruidColumnInlineView(CompactCRUDMixin, SupersetModelView):  # noqa
         'sum': _('Sum'),
         'min': _('Min'),
         'max': _('Max'),
+        'verbose_name': _('Verbose Name'),
+        'description': _('Description'),
     }
     description_columns = {
         'filterable': _(
@@ -137,6 +139,7 @@ class DruidMetricInlineView(CompactCRUDMixin, SupersetModelView):  # noqa
         'json': _('JSON'),
         'datasource': _('Druid Datasource'),
         'warning_text': _('Warning Message'),
+        'is_restricted': _('Is Restricted'),
     }
 
     def post_add(self, metric):
@@ -175,6 +178,9 @@ class DruidClusterModelView(SupersetModelView, DeleteMixin, YamlExportMixin):  #
         'broker_host': _('Broker Host'),
         'broker_port': _('Broker Port'),
         'broker_endpoint': _('Broker Endpoint'),
+        'verbose_name': _('Verbose Name'),
+        'cache_timeout': _('Cache Timeout'),
+        'metadata_last_refreshed': _('Metadata Last Refreshed'),
     }
     description_columns = {
         'cache_timeout': _(
@@ -272,6 +278,10 @@ class DruidDatasourceModelView(DatasourceModelView, DeleteMixin, YamlExportMixin
         'default_endpoint': _('Default Endpoint'),
         'offset': _('Time Offset'),
         'cache_timeout': _('Cache Timeout'),
+        'datasource_name': _('Datasource Name'),
+        'fetch_values_from': _('Fetch Values From'),
+        'changed_by_': _('Changed By'),
+        'modified': _('Modified'),
     }
 
     def pre_add(self, datasource):
diff --git a/superset/connectors/sqla/views.py b/superset/connectors/sqla/views.py
index 45143616de..2766385d51 100644
--- a/superset/connectors/sqla/views.py
+++ b/superset/connectors/sqla/views.py
@@ -242,6 +242,7 @@ class TableModelView(DatasourceModelView, DeleteMixin, YamlExportMixin):  # noqa
         'description': _('Description'),
         'is_sqllab_view': _('SQL Lab View'),
         'template_params': _('Template parameters'),
+        'modified': _('Modified'),
     }
 
     def pre_add(self, table):
diff --git a/superset/views/annotations.py b/superset/views/annotations.py
index e2aaf888da..fe16747099 100644
--- a/superset/views/annotations.py
+++ b/superset/views/annotations.py
@@ -7,6 +7,7 @@
 
 from flask_appbuilder.models.sqla.interface import SQLAInterface
 from flask_babel import gettext as __
+from flask_babel import lazy_gettext as _
 
 from superset import appbuilder
 from superset.models.annotations import Annotation, AnnotationLayer
@@ -15,11 +16,25 @@
 
 class AnnotationModelView(SupersetModelView, DeleteMixin):  # noqa
     datamodel = SQLAInterface(Annotation)
+
+    list_title = _('List Annotation')
+    show_title = _('Show Annotation')
+    add_title = _('Add Annotation')
+    edit_title = _('Edit Annotation')
+
     list_columns = ['layer', 'short_descr', 'start_dttm', 'end_dttm']
     edit_columns = [
         'layer', 'short_descr', 'long_descr', 'start_dttm', 'end_dttm']
     add_columns = edit_columns
 
+    label_columns = {
+        'layer': _('Layer'),
+        'short_descr': _('Short Descr'),
+        'start_dttm': _('Start Dttm'),
+        'end_dttm': _('End Dttm'),
+        'long_descr': _('Long Descr'),
+    }
+
     def pre_add(self, obj):
         if not obj.layer:
             raise Exception('Annotation layer is required.')
@@ -38,10 +53,20 @@ def pre_update(self, obj):
 
 class AnnotationLayerModelView(SupersetModelView, DeleteMixin):
     datamodel = SQLAInterface(AnnotationLayer)
+
+    list_title = _('List Annotation Layer')
+    show_title = _('Show Annotation Layer')
+    add_title = _('Add Annotation Layer')
+    edit_title = _('Edit Annotation Layer')
+
     list_columns = ['id', 'name']
     edit_columns = ['name', 'descr']
     add_columns = edit_columns
 
+    label_columns = {
+        'name': _('Name'),
+        'descr': _('Description'),
+    }
 
 appbuilder.add_view(
     AnnotationLayerModelView,
diff --git a/superset/views/core.py b/superset/views/core.py
index e6f29039e7..71f6ff1f21 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -240,6 +240,10 @@ class DatabaseView(SupersetModelView, DeleteMixin, YamlExportMixin):  # noqa
         'allow_run_sync': _('Allow Run Sync'),
         'allow_run_async': _('Allow Run Async'),
         'impersonate_user': _('Impersonate the logged on user'),
+        'allow_csv_upload': _('Allow Csv Upload'),
+        'modified': _('Modified'),
+        'allow_multi_schema_metadata_fetch': _('Allow Multi Schema Metadata Fetch'),
+        'backend': _('Backend'),
     }
 
     def pre_add(self, db):
@@ -624,6 +628,12 @@ class DashboardAddView(DashboardModelView):  # noqa
 
 class LogModelView(SupersetModelView):
     datamodel = SQLAInterface(models.Log)
+
+    list_title = _('List Log')
+    show_title = _('Show Log')
+    add_title = _('Add Log')
+    edit_title = _('Edit Log')
+
     list_columns = ('user', 'action', 'dttm')
     edit_columns = ('user', 'action', 'dttm', 'json')
     base_order = ('dttm', 'desc')
@@ -2725,6 +2735,12 @@ def slice_query(self, slice_id):
 
 class CssTemplateModelView(SupersetModelView, DeleteMixin):
     datamodel = SQLAInterface(models.CssTemplate)
+
+    list_title = _('List Css Template')
+    show_title = _('Show Css Template')
+    add_title = _('Add Css Template')
+    edit_title = _('Edit Css Template')
+
     list_columns = ['template_name']
     edit_columns = ['template_name', 'css']
     add_columns = edit_columns


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org