You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/08/13 03:47:58 UTC
[incubator-superset] branch master updated: make some text
localizable (#5611)
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 50981db make some text localizable (#5611)
50981db is described below
commit 50981dbc698bb88055ccf5aa575e958704b8d372
Author: hitdemo <hi...@gmail.com>
AuthorDate: Mon Aug 13 11:47:55 2018 +0800
make some text localizable (#5611)
---
.../assets/src/dashboard/components/SliceAdder.jsx | 3 +-
.../src/explore/components/DisplayQueryButton.jsx | 6 ++--
.../components/controls/AnnotationLayer.jsx | 34 ++++++++++++----------
.../components/controls/AnnotationLayerControl.jsx | 2 +-
superset/assets/src/explore/visTypes.jsx | 8 ++---
superset/connectors/druid/views.py | 10 +++++++
superset/connectors/sqla/views.py | 1 +
superset/views/annotations.py | 26 +++++++++++++++++
superset/views/core.py | 16 ++++++++++
9 files changed, 81 insertions(+), 25 deletions(-)
diff --git a/superset/assets/src/dashboard/components/SliceAdder.jsx b/superset/assets/src/dashboard/components/SliceAdder.jsx
index f237a06..31ad797 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/explore/components/DisplayQueryButton.jsx b/superset/assets/src/explore/components/DisplayQueryButton.jsx
index e098643..ec30c5b 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 6cb2f2d..9e31e6c 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 3e4cd24..b33dab0 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 f9cc723..acddf3e 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 5e5ba0d..cc0cea9 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 4514361..2766385 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 e2aaf88..648be25 100644
--- a/superset/views/annotations.py
+++ b/superset/views/annotations.py
@@ -7,6 +7,7 @@ from __future__ import unicode_literals
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 @@ from .base import DeleteMixin, SupersetModelView
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,21 @@ class AnnotationModelView(SupersetModelView, DeleteMixin): # noqa
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 e6f2903..71f6ff1 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 @@ appbuilder.add_view_no_menu(DashboardAddView)
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 @@ appbuilder.add_view_no_menu(Superset)
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