mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
make some text localizable (#5611)
This commit is contained in:
committed by
Maxime Beauchemin
parent
7d61eea604
commit
50981dbc69
@@ -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}
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user