From 52cbab537dfc2460922181e805f3acd80ed9578c Mon Sep 17 00:00:00 2001 From: lxzhangchao <1099326813@qq.com> Date: Wed, 5 Jul 2017 18:37:16 +0800 Subject: [PATCH 1/3] Chinese page --- superset/.config.py.swp | Bin 0 -> 16384 bytes .../components/ExploreViewContainer.jsx | 3 + .../explore/components/SaveModal.jsx | 30 +- superset/assets/javascripts/explore/index.jsx | 7 +- .../javascripts/explore/stores/en_US.js | 1448 +++++++++++++++++ .../javascripts/explore/stores/language.js | 23 + .../javascripts/explore/stores/zh_CN.js | 1396 ++++++++++++++++ superset/config.py | 4 +- superset/views/core.py | 8 +- 9 files changed, 2902 insertions(+), 17 deletions(-) create mode 100644 superset/.config.py.swp create mode 100644 superset/assets/javascripts/explore/stores/en_US.js create mode 100644 superset/assets/javascripts/explore/stores/language.js create mode 100644 superset/assets/javascripts/explore/stores/zh_CN.js diff --git a/superset/.config.py.swp b/superset/.config.py.swp new file mode 100644 index 0000000000000000000000000000000000000000..23cdfdb4edb5d450c8c89dc3664a73236ee80aeb GIT binary patch literal 16384 zcmeI2UyK_^9mfY+`Ug_}iWUJ6!$rcrHfK8th3Eur_w4oEDn75fyUxW)%4W|ywl}xl z-R#ch;*%&6h`$ozg}xLaq`vg22noRpLbOQ03n1P=AW{B2A@Kr)7bIG~vwwWfC2>$C zB!tGNkIuWlncvKO=QqEZz1!W!Ic=MMto9Lt&pQb@_MO3?`{0B;@Gv0<6DJrCCr&7A zOFqMJ8l{}Y$&xa{^z7VWy~UC}9!B+E9A05VUXP03W*Wf{A7K{n_;57IkxDUK~FCo7JFM_Xv^WX_^9Q^GbLVgXN2cHL@0~f)Q;0f>==I;04 zRq%cAb?`ihz$Rz|F~5(1|MYX5?o3!f)5HtLw9`_0R7v^d1jV}7;~9>vwNkrt#yTW#hrS=9h|pQ(PdHKumM6c z@vK2lNR@qWZIqH4>b7pFnX+`9Y6%^MaWO56rcoSD=|0;nXQY^rZ06?G#8v6HwQ=aq zb-1(ZB#c(YgorWMBPU7r!`Q8^mKAiZby!1>SfI6F60>>6cm~{areo*5FDIa3s zd1X{nnwEA>%uNw@Az~p$Njh`_y31&YH4uBQiv_bgqj;C;ng{1&>QFx%I=-F1x`aWP zjIGlN=TWj=ud|@G@9lXJb3LaP#^buUs&}vq>~LiB1G}6Sn|o7cAA|u*;Nzl&s|&cG zqUbZYgD#I5=Lgk_l6X$t6t8Vf9Ivv9`RZp282zQf2^CK0zQ-ptiP+E^dBZHkb0_>D z>u&Y1UUr?;6cx)-nL2adxLPdHic`;}S5p?x4sR2s*RwUuB{W>ACmf4tSVx30p47dm zGiJ&Bg|9U~9EVSxx?YQdu}BxUS)dSIi6ZJjRxBNO?kd|^k}2OFyFUE^KA*W8@ zimXM?ueHN?AK}Pc@vXjijo0IlmL|+WtI3nty|(ln+q9JCS>)H|LPR22=P`*SHbFWR z6Aqb&d!j7_Xh0utG$^7pM6zyo6!WaeC`i>EU1^np-BLIDn+rW%a2lsU=JPPaP-HNd z?WSWo4PCSlBTI7Zi&ooinnv5s6`1=zPTRhd?5)90N4_)8(wHbn$kTn*7}%z&7|kua zqit&z`f#$*Xh19rSOW6VaV6ZB==Mn=M&iL)0q=RB6lxwG@a!>va+|zZS-gYgg@7d#A9ULkM<1Mlw60iBSCTNO z`Jv-hBdkbdJA35$Z1rLV+eU(E#0He5MC^-x>#qOESll^rVuJ^ zc@!1(YNB<7(Sq@4y=;*bp_irR3W6}t&RP5|neF8!#8H`&5BHn-X1KiW5^F9qhCX%n zuzAMGeDSOjZzS^2To-m7d*p(Bos{eBs0gK!?0SUEEY3mI%CnVKC{ZidBg81BTBz;p zCSny=O9$wX*k7u4Hp{lXx{8Ri6w996#Hm#rBxs z186Ggi!LRILEvswibw!OZ=JaT5MIB_}WY0#n+s${i z8WKPn<2(de0|aSY)-MmFSxY#Ru#|g#Y2*imyJ6`2c~(kFn~ps#W^T(Ha#HjqnI+}d zaQ;n1Xn7aq3Wv}yYqmSWMyTAICxAzGG^Giu^)*POT|*I5p0Gtak}UYtS!CUQ>-nqbWt{D z6onjm`SMK@RU8S+kv)3(GEwkgkgtujcnpHmc@uX(YL+ojo;F2?#m+Hx;3s#SbvD~J z%VkN#^ZyUUGd&Q`|K%g%Uy6Hw6!+yvDj*e*3P=T{0#X5~fK)&#AQg}bNCl( }
@@ -194,6 +196,7 @@ function mapStateToProps(state) { triggerQuery: state.triggerQuery, forcedHeight: state.forced_height, queryRequest: state.queryRequest, + localMessage: state.localMessage, }; } diff --git a/superset/assets/javascripts/explore/components/SaveModal.jsx b/superset/assets/javascripts/explore/components/SaveModal.jsx index 4dbff36acfea..f83add4330a8 100644 --- a/superset/assets/javascripts/explore/components/SaveModal.jsx +++ b/superset/assets/javascripts/explore/components/SaveModal.jsx @@ -6,6 +6,7 @@ import { Modal, Alert, Button, Radio } from 'react-bootstrap'; import Select from 'react-select'; import { connect } from 'react-redux'; + const propTypes = { can_overwrite: PropTypes.bool, onHide: PropTypes.func.isRequired, @@ -16,8 +17,11 @@ const propTypes = { alert: PropTypes.string, slice: PropTypes.object, datasource: PropTypes.object, + localMessage: PropTypes.object, }; + + class SaveModal extends React.Component { constructor(props) { super(props); @@ -69,7 +73,7 @@ class SaveModal extends React.Component { if (sliceParams.action === 'saveas') { sliceName = this.state.newSliceName; if (sliceName === '') { - this.setState({ alert: 'Please enter a slice name' }); + this.setState({ alert: this.props.localMessage.enter_slice_name }); return; } sliceParams.slice_name = sliceName; @@ -84,7 +88,7 @@ class SaveModal extends React.Component { case ('existing'): dashboard = this.state.saveToDashboardId; if (!dashboard) { - this.setState({ alert: 'Please select a dashboard' }); + this.setState({ alert: this.props.localMessage.select_dashboard }); return; } sliceParams.save_to_dashboard_id = dashboard; @@ -92,7 +96,7 @@ class SaveModal extends React.Component { case ('new'): dashboard = this.state.newDashboardName; if (dashboard === '') { - this.setState({ alert: 'Please enter a dashboard name' }); + this.setState({ alert: this.props.localMessage.enter_dashboard_name }); return; } sliceParams.new_dashboard_name = dashboard; @@ -122,6 +126,7 @@ class SaveModal extends React.Component { this.setState({ alert: null }); } render() { + const localMessage = this.props.localMessage; return ( - Save A Slice + {localMessage.save_a_slice} @@ -160,11 +165,11 @@ class SaveModal extends React.Component { inline checked={this.state.action === 'saveas'} onChange={this.changeAction.bind(this, 'saveas')} - > Save as   + > {localMessage.save_as}   @@ -177,7 +182,7 @@ class SaveModal extends React.Component { checked={this.state.addToDash === 'noSave'} onChange={this.changeDash.bind(this, 'noSave')} > - Do not add to a dashboard + {localMessage.do_not_add_to_dash} - Add slice to existing dashboard + {localMessage.add_slice_to_existing_dash} @@ -215,7 +220,7 @@ class SaveModal extends React.Component { className="btn pull-left" onClick={this.saveOrOverwrite.bind(this, false)} > - Save + {localMessage.save} @@ -242,6 +247,7 @@ function mapStateToProps(state) { user_id: state.user_id, dashboards: state.dashboards, alert: state.saveModalAlert, + localMessage: state.localMessage, }; } diff --git a/superset/assets/javascripts/explore/index.jsx b/superset/assets/javascripts/explore/index.jsx index 39ecab08c57d..00f2767f13dc 100644 --- a/superset/assets/javascripts/explore/index.jsx +++ b/superset/assets/javascripts/explore/index.jsx @@ -14,12 +14,16 @@ import ExploreViewContainer from './components/ExploreViewContainer'; import { exploreReducer } from './reducers/exploreReducer'; import { appSetup } from '../common'; import './main.css'; +import { zh_CN } from './stores/zh_CN.js'; +import { en_US } from './stores/en_US.js'; +import { chooseMessage } from './stores/language.js'; appSetup(); initJQueryAjax(); const exploreViewContainer = document.getElementById('js-explore-view-container'); const bootstrapData = JSON.parse(exploreViewContainer.getAttribute('data-bootstrap')); +const localeMessage = chooseMessage(); const controls = getControlsState(bootstrapData, bootstrapData.form_data); delete bootstrapData.form_data; @@ -40,13 +44,12 @@ const bootstrappedState = Object.assign( triggerQuery: true, triggerRender: false, alert: null, + localMessage: localeMessage, }, ); - const store = createStore(exploreReducer, bootstrappedState, compose(applyMiddleware(thunk), initEnhancer(false)), ); - ReactDOM.render(
diff --git a/superset/assets/javascripts/explore/stores/en_US.js b/superset/assets/javascripts/explore/stores/en_US.js new file mode 100644 index 000000000000..892c1d0c3ce6 --- /dev/null +++ b/superset/assets/javascripts/explore/stores/en_US.js @@ -0,0 +1,1448 @@ +const en_US = { + header_style: 'Header Style', + table_style: 'Table Style', + col_style: 'Column Style:', + add_col_style: 'Add Column Style', + metric: 'Metric', + style: 'Style', + threshold: 'Threshold', + icon: 'Icon', + base_style: 'Base Style', + condition_style: 'Condition Style', + compare_style: 'Compare Column Style', + slice_navigator: 'Navitator to', + ag_setting: 'Ag-grid Setting', + add_base_style: ' Add Base Style', + add_condition_style: ' Add Condition Style', + add_compare_style: ' Add Compare Column Style', + add_slice_navigator: ' Add Navitator', + grid_theme: 'Grid Theme', + theme: 'Theme', + page_count: 'Page Count', + count: 'Count', + frozen_left: 'Frozen Left', + frozen_col: 'Choose Column', + frozen_right: 'Forzen Right', + linkColumns: 'linkColumns', + enable_piovttable: 'Enable PivotTable', + add_table_header_setting: ' Add Table Header Settring', + metric1: 'Metric1', + metric2: 'Metric2', + compare_expressoin: 'The expression (with x, y for two columns)', + iconChoices: [ + { key: 'Null', value: '' }, + { key: 'Rise (single arrow)', value: 'fa fa-arrow-up' }, + { key: 'Down (single arrow)', value: 'fa fa-arrow-down' }, + { key: 'Rise (double arrow)', value: 'fa fa-angle-double-up' }, + { key: 'Down (double arrow)', value: 'fa fa-angle-double-down' }, + { key: 'Bar-chart', value: 'fa fa-bar-chart' }, + { key: 'Line-chart', value: 'fa fa-line-chart' }, + { key: 'Pie-chart', value: 'fa fa-pie-chart' }, + { key: 'Area-chart', value: 'fa fa-area-chart' }, + ], + navigateChoices: [ + { key: 'Dashboard', value: 'dashboard' }, + { key: 'Slice', value: 'slice' }, + ], + openChoices: [ + { key: 'Alert Modal', value: 'modal' }, + { key: 'New Window', value: 'newWindow' }, + ], + navigate_slice: 'Navigate to Slice', + navigate_dashboard: 'Navigate to Dashboard', + width: 'Width', + height: 'Height', + navigate_type: 'Navigate Type', + open_type: 'Open Type', + datasource: 'Datasource', + viz_type_description: 'The type of visualization to display', + viz: 'Viz', + metrics: 'Metrics', + metrics_to_display: 'One or many metrics to display', + hide_options: 'Hide options', + metrics_one: 'Metric1', + metrics_two: 'Metric2', + ordring: 'Ordring', + choose_metric: 'Choose the metric', + stacked_style: 'Stacked Style', + stacked_style_choices: [ + ['stack', 'stack'], + ['stream', 'stream'], + ['expand', 'expand'], + ], + linear_color_scheme: 'Linear Color Scheme', + linear_color_scheme_choices: [ + ['fire', 'fire'], + ['blue_white_yellow', 'blue/white/yellow'], + ['white_black', 'white/black'], + ['black_white', 'black/white'], + ], + normalize_across: 'Normalize Across', + normalize_across_choices: [ + ['heatmap', 'heatmap'], + ['x', 'x'], + ['y', 'y'], + ], + normalize_across_description: + 'Color will be rendered based on a ratio of the cell against the sum of across this criteria', + horizon_color_scale: 'Horizon Color Scale', + horizon_color_scale_choices: [ + ['series', 'series'], + ['overall', 'overall'], + ['change', 'change'], + ], + horizon_color_scale_description: 'Defines how the color are attributed.', + rendering: 'Rendering', + canvas_image_rendering_choices: [ + ['pixelated', 'pixelated (Sharp)'], + ['auto', 'auto (Smooth)'], + ], + canvas_image_rendering_description: + 'image-rendering CSS attribute of the canvas object that defines how' + + 'the browser scales up the image', + xscale_interval: 'XScale Interval', + xscale_interval_description: 'Number of step to take between ticks when printing the x scale', + yscale_interval: 'YScale Interval', + yscale_interval_description: 'Number of step to take between ticks when printing the y scale', + bar_stacked: 'Stacked Bars', + show_markers: 'Show Markers', + show_markers_description: 'Show data points as circle markers on the lines', + show_bar_value: 'Bar Values', + show_bar_value_description: 'Show the value on top of the bar', + order_bars: 'Sort Bars', + order_bars_description: 'Sort bars by x labels.', + show_controls: 'Extra Controls', + show_controls_desc: 'Whether to show extra controls or not. Extra controls include things' + + 'like making mulitBar charts stacked or side by side.', + reduce_x_ticks: 'Reduce X ticks', + reduce_x_ticks_desc: 'Reduces the number of X axis ticks to be rendered. ' + + 'If true, the x axis wont overflow and labels may be ' + + 'missing. If false, a minimum width will be applied ' + + 'to columns and the width may overflow into an ' + + 'horizontal scroll.', + include_series: 'Include Series', + include_series_desc: 'Include series name as an axis', + secondary_metric: 'Color Metric', + secondary_metric_desc: 'A metric to use for color', + country_fieldtype: 'Country Field Type', + country_fieldtype_choices: [ + ['name', 'Full name'], + ['cioc', 'code International Olympic Committee (cioc)'], + ['cca2', 'code ISO 3166-1 alpha-2 (cca2)'], + ['cca3', 'code ISO 3166-1 alpha-3 (cca3)'], + ], + country_fieldtype_default: 'cca2', + country_fieldtype_desc: 'The country code standard that Superset should expect ' + + 'to find in the [country] column', + groupby: 'Group by', + groupby_desc: 'One or many fields to group by', + columns: 'Columns', + columns_desc: 'One or many fields to pivot as columns', + all_columns: 'Columns', + all_columns_desc: 'Columns to display', + columns_to_display: 'Columns to display', + origin: 'Origin', + druid_time_origin_choices: [ + ['', 'default'], + ['now', 'now'], + ], + druid_time_origin_desc: 'Defines the origin where time buckets start, ' + + 'accepts natural dates as in `now`, `sunday` or `1970-01-01`', + bottom_margin: 'Bottom Margin', + bottom_margin_desc: 'Bottom marging, in pixels, allowing for more room for axis labels', + granularity: 'Time Granularity', + granularity_choices: [ + ['all', 'all'], + ['5 seconds', '5 seconds'], + ['30 seconds', '30 seconds'], + ['1 minute', '1 minute'], + ['5 minutes', '5 minutes'], + ['1 hour', '1 hour'], + ['6 hour', '6 hour'], + ['1 day', '1 day'], + ['7 days', '7 days'], + ['week', 'week'], + ['week_starting_sunday', 'week_starting_sunday'], + ['week_ending_saturday', 'week_ending_saturday'], + ['month', 'month'], + ], + granularity_default: 'one day', + granularity_desc: 'The time granularity for the visualization. Note that you ' + + 'can type and use simple natural language as in `10 seconds`, ' + + '`1 day` or `56 weeks`', + domain_granularity: 'Domain', + domain_granularity_choices: [ + ['hour', 'hour'], + ['day', 'day'], + ['week', 'week'], + ['month', 'month'], + ['year', 'year'], + ], + domain_granularity_default: 'month', + domain_granularity_desc: 'The time unit used for the grouping of blocks', + subdomain_granularity: 'Subdomain', + subdomain_granularity_choices: [ + ['min', 'min'], + ['hour', 'hour'], + ['day', 'day'], + ['week', 'week'], + ['month', 'month'], + ], + subdomain_granularity_default: 'day', + subdomain_granularity_desc: 'The time unit for each block. Should be a smaller unit than ' + + 'domain_granularity. Should be larger or equal to Time Grain', + link_length: 'Link Length', + link_length_desc: 'Link length in the force layout', + charge: 'Charge', + charge_desc: 'Charge in the force layout', + granularity_sqla: 'Time Column', + granularity_sqla_desc: 'The time column for the visualization. Note that you ' + + 'can define arbitrary expression that return a DATETIME ' + + 'column in the table or. Also note that the ' + + 'filter below is applied against this column or ' + + 'expression', + time_grain_sqla: 'Time Grain', + time_grain_sqla_default: 'Time Column', + time_grain_sqla_desc: 'The time granularity for the visualization. This ' + + 'applies a date transformation to alter ' + + 'your time column and defines a new time granularity. ' + + 'The options here are defined on a per database ' + + 'engine basis in the Superset source code.', + resample_rule: 'Resample Rule', + resample_rule_desc: 'Pandas resample rule', + resample_how: 'Resample How', + resample_how_choices: [ + ['', ''], + ['mean', 'mean'], + ['sum', 'sum'], + ['median', 'median'], + ], + resample_how_desc: 'Pandas resample how', + resample_fillmethod: 'Resample Fill Method', + resample_fillmethod_choices: ['', 'ffill', 'bfill'], + resample_fillmethod_desc: 'Pandas resample fill method', + since: 'Since', + since_choices: [ + ['1 hour ago', '1 hour ago'], + ['12 hours ago', '12 hours ago'], + ['1 day ago', '1 day ago'], + ['7 days ago', '7 days ago'], + ['28 days ago', '28 days ago'], + ['90 days ago', '90 days ago'], + ['1 year ago', '1 year ago'], + ['100 year ago', '100 year ago'], + ], + since_default: '7 days ago', + since_desc: 'Timestamp from filter', + until: 'Until', + until_choices: [ + ['now', 'now'], + ['1 day ago', '1 day ago'], + ['7 days ago', '7 days ago'], + ['28 days ago', '28 days ago'], + ['90 days ago', '90 days ago'], + ['1 year ago', '1 year ago'], + ], + until_default: 'now', + max_bubble_size: 'Max Bubble Size', + whisker_options: 'Whisker/outlier options', + whisker_options_choices: [ + ['Tukey', 'Tukey'], + ['Min/max (no outliers)', 'Min/max (no outliers)'], + ['2/98 percentiles', '2/98 percentiles'], + ['9/91 percentiles', '9/91 percentiles'], + ], + whisker_options_default: 'Tukey', + whisker_options_desc: 'Determines how whiskers and outliers are calculated.', + treemap_ratio: 'Ratio', + treemap_ratio_desc: 'Target aspect ratio for treemap tiles.', + number_format: 'Number format', + row_limit: 'Row limit', + limit: 'Series Limit', + limit_desc: 'Limits the number of time series that get displayed', + timeseries_limit_metric: 'Sort By', + timeseries_limit_metric_desc: 'Metric used to define the top series', + rolling_type: 'Rolling', + rolling_type_choices: [ + ['None', 'None'], + ['mean', 'mean'], + ['sum', 'sum'], + ['std', 'std'], + ['cumsum', 'cumsum'], + ], + rolling_type_default: 'None', + rolling_type_desc: 'Defines a rolling window function to apply, works along ' + + 'with the [Periods] text box', + rolling_periods: 'Periods', + rolling_periods_desc: 'Defines the size of the rolling window function, ' + + 'relative to the time granularity selected', + series: 'Series', + series_desc: 'Defines the grouping of entities. ' + + 'Each series is shown as a specific color on the chart and ' + + 'has a legend toggle', + entity: 'Entity', + entity_desc: 'This define the element to be plotted on the chart', + x: 'X Axis', + x_desc: 'Metric assigned to the [X] axis', + y: 'Y Axis', + y_desc: 'Metric assigned to the [Y] axis', + size: 'Bubble Size', + url_desc: 'The URL, this field is templated, so you can integrate ' + + '{{ width }} and/or {{ height }} in your URL string.', + x_axis_label: 'X Axis Label', + y_axis_label: 'Y Axis Label', + where: 'Custom WHERE clause', + where_desc: 'The text in this box gets included in your query\'s WHERE ' + + 'clause, as an AND to other criteria. You can include ' + + 'complex expression, parenthesis and anything else ' + + 'supported by the backend it is directed towards.', + having: 'Custom HAVING clause', + having_desc: 'The text in this box gets included in your query\'s HAVING ' + + 'clause, as an AND to other criteria. You can include ' + + 'complex expression, parenthesis and anything else ' + + 'supported by the backend it is directed towards.', + compare_lag: 'Comparison Period Lag', + compare_lag_desc: 'Based on granularity, number of time periods to compare against', + compare_suffix: 'Comparison suffix', + compare_suffix_desc: 'Suffix to apply after the percentage display', + table_timestamp_format: 'Table Timestamp Format', + table_timestamp_format_desc: 'Timestamp Format', + series_height: 'Series Height', + series_height_desc: 'Pixel height of each series', + page_length: 'Page Length', + page_length_desc: 'Rows per page, 0 means no pagination', + x_axis_format: 'X axis format', + y_axis_format: 'Y axis format', + markup_type: 'Markup Type', + markup_type_choices: [ + ['markdown', 'markdown'], + ['html', 'html'], + ], + markup_type_default: 'markdown', + markup_type_desc: 'Pick your favorite markup language', + rotation: 'Rotation', + rotation_choices: [ + ['random', 'random'], + ['flat', 'flat'], + ['square', 'square'], + ], + rotation_default: 'random', + rotation_desc: 'Rotation to apply to words in the cloud', + line_interpolation: 'Line Style', + line_interpolation_choices: [ + ['linear', 'linear'], + ['basis', 'basis'], + ['cardinal', 'cardinal'], + ['monotone', 'monotone'], + ['step-before', 'step-before'], + ['step-after', 'step-after'], + ], + line_interpolation_default: 'linear', + line_interpolation_desc: 'Line interpolation as defined by d3.js', + pie_label_type: 'Label Type', + pie_label_type_choices: [ + ['key', 'Category Name'], + ['value', 'Value'], + ['percent', 'Percentage'], + ], + pie_label_type_default: 'key', + pie_label_type_desc: 'What should be shown on the label?', + code: 'Code', + code_desc: 'Put your code here', + pandas_aggfunc: 'Aggregation function', + pandas_aggfunc_choices: [ + ['sum', 'sum'], + ['mean', 'mean'], + ['min', 'min'], + ['max', 'max'], + ['median', 'median'], + ['stdev', 'stdev'], + ['var', 'var'], + ], + pandas_aggfunc_default: 'sum', + pandas_aggfunc_desc: 'Aggregate function to apply when pivoting and ' + + 'computing the total rows and columns', + size_from: 'Font Size From', + size_from_desc: 'Font size for the smallest value in the list', + size_to: 'Font Size To', + size_to_desc: 'Font size for the biggest value in the list', + show_brush: 'Range Filter', + show_brush_desc: 'Whether to display the time range interactive selector', + date_filter: 'Date Filter', + date_filter_desc: 'Whether to include a time filter', + show_datatable: 'Data Table', + show_datatable_desc: 'Whether to display the interactive data table', + include_search: 'Search Box', + include_search_desc: 'Whether to include a client side search box', + table_filter: 'Table Filter', + table_filter_desc: 'Whether to apply filter when table cell is clicked', + show_bubbles: 'Show Bubbles', + show_bubbles_desc: 'Whether to display bubbles on top of countries', + show_legend: 'Legend', + show_legend_desc: 'Whether to display the legend (toggles)', + x_axis_showminmax: 'X bounds', + x_axis_showminmax_desc: 'Whether to display the min and max values of the X axis', + rich_tooltip: 'Rich Tooltip', + rich_tooltip_desc: 'The rich tooltip shows a list of all series for that ' + + 'point in time', + y_axis_zero: 'Y Axis Zero', + y_axis_zero_desc: 'Force the Y axis to start at 0 instead of the minimum value', + y_log_scale: 'Y Log Scale', + y_log_scale_desc: 'Use a log scale for the Y axis', + x_log_scale: 'X Log Scale', + x_log_scale_desc: 'Use a log scale for the x axis', + donut: 'Dount', + donut_desc: 'Do you want a donut or a pie?', + labels_outside: 'Put labels outside', + labels_outside_desc: 'Put the labels outside the pie?', + contribution: 'Contribution', + contribution_desc: 'Compute the contribution to the total', + num_period_compare: 'Period Ratio', + num_period_compare_desc: '[integer] Number of period to compare against, ' + + 'this is relative to the granularity selected', + period_ratio_type: 'Period Ratio Type', + period_ratio_type_choices: [ + ['factor', 'factor'], + ['growth', 'growth'], + ['value', 'value'], + ], + period_ratio_type_default: 'growth', + period_ratio_type_desc: '`factor` means (new/previous), `growth` is ' + + '((new/previous) - 1), `value` is (new-previous)', + time_compare: 'Time Shift', + time_compare_desc: 'Overlay a timeseries from a ' + + 'relative time period. Expects relative time delta ' + + 'in natural language (example: 24 hours, 7 days, ' + + '56 weeks, 365 days', + subheader: 'Subheader', + subheader_desc: 'Description text that shows up below your Big Number', + fontSize: 'fontSize', + mapbox_label: 'label', + mapbox_label_desc: '`count` is COUNT(*) if a group by is used. ' + + 'Numerical columns will be aggregated with the aggregator. ' + + 'Non-numerical columns will be used to label points. ' + + 'Leave empty to get a count of points in each cluster.', + mapbox_style: 'Map Style', + mapbox_style_desc: 'Base layer map style', + clustering_radius: 'Clustering Radius', + clustering_radius_desc: 'The radius (in pixels) the algorithm uses to define a cluster. ' + + 'Choose 0 to turn off clustering, but beware that a large ' + + 'number of points (>1000) will cause lag.', + point_radius: 'Point Radius', + point_radius_desc: 'The radius of individual points (ones that are not in a cluster). ' + + 'Either a numerical column or `Auto`, which scales the point based ' + + 'on the largest cluster', + point_radius_unit: 'Point Radius Unit', + point_radius_unit_choices: [ + ['Pixels', 'Pixels'], + ['Miles', 'Miles'], + ['Kilometers', 'Kilometers'], + ], + point_radius_unit_default: 'Pixels', + point_radius_unit_desc: 'The unit of measure for the specified point radius', + global_opacity: 'Opacity', + global_opacity_desc: 'Opacity of all clusters, points, and labels. ' + + 'Between 0 and 1.', + viewport_zoom: 'Zoom', + viewport_zoom_desc: 'Zoom level of the map', + viewport_latitude: 'Default latitude', + viewport_latitude_desc: 'Latitude of default viewport', + viewport_longitude: 'Default longitude', + viewport_longitude_desc: 'Longitude of default viewport', + render_while_dragging: 'Live render', + render_while_dragging_desc: 'Points and clusters will update as viewport is being changed', + mapbox_color: 'RGB Color', + mapbox_color_desc: 'The color for points and clusters in RGB', + ranges: 'Ranges', + ranges_desc: 'Ranges to highlight with shading', + range_labels: 'Range labels', + range_labels_desc: 'Labels for the ranges', + markers: 'Markers', + markers_desc: 'List of values to mark with triangles', + marker_labels: 'Marker labels', + marker_labels_desc: 'Labels for the markers', + marker_lines: 'Marker lines', + marker_lines_desc: 'List of values to mark with lines', + marker_line_labels: 'Marker line labels', + marker_line_labels_desc: 'Labels for the marker lines', + line: 'line', + line_desc: 'One or many lines to display', + bar: 'bar', + bar_desc: 'One or many bars to display', + area: 'area', + area_desc: 'One or many areas to display', + scatter: 'scatter', + scatter_desc: 'One or many scatters to display', + yAxis: 'yAxis', + yAxis_desc: 'choose the yAxias', + y_axis_label1: 'Y1 Axis Label', + y_axis_label2: 'Y2 Axis Label', + y_domain1: 'Y1 domain', + y_domain2: 'Y2 domain', + y_domain1_desc: 'the range of y1, for example: 0,100, it means from 0 to 100', + y_domain2_desc: 'the range of y2, for example: 0,100, it means from 0 to 100', + bar_horizontal: 'Horizontal Bars', + d3_format_docs: 'D3 format syntax: https://github.com/d3/d3-format', + select_column: 'Select column', + select_operato: 'Select operato', + filter_value: 'Filter value', + choose_chart: 'Choose Chart', + base_chart: 'Base Chart', + bar_chart: 'Bar Chart', + line_chart: 'Line Chart', + area_chart: 'Area Chart', + advanced_chart: 'Advance Chart', + measurement_chart: 'Measurement chart', + big_chart: 'Big Chart', + map_chart: 'Map', + other_chart: 'Other Chart', + filter_box: 'Filter Box', + table: 'Table', + pivot_table: 'Piovt Table', + dist_bar: 'Dist BAR', + bar2: 'Bar', + multi: 'Multi', + line2: 'Line', + linePlusBar: 'LinePlusBar', + compare: 'Compare', + linePlusBar1: 'Bar Chart', + area2: 'Area', + area1: 'Area(T)', + pie: 'Pie', + bubble: 'Bubble', + radar: 'Radar', + scatter_chart: 'Scatter', + sankey: 'Sankey', + directed_force: 'Directed Force', + horizon: 'Horizon', + mapbox: 'Mapbox', + treemap: 'Treemap', + box_plot: 'Box Plot', + para: 'Para', + cal_heatmap: 'Cal Heatmap', + sunburst: 'Sunburst', + big_number: 'Big Number', + big_number_total: 'Big Number(T)', + bullet: 'Bullet', + dash: 'Dash', + world_cloud: 'World Cloud', + world_map: 'World Map', + markup1: 'Markup1', + markup: 'Markup', + iframe: 'Iframe', + separator: 'Separator', + current_chart: 'Current Chart:', + where_clause: 'Where Clause', + having_clause: 'Having Clause', + input_parent_node: 'Input Parent Node', + child_node: 'Child Node', + parent_node: 'Parent Node', + choose_child_node: 'Choose Child Node', + choose_option: 'Choose Option to Show', + show_option: 'SHow Option', + choose_groupby_option: 'Choose Groupby Option', + choose_column_option: 'Choose Column Option', + measure: 'Measure', + choose_value_option: 'Choose Value Option', + setting_style: 'Setting Style', + column_style: 'Column Style', + add_column_style: 'Add Column Style', + base_setting: 'Base Setting', + field_default: 'Field Default Value', + date_default: 'Date Default Value', + add_default: 'Add Default Value', + field: 'Field', + length: 'Length', + isMulti: 'Is Mutiple', + typeChoices: [ + { key: 'Select the default value from the collection', value: 'true' }, + { key: 'Query the default collection from the sql statement', value: 'false' }, + ], + choose_default_value: 'Choose Default Value', + default_value: 'Default Value', + default_value_desc: 'Fill in default values, separated by commas in English', + sql: 'Sql statement', + default_sql: 'Get Sets From Sql', + type: 'Type', + from: 'From', + to: 'To', + add_filter: 'Add Filter', + bar_stack: 'Bar Stack', + add_barStack: 'Add BarStack', + stack_name: 'Stack Name', + only_left: 'Only left', + only_left_desc: 'Only the left of Y axis.', + only_bottom: 'Only bottom', + only_bottom_desc: 'Only the bottom of Y axis.', + y_axis_metrics: 'Y axis metrics', + y_axis_metrics_desc: 'One or many lines to display', + y_axis_format: 'Y axis format', + y_axis_format_desc: 'Y axis format. The order must match Metirsc. e.g.:{value}', + y_axis_degree: 'Y axis degree', + y_axis_degree_desc: 'Y axis degree. The order must match Metirsc. e.g.:{"min":0,"max":100};{"min":0,"max":100};', + y_axis_name: 'Y axis name', + y_axis_name_desc: 'Y axis name.', + + x_axis_metrics: 'X axis metrics', + x_axis_metrics_desc: 'One or many lines to display', + x_axis_format: 'X axis format', + x_axis_format_desc: 'X axis format. The order must match Metirsc. e.g.:{value}', + x_axis_degree: 'X axis degree', + x_axis_degree_desc: 'X axis degree. The order must match Metirsc. e.g.:{"min":0,"max":100};{"min":0,"max":100};', + x_axis_name: 'X axis name', + x_axis_name_desc: 'X axis name.', + + y_left_metrics: 'Left of Y axis metrics', + y_left_metrics_desc: 'One or many lines to display', + y_right_metrics: 'Right of Y axis metrics', + y_right_metrics_desc: 'One or many lines to display', + y_left_format: 'Left of Y axis format', + y_left_format_desc: 'Left of Y axis format. The order must match Metirsc. e.g.:{value};{value}', + y_right_format: 'Right of Y axis format', + y_right_format_desc: 'Right of Y axis format. The order must match Metirsc. e.g.:{value};{value}', + y_left_degree: 'Left of Y axis degree', + y_left_degree_desc: 'Left of Y axis degree. The order must match Metirsc. e.g.:{"min":0,"max":100};{"min":0,"max":100};', + y_right_degree: 'Right of Y axis degree', + y_right_degree_desc: 'Right of Y axis degree. The order must match Metirsc. e.g.:{"min":0,"max":100};{"min":0,"max":100};', + + x_bottom_metrics: 'Bottom of Y axis metrics', + x_bottom_metrics_desc: 'One or many lines to display', + x_top_metrics: 'Top of Y axis metrics', + x_top_metrics_desc: 'One or many lines to display', + x_bottom_format: 'Bottom of Y axis format', + x_bottom_format_desc: 'Bottom of Y axis format. The order must match Metirsc. e.g.:{value};{value}', + x_top_format: 'Top of Y axis format', + x_top_format_desc: 'Top of Y axis format. The order must match Metirsc. e.g.:{value};{value}', + x_bottom_degree: 'Bottom of Y axis degree', + x_bottom_degree_desc: 'Bottom of Y axis degree. The order must match Metirsc. e.g.:{"min":0,"max":100};{"min":0,"max":100};', + x_top_degree: 'Top of Y axis degree', + x_top_degree_desc: 'Top of Y axis degree. The order must match Metirsc. e.g.:{"min":0,"max":100};{"min":0,"max":100};', + + top_padding: 'Top Padding', + top_padding_desc: 'Top Padding of the Chart', + bottom_padding: 'Bottom Padding', + bottom_padding_desc: 'Bottom Padding of the Chart', + left_padding: 'Left Padding', + left_padding_desc: 'Left Padding of the Chart', + right_padding: 'Right Padding', + right_padding_desc: 'Right Padding of the Chart', + is_avg: 'Show AVG', + is_avg_desc: 'Show the avg line.', + is_max_min: 'Show MAX & MIN', + is_max_min_desc: 'Show the max min line.', + is_bar_value: 'Show Bar Value', + is_bar_value_desc: 'Show bar value.', + 'is_stack': 'Stack', + + druidTimeSeries: 'Time', + druidTimeSeries_fieldSetRows: [ + ['granularity', 'druid_time_origin'], + ['since', 'until'], + ], + druidTimeSeries_desc: 'Time related form attributes', + datasourceAndVizType: 'Datasource & Chart Type', + datasourceAndVizType_fieldSetRows: [ + ['datasource'], + ['viz_type'], + ], + sqlaTimeSeries: 'Time', + sqlaTimeSeries_fieldSetRows: [ + ['granularity_sqla', 'time_grain_sqla'], + ['since', 'until'], + ], + sqlaTimeSeries_desc: 'Time related form attributes', + sqlClause: 'SQL', + sqlClause_fieldSetRows: [ + ['where', 'having'], + ], + sqlClause_desc: 'This section exposes ways to include snippets of SQL in your query', + NVD3TimeSeries: 'Advanced Analytics', + NVD3TimeSeries_fieldSetRows1: [ + ['metrics'], + ['groupby'], + ['limit', 'timeseries_limit_metric'], + ], + NVD3TimeSeries_desc: 'This section contains options ' + + 'that allow for advanced analytical post processing ' + + 'of query results', + NVD3TimeSeries_fieldSetRows2: [ + ['rolling_type', 'rolling_periods'], + ['time_compare'], + ['num_period_compare', 'period_ratio_type'], + ['resample_how', 'resample_rule'], + ['resample_fillmethod'], + ], + filters1: 'Filters', + filters1_desc: 'Filters are defined using comma delimited strings as in ' + + 'Leave the value field empty to filter empty strings or nulls' + + 'For filters with comma in values, wrap them in single quotes' + + "as in ", + filters2: 'Result Filters', + filters2_desc: 'The filters to apply after post-aggregation.' + + 'Leave the value field empty to filter empty strings or nulls', + chart_options: 'Chart Options', + dist_bar_viz: 'Distribution - Bar Chart', + dist_bar_viz_fieldSetRows: [ + ['metrics'], + ['groupby'], + ['columns'], + ['row_limit'], + ['show_legend', 'show_bar_value'], + ['bar_stacked', 'order_bars'], + ['y_axis_format', 'bottom_margin'], + ['x_axis_label', 'y_axis_label'], + ['reduce_x_ticks', 'contribution'], + ['show_controls', 'bar_horizontal'], + ], + tooltip_text: 'tooltip text here', + breakDowns: 'Breakdowns', + breakDowns_desc: 'Defines how each series is broken down', + ag_grid: 'Complex Table', + ag_grid1_fieldSetRows: [ + ['groupby', 'metrics'], + ], + ag_grid1_desc: 'Use this section if you want a query that aggregates', + ag_grid2: 'Options', + ag_grid2_fieldSetRows: [ + ['table_timestamp_format'], + ['row_limit'], + ['order_by_cols'], + ], + linePlusBar_viz: 'Distribution - LinePlusBar Chart', + linePlusBar_viz_fieldSetRows: [ + ['groupby'], + ['metrics'], + ['row_limit', 'bottom_margin'], + ['x_axis_label', 'x_axis_format'], + ['y_axis_label1', 'y_axis_format1'], + ['y_axis_label2', 'y_axis_format2'], + ['reduce_x_ticks', 'contribution'], + ], + multi_viz: 'Distribution - Multi Chart', + multi_viz_fieldSetRows: [ + ['groupby'], + ['line', 'yAxis1'], + ['bar', 'yAxis2'], + ['area', 'yAxis3'], + ['scatter', 'yAxis4'], + ['row_limit', 'bottom_margin'], + ['x_axis_label', 'x_axis_format'], + ['y_axis_label1', 'y_axis_format1'], + ['y_axis_label2', 'y_axis_format2'], + ['y_domain1', 'y_domain2'], + ['reduce_x_ticks', 'contribution'], + ], + pie_viz: 'Pie Chart', + pie_viz_fieldSetRows: [ + ['metrics', 'groupby'], + ['limit'], + ['pie_label_type'], + ['donut', 'show_legend'], + ['labels_outside'], + ], + line_viz: 'Time Series - Line Chart', + line_viz_fieldSetRows: [ + ['show_brush', 'show_legend'], + ['rich_tooltip', 'y_axis_zero'], + ['y_log_scale', 'contribution'], + ['show_markers', 'x_axis_showminmax'], + ['line_interpolation'], + ['x_axis_format', 'y_axis_format'], + ['x_axis_label', 'y_axis_label'], + ], + bar_viz: 'Time Series - Bar Chart', + bar_viz_fieldSetRows: [ + ['show_brush', 'show_legend', 'show_bar_value'], + ['rich_tooltip', 'y_axis_zero'], + ['y_log_scale', 'contribution'], + ['x_axis_format', 'y_axis_format'], + ['line_interpolation', 'bar_stacked'], + ['x_axis_showminmax', 'bottom_margin'], + ['x_axis_label', 'y_axis_label'], + ['reduce_x_ticks', 'show_controls'], + ], + compare_viz: 'Time Series - Percent Change', + area_viz: 'Time Series - Stacked', + area_viz_fieldSetRows: [ + ['show_brush', 'show_legend'], + ['rich_tooltip', 'y_axis_zero'], + ['y_log_scale', 'contribution'], + ['x_axis_format', 'y_axis_format'], + ['x_axis_showminmax', 'show_controls'], + ['line_interpolation', 'stacked_style'], + ], + table_viz: 'Table View', + table_viz_fieldSetRows: [ + ['table_timestamp_format'], + ['row_limit'], + ['page_length'], + ['order_by_cols'], + ['include_search', 'table_filter'], + ], + markup_fieldSetRows: [ + ['markup_type', 'code'], + ], + pivot_table_viz: 'Pivot Table', + pivot_table_viz_fieldSetRows: [ + ['groupby', 'columns'], + ['metrics', 'pandas_aggfunc'], + ], + separator_fieldSetRows: [ + ['code'], + ], + word_cloud_viz: 'Word Cloud', + world_cloud_fieldSetRows: [ + ['series', 'metric', 'limit'], + ['size_from', 'size_to'], + ['rotation'], + ], + treemap_fieldSetRows1: [ + ['metrics'], + ['groupby'], + ], + treemap_fieldSetRows2: [ + ['treemap_ratio'], + ['number_format'], + ], + cal_heatmap_viz: 'Calendar Heatmap', + cal_heatmap_viz_fieldSetRows: [ + ['metric'], + ['domain_granularity'], + ['subdomain_granularity'], + ], + box_plot_fieldSetRows: [ + ['metrics'], + ['groupby', 'limit'], + ], + bubble_viz: 'Bubble Chart', + bubble_viz_fieldSetRows1: [ + ['series', 'entity'], + ['x', 'y'], + ['size', 'limit'], + ], + bubble_viz_fieldSetRows2: [ + ['x_log_scale', 'y_log_scale'], + ['show_legend'], + ['max_bubble_size'], + ['x_axis_label', 'y_axis_label'], + ], + bullet_viz: 'Bullet Chart', + bullet_viz_fieldSetRows: [ + ['metric'], + ['ranges', 'range_labels'], + ['markers', 'marker_labels'], + ['marker_lines', 'marker_line_labels'], + ], + big_number_viz: 'Big Number with Trendline', + big_number_viz_fieldSetRows: [ + ['metric'], + ['compare_lag'], + ['compare_suffix'], + ['y_axis_format'], + ], + big_number_total_fieldSetRows: [ + ['metric'], + ['subheader'], + ['y_axis_format'], + ], + histogram: 'Histogram', + histogram_fieldSetRows1: [ + ['all_columns_x'], + ['row_limit'], + ], + histogram2: 'Histogram Options', + histogram_fieldSetRows2: [ + ['link_length'], + ], + all_columns_x: 'Numeric Column', + all_columns_x_desc: 'Select the numeric column to draw the histogram', + link_length1: 'No of Bins', + link_length1_desc: 'Select number of bins for the histogram', + sunburst_fieldSetRows: [ + ['groupby'], + ['metric', 'secondary_metric'], + ['row_limit'], + ], + sunburst_metric: 'Primary Metric', + sunburst_metric_desc: 'The primary metric is used to define the arc segment sizes', + sunburst_secondary_metric: 'Secondary Metric', + sunburst_secondary_metric_desc: 'This secondary metric is used to ' + + 'define the color as a ratio against the primary metric. ' + + 'If the two metrics match, color is mapped level groups', + sunburst_groupby: 'Hierarchy', + sunburst_groupby_desc: 'This defines the level of the hierarchy', + sankey_fieldSetRows: [ + ['groupby'], + ['metric'], + ['row_limit'], + ], + sankey_groupby: 'Source / Target', + sankey_groupby_desc: 'Choose a source and a target', + directed_force_viz: 'Directed Force Layout', + directed_force_viz_fieldSetRows1: [ + ['groupby'], + ['metric'], + ['row_limit'], + ], + directed_force_viz2: 'Force Layout', + directed_force_viz_fieldSetRows2: [ + ['link_length'], + ['charge'], + ], + world_map_fieldSetRows: [ + ['entity'], + ['country_fieldtype'], + ['metric'], + ], + world_map_bubbles: 'Bubbles', + world_map_bubbles_fieldSetRows: [ + ['show_bubbles'], + ['secondary_metric'], + ['max_bubble_size'], + ], + world_map_entity: 'Country Field', + world_map_entity_desc: '3 letter code of the country', + world_map_metric: 'Metric for color', + world_map_metric_desc: 'Metric that defines the color of the country', + world_map_secondary_metric: 'Bubble size', + world_map_secondary_metric_desc: 'Metric that defines the size of the bubble', + filter_box_fieldSetRows: [ + ['date_filter'], + ['groupby'], + ['metric'], + ], + filter_box_groupby: 'Filter fields', + filter_box_groupby_desc: 'The fields you want to filter on', + para_viz: 'Parallel Coordinates', + para_viz_fieldSetRows: [ + ['series'], + ['metrics'], + ['secondary_metric'], + ['limit'], + ['show_datatable', 'include_series'], + ], + heatmap_viz: 'Heatmap', + heatmap_viz_label: 'Axis & Metrics', + heatmap_viz_fieldSetRows1: [ + ['all_columns_x'], + ['all_columns_y'], + ['metric'], + ], + heatmap_viz2: 'Heatmap Options', + heatmap_viz_fieldSetRows2: [ + ['linear_color_scheme'], + ['xscale_interval', 'yscale_interval'], + ['canvas_image_rendering'], + ['normalize_across'], + ], + horizon_fieldSetRows: [ + ['series_height', 'horizon_color_scale'], + ], + mapbox_fieldSetRows: [ + ['all_columns_x', 'all_columns_y'], + ['clustering_radius'], + ['row_limit'], + ['groupby'], + ['render_while_dragging'], + ], + mapbox2: 'Points', + mapbox_fieldSetRows2: [ + ['point_radius'], + ['point_radius_unit'], + ], + mapbox3: 'Labelling', + mapbox_fieldSetRows3: [ + ['mapbox_label'], + ['pandas_aggfunc'], + ], + mapbox4: 'Visual Tweaks', + mapbox_fieldSetRows4: [ + ['mapbox_style'], + ['global_opacity'], + ['mapbox_color'], + ], + mapbox5: 'Viewport', + mapbox_fieldSetRows5: [ + ['viewport_longitude'], + ['viewport_latitude'], + ['viewport_zoom'], + ], + mapbox_all_columns_x: 'Longitude', + mapbox_all_columns_x_desc: 'Column containing longitude data', + mapbox_all_columns_y: 'Latitude', + mapbox_all_columns_y_desc: 'Column containing latitude data', + mapbox_pandas_aggfunc: 'Cluster label aggregator', + mapbox_pandas_aggfunc_desc: 'Aggregate function applied to the list of points ' + + 'in each cluster to produce the cluster label.', + mapbox_rich_tooltip: 'Tooltip', + mapbox_rich_tooltip_desc: 'Show a tooltip when hovering over points and clusters ' + + 'describing the label', + mapbox_groupby_desc: 'One or many fields to group by. If grouping, latitude ' + + 'and longitude columns must be present.', + + echart_bar: 'Echart Bar', + metrics_and_dim: 'Metrics and Dimensions', + metrics_and_dim_desc: 'Metrics and Dimensions', + muti_y_axis: 'Multi Y Axis', + muti_y_axis_desc: 'Multi Y Axis', + muti_x_axis: 'Multi X Axis', + muti_x_axis_desc: 'Multi X Axis', + padding: 'Padding', + padding_desc: 'Padding', + other_option: 'Other Options', + other_option_desc: 'Other Options', + x_axis: 'X Aixs', + y_axis: 'Y Aixs', + echarts_line: '[E]Line', + echart_line: '[E]Line', + echart_line_bar: '[E]Line Bar', + echarts_line_bar: '[E]Line Bar', + echarts_bar_h: '[E]Horizontal Bar', + echarts_bar_progress: '[E]Progress Bar', + echarts_bar_waterfall: '[E]Waterfall Bar', + line_bar: 'Line and Bar', + line_bar_desc: 'Line and Bar', + bar_choice: 'Bar Metrics', + line_choice: 'Line Metrics', + bar_choice_desc: 'Bar Metrics', + line_choice_desc: 'Line Metrics, others are Bar Metrics', + echart_chart: 'Echart', + + menu_viztype: [ + { chart: 'area', icon: 'fa fa-area-chart', name: 'Area' }, + { chart: 'bar', icon: 'fa fa-bar-chart', name: 'Bar' }, + { chart: 'big_number', icon: 'fa fa-header', name: 'Big Number' }, + { chart: 'big_number_total', icon: 'fa fa-header', name: 'Big Number Total' }, + { chart: 'box_plot', icon: 'fa fa-bar-chart', name: 'Box Plot' }, + { chart: 'bubble', icon: 'fa fa-bar-chart', name: 'Bubble' }, + { chart: 'bullet', icon: 'fa fa-bar-chart', name: 'Bullet' }, + { chart: 'cal_heatmap', icon: 'fa fa-bar-chart', name: 'Cal Heatmap' }, + { chart: 'compare', icon: 'fa fa-line-chart', name: 'Compare' }, + { chart: 'directed_force', icon: 'fa fa-bar-chart', name: 'Directed Force' }, + { chart: 'dist_bar', icon: 'fa fa-bar-chart', name: 'Dist Bar' }, + { chart: 'filter_box', icon: 'fa fa-check-square', name: 'Filter' }, + { chart: 'heatmap', icon: 'fa fa-bar-chart', name: 'Heatmap' }, + { chart: 'histogram', icon: 'fa fa-bar-chart', name: 'Histogram' }, + { chart: 'horizon', icon: 'fa fa-bar-chart', name: 'Horizon' }, + { chart: 'iframe', icon: 'fa fa-columns', name: 'Iframe' }, + { chart: 'line', icon: 'fa fa-line-chart', name: 'Line' }, + { chart: 'mapbox', icon: 'fa fa-bar-chart', name: 'Mapbox' }, + { chart: 'markup', icon: 'fa fa-bar-chart', name: 'Markup' }, + { chart: 'para', icon: 'fa fa-bar-chart', name: 'Para' }, + { chart: 'pie', icon: 'fa fa-pie-chart', name: 'Pie' }, + { chart: 'pivot_table', icon: 'fa fa-table', name: 'Pivot' }, + { chart: 'sankey', icon: 'fa fa-bar-chart', name: 'Sankey' }, + { chart: 'separator', icon: 'fa fa-bar-chart', name: 'Separator' }, + { chart: 'sunburst', icon: 'fa fa-bar-chart', name: 'Sunburst' }, + { chart: 'table', icon: 'fa fa-table', name: 'Table' }, + { chart: 'treemap', icon: 'fa fa-bar-chart', name: 'Treemap' }, + { chart: 'word_cloud', icon: 'fa fa-bar-chart', name: 'Word Cloud' }, + { chart: 'world_map', icon: 'fa fa-map-marker', name: 'World Map' }, + { chart: 'echarts_china_map', icon: 'fa fa-map-marker', name: 'China Map' }, + { chart: 'china_city_map', icon: 'fa fa-map-marker', name: 'China City Map' }, + { chart: 'linePlusBar', icon: 'fa fa-line-chart', name: 'Line Bar' }, + { chart: 'multi', icon: 'fa fa-line-chart', name: 'Multi Line Bar' }, + { chart: 'ag_grid', icon: 'fa fa-table', name: 'AG Grid' }, + { chart: 'echarts_bar', icon: 'fa fa-bar-chart', name: '[E]Bar' }, + { chart: 'echarts_bar_h', icon: 'fa fa-bar-chart', name: '[E]Horizontal Bar' }, + { chart: 'echarts_bar_progress', icon: 'fa fa-bar-chart', name: '[E]Progress Bar' }, + { chart: 'echarts_bar_waterfall', icon: 'fa fa-bar-chart', name: '[E]Waterfall Bar' }, + { chart: 'echarts_line', icon: 'fa fa-line-chart', name: '[E]Line' }, + { chart: 'echarts_line_bar', icon: 'fa fa-line-chart', name: '[E]Line Bar' }, + { chart: 'echarts_pie_m', icon: 'fa fa-pie-chart', name: '[E]Pie(Metrics)' }, + { chart: 'echarts_pie_h', icon: 'fa fa-pie-chart', name: '[E]Pie(Hierarchical)' }, + { chart: 'echarts_pie_g', icon: 'fa fa-pie-chart', name: '[E]Pie(GroupBy)' }, + { chart: 'echarts_pie_h_g', icon: 'fa fa-pie-chart', name: '[E]Pie(Hierarchical GroupBy)' }, + { chart: 'echarts_radar_map', icon: 'fa fa-globe', name: '[E]RadarMap' }, + { chart: 'echarts_dash_board', icon: 'fa fa-tachometer', name: '[E]DashBoard' }, + { chart: 'echarts_big_number', icon: 'fa fa-tachometer', name: '[E]BigMap' }, + { chart: 'echarts_big_number_compare', icon: 'fa fa-tachometer', name: '[E]BigMapCompare' }, + { chart: 'echarts_bubble', icon: 'fa fa-tachometer', name: '[E]Bubble' }, + { chart: 'echarts_word_cloud', icon: 'fa fa-file-word-o icon-span', name: '[E]WordCloud' }, + { chart: 'echarts_quadrant', icon: 'fa fa-file-word-o icon-span', name: '[E]Quadrant' }, + ], + + echarts_pie_m: '[E]Pie(Metrics)', + echarts_pie_m_desc: '[E]Pie(Metrics)', + label_position: 'Label Position', + label_position_desc: 'Label Position', + label_position_choices: [ + ['outside', 'Outside'], + ['inside', 'Inside'], + ['center', 'Center'], + ], + label_format: 'Label Format', + label_format_desc: 'e.g: {b} : {c} ({d}%)', + circle_type: 'Circle Type', + circle_type_desc: 'Circle Type', + circle_type_choices: [ + ['none', 'None'], + ['big', 'Big'], + ['medium', 'Medium'], + ['small', 'Small'], + ], + rose_type: 'Rose Type', + rose_type_desc: 'Rose Type', + rose_type_choices: [ + ['none', 'None'], + ['radius', 'Radius'], + ['area', 'Area'], + ], + col_num: 'Column Number', + inner_metrics: 'Inner Circle Metrics', + inner_metrics_desc: 'Inner Circle Metrics', + outer_metrics: 'Outer Circle Metrics', + outer_metrics_desc: 'Outer Circle Metrics', + echarts_pie_h: '[E]Pie(Hierarchical)', + echarts_pie_h_desc: '[E]Pie(Hierarchical)', + + echarts_pie_g: '[E]Pie(GroupBy)', + echarts_pie_g_desc: '[E]Pie(GroupBy)', + + echarts_pie_h_g: '[E]Pie(Hierarchical GroupBy)', + + echarts_radar_map: '[E]RadarMap', + is_circle: 'Circle', + is_full: 'Full', + + echarts_dash_board: '[E]Dashboard', + echarts_big_number: '[E]BigNumber', + echarts_big_number_compare: '[E]BigNumberCompare', + echarts_bubble: '[E]Bubble', + echarts_word_cloud: '[E]WordColud', + dash_min: 'Dashboard min value', + dash_max: 'Dashboard max value', + dash_name: 'Dashboard name', + dash_splitNum: 'Dashboard split number', + dash_expr: 'Dashboard expression', + dash_suffix: 'Dashboard suffix', + dash_style: 'Dashboard style', + + // explore + export_to_json: 'Export to .json', + export_to_csv: 'Export to .csv format', + no_result: 'No Result', + table_language: { + lengthMenu: "Show _MENU_ Count", + search: 'Search', + zeroRecords: 'No Data', + paginate: { + first: 'First Page', + last: 'Last Page', + next: 'Next', + previous: 'Previous', + }, + info: 'Page _PAGE_ / _PAGES_ Pages, Total of _TOTAL_ Records', + infoEmpty: 'No Data', + infoFiltered: '(Total number of filters _MAX_)', + }, + choose_nav_target: 'Please select the target you want to navigate', + page_size: 'Page Size', + export_csv: 'Export to csv', + export_excel: 'Export to excel', + save_as: 'Save as', + save: 'Save', + query: 'Query', + force_refresh_dashboard: 'Force refresh the whole dashboard', + edit_dashboard_property: 'Edit this dashboard`s property', + add_newSlice_to_dashboard: 'Add a new slice to the dashboard', + unsave_change: 'You have unsaved changes.', + click: 'Click the', + click_to_save: 'button on the top right to save your changes.', + remove_slice: 'Remove Slice', + refresh_data: 'Refresh Data', + edit_slice: 'Edit Slice', + print_slice: 'Print Slice', + move_slice: 'Move Slice', + toogle_chart_desc: 'Toggle chart description', + served_data: 'Served from data cached at', + click_to_refresh: '. Click to force refresh', + error: 'Error', + error_add_slice_dash: 'Sorry, there was an error adding slices to this dashboard', + add_slice_to_dash: 'Add Slices to Dashboard', + name: 'Name', + modified: 'Modified', + add_slices: 'Add Slices', + refresh_interval: 'Refresh Interval', + refresh_options: [ + [0, "Don't refresh"], + [10, '10 seconds'], + [30, '30 seconds'], + [60, '1 minute'], + [300, '5 minutes'], + ], + choose_refresh_desc: 'Choose the refresh frequency for this dashboard', + active_dashboard_filters: 'Active Dashboard Filters', + load_template: 'Load a template', + live_css_editor: 'Live CSS Editor', + load_a_css_template: 'Load a CSS template', + save_dashboard: 'Save Dashboard', + overwrite_dashboard: 'Overwrite Dashboard', + error_add_dashboard: 'You must pick a name for the new dashboard', + success: 'Success', + success_save_dashboard: 'This dashboard was saved successfully.', + dashboard_name: '[dashboard name]', + y1_axis_format: 'Y1 axis format', + y2_axis_format: 'Y2 axis format', + no_access_datebase: 'It seems you don`t have access to any database', + untitled_query: 'Untitled Query', + search_user: '[User]', + search_results: 'Search Results', + search_from: '[From]-', + search_to: '[To]-', + query_status: '[Query Status]', + search: 'Search', + TIME_OPTIONS: [ + ['now', 'now'], + ['1 hour ago', '1 hour ago'], + ['1 day ago', '1 day ago'], + ['7 days ago', '7 days ago'], + ['28 days ago', '28 days ago'], + ['90 days ago', '90 days ago'], + ['1 year ago', '1 year ago'], + ], + STATUS_OPTIONS: [ + ['success', 'success'], + ['failed', 'failed'], + ['running', 'running'], + ], + select_database: 'Select a database', + close_tab: 'close tab', + rename_tab: 'rename tab', + expand_tool_bar: 'expand tool bar', + hide_tool_bar: 'hide tool bar', + share_query: 'share query', + select_schema: 'Select a schema', + add_table: 'Add a table', + open_in_sql_editor: 'Open in SQL Editor', + + // querytable column and field + query_table_columns: [ + 'state', 'db', 'user', 'date', + 'progress', 'rows', 'sql', 'querylink', + ], + state: 'state', + db: 'db', + user: 'user', + date: 'date', + progress: 'progress', + rows: 'rows', + sql: 'sql', + querylink: 'querylink', + query_history_columns: [ + 'state', 'started', 'duration', 'progress', + 'rows', 'sql', 'output', 'actions', + ], + started: 'started', + duration: 'duration', + output: 'output', + actions: 'actions', + failed: 'failed', + running: 'running', + + data_preview: 'Data preview', + run_query: 'Run Query', + run_selection: 'Run Selection', + offline: 'OFFLINE', + database: 'Database', + reset_state: 'Reset State', + visualize_query_data: 'Visualize the data out of this query', + overwrite_query_text: 'Overwrite text in editor with a query on this table', + run_query_new_tab: 'Run query in a new tab', + remove_query_from_log: 'Remove query from log', + query_csv: '.CSV', + query_visualize: 'Visualize', + query_result: 'Results', + query_history: 'Query History', + preview_for: 'Preview for', + pk: 'Primary Key', + fk: 'Foreign Key', + index: 'Index', + no_query_history: 'No query history yet...', + fetch_data_preview: 'Fetch data preview', + query_asyc: 'This query was run asynchronously', + fetch_result: 'Fetch results', + query_no_data: 'The query returned no data', + run_query_asyc: 'Run query asynchronously', + create_table_as_result: 'Create table as with query results', + new_table_name: 'new table name', + query_in_new_tab: 'Query in a new tab', + view_results: 'view results', + pick_chart_type: 'Pick a chart type!', + need_data_column: 'To use this chart type you need at least one column flagged as a date', + no_result_avaliable: 'No results available for this query', + chart_type: '[Chart Type]', + datasource_name: 'datasource name', + visualize: 'Visualize', + vis_chart_type: 'Chart Type', + vis_datasource_name: 'Datasource Name', + + // visualizemodal column and field + vis_columns: ['column', 'is_dimension', 'is_date', 'agg_func',], + vis_column: 'column', + vis_is_dimension: 'is_dimension', + vis_is_date: 'is_date', + vis_agg_func: 'agg_func', + + + agg_func_options: [ + { value: 'sum', label: 'SUM(x)' }, + { value: 'min', label: 'MIN(x)' }, + { value: 'max', label: 'MAX(x)' }, + { value: 'avg', label: 'AVG(x)' }, + { value: 'count_distinct', label: 'COUNT(DISTINCT x)' }, + ], + run_query_display_results: 'Run a query to display results here', + stop: 'Stop', + limit_tooltip1: 'It appears that the number of rows in the query results displayed' + + 'was limited on the server side to the', + limit_tooltip2: 'limit', + run_async: 'Run Async', + enter_new_title_tab: 'Enter a new title for the tab', + copy_url_clipboard: 'copy URL to clipboard', + view_keys: 'View keys & indexes', + sort_columns_alphabetically: 'Sort columns alphabetically', + original_table_column_order: 'Original table column order', + remove_table_preview: 'Remove table preview', + copy_partition_query_to_clipboard: 'Copy partition query to clipboard', + copy_select_statement_to_clipboard: 'Copy SELECT statement to clipboard', + raw_sql: 'Raw SQL', + source_sql: 'Source SQL', + none: 'none', + picture_upload_error: 'Please choose jpg, png, jpeg picture format upload', + menu_name: 'Menu name', + parent_menu: 'Parent menu', + dash_source: 'Dashboard resources', + set_index: 'Setup as front page', + add: 'Add', + modify: 'modify', + delete: 'delete', + portal_preview: 'Portal preview', + upload_logo: 'Upload logo', + schedule_settings: 'Scheduling settings', + select_scheduling: 'Select the scheduling method', + schedule_expression: 'Scheduling expression', + schedule_tooltip: 'Note: The time is represented by `YYYY-MM-DD hh: mm: ss` or`' + + 'YYYY-MM-DD` string, and multiple conditions are connected with &&', + cron_help_href: 'Cron expression details link', + condition_setting: 'Condition setting', + monitor_dashboard: 'Monitor dashboard', + choose_dash: 'Choose the dashboard', + monitor_slice: 'Monitor slices', + choose_monitor_slice: 'Choose the monitor slice', + monitor_metric: 'Monitoring metrics', + specifies_expression: 'Specifies the expression', + mail_send_slice: 'Mail send slice', + choose_send_slice: 'Choose Slices to Send ', + receiver_address: 'receiver`s address', + done_success: 'operation successed', + done_fail: 'operation failed', + unknown_error: 'unknown error', + yes: 'Yes', + closed: 'Closed', + activation: 'activation', + start_up: 'start up', + add_schedule: 'Add a schedule', + serial_number: 'Serial number', + scheduling_method: 'Scheduling method', + start_time: 'Start time', + end_time: 'End Time', + is_active: 'is activated', + status: 'status', + mailbox_settings: 'Mailbox settings', + smtp_server: 'SMTP server', + port: 'Port', + sender_name: 'Sender name', + sender_address: 'Sender address', + user_name: 'Username', + password: 'Password', + test_conn: 'Test connection', + modify_success: 'modify success', + modify_failed: 'modify failed', + return: 'back', + connect_success: 'connect success', + connect_failed: 'connect failed', + operate_failed: 'operate failed', + operate_success: 'operate success', + interval: 'interval', + cron: 'cron', + save_failed: 'save failed', + save_success: 'save success', + upload_failed: 'upload failed', + favorites: 'Favorites', + created_content: 'Created Content', + recent_activity: 'Recent Activity', + security_access: 'Security & Access', + no_fav_slice: 'No favorite slices yet, go click on stars!', + no_fav_dash: 'No favorite dashboards yet, go click on stars!', + creator: 'creator', + slice: 'slice', + favorited: 'favorited', + slc_fav_column: ['slice', 'creator', 'favorited'], + dashboard: 'dashboard', + dash_fav_column: ['dashboard', 'creator', 'favorited'], + no_slices: "No slices", + no_dashboards: "No dashboards", + slc_create_column: ['slice', 'favorited'], + dash_create_column: ['dashboard', 'favorited'], + action: 'action', + item: 'item', + time: 'time', + recent_action_column: ['action', 'item', 'time'], + roles: 'Roles', + databases: 'Databases', + datasources: 'Datasources', + enter_slice_name: 'Please enter a slice name', + select_dashboard: 'Please select a dashboard', + enter_dashboard_name: 'Please enter a dashboard name', + overwrite_slice: 'Overwrite slice', + slice_name: '[slice name]', + save_go_dash: 'Save & go to dashboard', + save_a_slice: 'Save A Slice', + add_to_new_dash: 'Add to new dashboard', + do_not_add_to_dash: 'Do not add to a dashboard', + add_slice_to_existing_dash: 'Add slice to existing dashboard', + choose_slice_theme: 'Choose Slice Theme', + load_theme: 'Load a Theme', + china_map: 'China Map', + main_metric: 'Main Metric', + metric_show_legend: 'Show the metric of the legend', + min_legend: 'Legend minimum', + min_legend_desc: 'Enter the minimum value of the histogram', + max_legend: 'legend maximum', + max_legend_desc: 'Enter the maximum value of the histogram', + high: 'high', + low: 'low', + pick_at_least_groupby: 'Pick at least one field for [groupby]', + china_city_map: 'CHina City Map', + longitude: 'Longitude', + longitude_desc: 'Column containing longitude data', + latitude: 'Latitude', + latitude_desc: 'Column containing latitude data', + bar_column: 'Bar Column', + bar_column_desc: 'Column containing bar chart data', + echarts_quadrant: '[E]Quadrant', + origin_x_axis: 'Focus X Axis', + origin_x_axis_desc: 'Focus of the x axis coordinates', + origin_y_axis: 'Focus Y Axis', + origin_y_axis_desc: 'Focus of the y axis coordinates', + min_x_axis: 'Min X Axis', + min_x_axis_desc: 'Min X Axis', + max_x_axis: 'Max X Axis', + max_x_axis_desc: 'Max X Axis', + min_y_axis: 'Min Y Axis', + min_y_axis_desc: 'Min Y Axis', + max_y_axis: 'Max Y Axis', + max_y_axis_desc: 'Max Y Axis', + first_module_infor: 'First Module Information', + second_module_infor: 'Second Module Information', + third_module_infor: 'Third Module Information', + fourth_module_infor: 'Fourth Module Information', + sliceResizeAble: [ + ['true', 'true'], + ['false', 'false'] + ], + slice_resize_able: 'The window changes the size to refresh the slice', + subtitle: '[Subtitle]', +}; +export default en_US; diff --git a/superset/assets/javascripts/explore/stores/language.js b/superset/assets/javascripts/explore/stores/language.js new file mode 100644 index 000000000000..2a2d66220495 --- /dev/null +++ b/superset/assets/javascripts/explore/stores/language.js @@ -0,0 +1,23 @@ + +import zh_CN from '../stores/zh_CN'; +import en_US from '../stores/en_US'; +const $ = window.$ = require('jquery'); // eslint-disable-line + +export function chooseMessage() { + + function getLocale() { + const locale = $.ajax({ + url: '/superset/rest/api/getLocale', + async: false, + }); + return locale.responseText + } + switch (getLocale()) { + case 'en': + return en_US; + case 'zh': + return zh_CN; + default: + return en_US; + } +} diff --git a/superset/assets/javascripts/explore/stores/zh_CN.js b/superset/assets/javascripts/explore/stores/zh_CN.js new file mode 100644 index 000000000000..d59d5b070b91 --- /dev/null +++ b/superset/assets/javascripts/explore/stores/zh_CN.js @@ -0,0 +1,1396 @@ +const zh_CN = { + header_style: '表头样式', + table_style: '表样式', + col_style: '列样式:', + add_col_style: ' 添加列样式', + metric: '指标', + style: '样式', + threshold: '阀值', + icon: '图标', + base_style: '基本样式', + condition_style: '条件样式', + compare_style: '列间比较', + slice_navigator: '切片导航', + ag_setting: '复杂表格设置', + add_base_style: ' 添加基本样式', + add_condition_style: ' 添加条件样式', + add_compare_style: ' 添加列间比较', + add_slice_navigator: ' 添加导航', + grid_theme: '主题', + theme: '主题', + page_count: '页面条数', + count: '条数', + frozen_left: '冻结左边', + frozen_col: '选择列', + frozen_right: '冻结右边', + linkColumns: '链接列', + enable_piovttable: '启用透视', + add_table_header_setting: ' 添加表头设置', + metric1: '指标1', + metric2: '指标2', + compare_expressoin: '表达式(用x,y表示两列)', + iconChoices: [ + { key: '无', value: '' }, + { key: '上升(单箭头)', value: 'fa fa-arrow-up' }, + { key: '下降(单箭头)', value: 'fa fa-arrow-down' }, + { key: '上升(双箭头)', value: 'fa fa-angle-double-up' }, + { key: '下降(双箭头)', value: 'fa fa-angle-double-down' }, + { key: '条形图', value: 'fa fa-bar-chart' }, + { key: '折线图', value: 'fa fa-line-chart' }, + { key: '饼状图', value: 'fa fa-pie-chart' }, + { key: '区域图', value: 'fa fa-area-chart' }, + ], + navigateChoices: [ + { key: '报表', value: 'dashboard' }, + { key: '切片', value: 'slice' }, + ], + openChoices: [ + { key: '弹框', value: 'modal' }, + { key: '新窗口', value: 'newWindow' }, + ], + navigate_slice: '导航到切片', + navigate_dashboard: '导航到报表', + width: '宽度', + height: '高度', + navigate_type: '导航类型', + open_type: '打开方式', + datasource: '数据源', + viz: '图形', + metrics: '指标', + metrics_to_display: '要显示的一个或多个指标', + hide_options: '隐藏选项', + metrics_one: '指标1', + metrics_two: '指标2', + ordring: '排序', + choose_metric: '选择指标', + stacked_style: '堆叠样式', + stacked_style_choices: [ + ['stack', '堆栈'], + ['stream', '喷射'], + ['expand', '扩展'], + ], + linear_color_scheme: '线性颜色方案', + linear_color_scheme_choices: [ + ['fire', '火焰'], + ['blue/white/yellow', '蓝白黄'], + ['white/black', '白黑'], + ['black/white', '黑白'], + ], + normalize_across: '标准化', + normalize_across_choices: [ + ['heatmap', '热力图'], + ['x', 'x'], + ['y', 'y'], + ], + normalize_across_description: + '颜色将根据比例进行渲染', + horizon_color_scale: '水平线线色标', + horizon_color_scale_choices: [ + ['series', '项目'], + ['overall', '综合'], + ['change', '变化'], + ], + horizon_color_scale_description: '定义颜色属性', + rendering: '渲染', + + canvas_image_rendering_choices: [ + ['pixelated', '像素化(锐利)'], + ['auto', '自动(平滑)'], + ], + canvas_image_rendering_description: + '浏览器渲染图片的方式', + xscale_interval: 'X轴步长', + xscale_interval_description: 'X轴每个刻度的单位长度', + yscale_interval: 'Y轴步长', + yscale_interval_description: 'Y轴每个刻度的单位长度', + bar_stacked: '堆积', + show_markers: '显示标记', + show_markers_description: '将数据点显示为线上的圆圈标记', + show_bar_value: '柱状图的值', + show_bar_value_description: '显示柱状图顶部的值', + order_bars: '是否排序', + order_bars_description: '根据X轴排序', + show_controls: '扩展控件', + show_controls_desc: '是否显示扩展控件', + reduce_x_ticks: 'X轴自适应', + reduce_x_ticks_desc: '当X轴显示不下时,自动调整X轴步长', + include_series: '显示项目', + include_series_desc: '坐标上显示项目名称', + secondary_metric: '颜色度量', + secondary_metric_desc: '颜色度量项目', + country_fieldtype: '国家名称编码方式', + country_fieldtype_choices: [ + ['name', '全名'], + ['cioc', '国际奥委会编码(cioc)'], + ['cca2', 'ISO 3166-1 alpha-2编码(cca2)'], + ['cca3', 'ISO 3166-1 alpha-3编码(cca3)'], + ], + country_fieldtype_default: 'ISO 3166-1 alpha-2编码(cca2)', + country_fieldtype_desc: '数据库中国家名称类型', + groupby: '分组', + groupby_desc: '根据一个或多个字段分组', + columns: '列', + columns_desc: '将一个或多个字段做为列', + all_columns: '列', + all_columns_desc: '显示列', + columns_to_display: '显示列', + origin: '起点', + druid_time_origin_choices: [ + ['', '默认'], + ['now', '现在'], + ], + druid_time_origin_desc: '定义时间起点,支持`now`, `sunday` or `1970-01-01`等', + bottom_margin: '底部留白', + bottom_margin_desc: '底部留白的像素大小', + granularity: '时间粒度', + granularity_choices: [ + ['all', '全部'], + ['5 seconds', '5秒'], + ['30 seconds', '30秒'], + ['1 minute', '1分钟'], + ['5 minutes', '5分钟'], + ['1 hour', '1小时'], + ['6 hour', '6小时'], + ['1 day', '1天'], + ['7 days', '7天'], + ['week', '一周'], + ['week_starting_sunday', '周日开始的一周'], + ['week_ending_saturday', '以周六结束的一周'], + ['month', '月'], + ], + granularity_default: '1天', + granularity_desc: '图表时间粒度。可以使用`10 seconds`, `1 day`, `56 weeks`等', + domain_granularity: '区域', + domain_granularity_choices: [ + ['hour', '小时'], + ['day', '天'], + ['week', '周'], + ['month', '月'], + ['year', '年'], + ], + domain_granularity_default: '月', + domain_granularity_desc: '每个区域表示的时间段', + subdomain_granularity: '方块', + subdomain_granularity_choices: [ + ['min', '分钟'], + ['hour', '小时'], + ['day', '天'], + ['week', '周'], + ['month', '月'], + ], + subdomain_granularity_default: '天', + subdomain_granularity_desc: '每个区域内方块表示的时间段。必须比区域时间段小,比时间粒度大。', + link_length: '链接长度', + link_length_desc: '有向图中的链接长度', + charge: '缩放', + charge_desc: '有向图缩放大小', + granularity_sqla: '时间字段', + granularity_sqla_desc: '图表中的时间字段。可以在表格编辑器中返回任意DATETIME列。', + time_grain_sqla: '时间粒度', + time_grain_sqla_default: '时间列', + time_grain_sqla_desc: '图表中的时间粒度。用于替换时间字段默认的时间粒度。', + resample_rule: '重采样尺度', + resample_rule_desc: '重采样尺度', + resample_how: '重采样方式', + resample_how_choices: [ + ['', ''], + ['mean', '平均值'], + ['sum', '求和'], + ['median', '中间值'], + ], + resample_how_desc: '重采样方式', + resample_fillmethod: '插值方式', + resample_fillmethod_choices: ['', 'ffill', 'bfill'], + resample_fillmethod_desc: '重采样插值方式', + since: '起始时间', + since_choices: [ + ['1 hour ago', '一小时前'], + ['12 hours ago', '十二小时前'], + ['1 day ago', '一天前'], + ['7 days ago', '七天前'], + ['28 days ago', '二十八天前'], + ['90 days ago', '九十天前'], + ['1 year ago', '一年前'], + ['100 year ago', '很久以前'], + ], + since_default: '七天前', + since_desc: '时间范围。', + until: '结束时间', + until_choices: [ + ['now', '现在'], + ['1 day ago', '一天前'], + ['7 days ago', '七天前'], + ['28 days ago', '二十八天前'], + ['90 days ago', '九十天前'], + ['1 year ago', '一年前'], + ], + until_default: '现在', + max_bubble_size: '气泡最大尺寸', + whisker_options: '非异常值选项', + whisker_options_choices: [ + ['Tukey', '图基法'], + ['Min/max (no outliers)', '最小/最大值(无异常值)'], + ['2/98 percentiles', '2/98百分比'], + ['9/91 percentiles', '9/91百分比'], + ], + whisker_options_default: '图基法', + whisker_options_desc: '计算最大/最小非异常值的方法', + treemap_ratio: '比例', + treemap_ratio_desc: '树状图中方块的比例', + number_format: '数字格式', + row_limit: '行数上限', + limit: '项目上限', + limit_desc: '设置显示项目的数量上限', + timeseries_limit_metric: '排序', + timeseries_limit_metric_desc: '指标用于定义顶级项目', + rolling_type: '滚动', + rolling_type_choices: [ + ['None', '无'], + ['mean', '平均值'], + ['sum', '求和'], + ['std', '标准差'], + ['cumsum', '累加'], + ], + rolling_type_default: '无', + rolling_type_desc: '滚动窗口聚合函数,配合[周期]使用', + rolling_periods: '周期', + rolling_periods_desc: '滚动窗口大小,取值和时间粒度相关', + series: '项目', + series_desc: '定义分组实体。每个项目有特定的颜色和图例。', + entity: '实体', + entity_desc: '在图表上绘制的元素', + x: 'X轴', + x_desc: 'X轴对应的项目', + y: 'Y轴', + y_desc: 'Y轴对应的项目', + size: '气泡大小', + url_desc: 'URL,此字段是模板化的,因此您可以集成{{width}}和/或{{height}}您的URL字符串中。', + x_axis_label: 'X轴名称', + y_axis_label: 'Y轴名称', + where: 'WHERE语句', + where_desc: '语句将包含到WHERE子句中,并用AND连接到其他条件。', + having: 'HAVING语句', + having_desc: '语句将包含到HAVE子句中,并用AND连接到其他条件', + compare_lag: '滞后比较周期', + compare_lag_desc: '比较的时间周期,基于时间粒度', + compare_suffix: '后缀文字', + compare_suffix_desc: '百分比后面显示的文本', + table_timestamp_format: '时间格式', + table_timestamp_format_desc: '时间格式', + series_height: '项目高度', + series_height_desc: '每个项目的像素高度', + page_length: '页面长度', + page_length_desc: '每页行数,0表示无分页', + x_axis_format: 'X轴数值格式', + y_axis_format: 'Y轴数值格式', + markup_type: '标记类型', + markup_type_choices: [ + ['markdown', '简化'], + ['html', 'HTML'], + ], + markup_type_default: '简化', + markup_type_desc: '选择标记语言', + rotation: '旋转', + rotation_choices: [ + ['random', '随机'], + ['flat', 'flat'], + ['square', '方格'], + ], + rotation_default: '随机', + rotation_desc: '词汇云中词语的旋转方式', + line_interpolation: '线形', + line_interpolation_desc: '定义线形', + line_interpolation_choices: [ + ['linear', '折线'], + ['basis', 'B样条曲线'], + ['cardinal', '基本样条曲线'], + ['monotone', '三次插值曲线'], + ['step-before', '前阶梯线'], + ['step-after', '后阶梯线'], + ], + line_interpolation_default: '折线', + pie_label_type: '标签类型', + pie_label_type_choices: [ + ['键', 'Category Name'], + ['值', 'Value'], + ['百分比', 'Percentage'], + ], + pie_label_type_default: '键', + pie_label_type_desc: '标签上应该显示什么?', + code: '代码', + code_desc: '输入代码', + pandas_aggfunc: '聚合函数', + pandas_aggfunc_choices: [ + ['sum', '求和'], + ['mean', '平均值'], + ['min', '最小值'], + ['max', '最大值'], + ['median', '中间值'], + ['stdev', '标准差'], + ['var', '变量值'], + ], + pandas_aggfunc_default: '求和', + pandas_aggfunc_desc: '透视时计算行和列的聚合函数', + size_from: '最小字体', + size_from_desc: '列表中最小值的字体大小', + size_to: '最大字体', + size_to_desc: '列表中最大值的字体大小', + show_brush: '区间过滤', + show_brush_desc: '是否显示时间区间选择控件', + date_filter: '时间过滤器', + date_filter_desc: '是否包含时间过滤器', + show_datatable: '明细表', + show_datatable_desc: '是否显示明细表', + include_search: '搜索框', + include_search_desc: '是否显示搜索框', + table_filter: '表格过滤器', + table_filter_desc: '是否显示表格过滤器', + show_bubbles: '显示气泡', + show_bubbles_desc: '是否在国家上显示气泡', + show_legend: '图例', + show_legend_desc: '是否显示图例', + x_axis_showminmax: 'X轴边界', + x_axis_showminmax_desc: '是否显示X轴的最大最小值', + rich_tooltip: '详细信息', + rich_tooltip_desc: '显示特定时间点的所有项目', + y_axis_zero: 'Y轴从0开始', + y_axis_zero_desc: 'Y轴不是从最小值开始', + y_log_scale: 'Y轴对数', + y_log_scale_desc: '对Y轴使用对数刻度', + x_log_scale: 'X轴对数', + x_log_scale_desc: '对X轴使用对数刻度', + donut: '环形图', + donut_desc: '使用环形图替代饼图', + labels_outside: '把标签放在外面', + labels_outside_desc: '是否把标签放在饼图外面', + contribution: '贡献值', + contribution_desc: '在总和中的贡献值', + num_period_compare: '周期比', + num_period_compare_desc: '[整数]要比较的周期数,和粒度有关', + period_ratio_type: '周期比类型', + period_ratio_type_choices: [ + ['factor', '因子'], + ['growth', '增长'], + ['value', '值'], + ], + period_ratio_type_default: '增长', + period_ratio_type_desc: '`因子` 表示(new / previous),`growth`是((new / previous) - 1),' + + '`value`是(new-previous)', + time_compare: '时间飘移', + time_compare_desc: '相关时间周期内的时间偏移。相对时间,如: 24 hours, 7 days, 56 weeks, 365 days', + subheader: '子标题', + subheader_desc: '在数字下显示的文本', + fontSize: '字体大小', + mapbox_label: '标签', + mapbox_label_desc: '对分组使用COUNT(*)。', + mapbox_style: '图层样式', + mapbox_style_desc: '基本图层样式', + clustering_radius: '簇半径', + clustering_radius_desc: '定义簇的半径大小(单位为像素)。0表示不显示簇。大量的点会导致显示缓慢。', + point_radius: '点半径', + point_radius_desc: '不在簇中点的半径。选择`Auto`时根据最大的簇自动调整。', + point_radius_unit: '点半径单位', + point_radius_unit_choices: [ + ['Pixels', '像素'], + ['Miles', '英里'], + ['Kilometers', '公里'], + ], + point_radius_unit_default: '像素', + point_radius_unit_desc: '点半径的测量单位', + global_opacity: '不透明度', + global_opacity_desc: '所有簇、点和标签的不透明度。在1和0之间。', + viewport_zoom: '縮放', + viewport_zoom_desc: '地图的缩放级别', + viewport_latitude: '默认纬度', + viewport_latitude_desc: '视窗默认纬度', + viewport_longitude: '默认经度', + viewport_longitude_desc: '视窗默认经度', + render_while_dragging: '实时更新', + render_while_dragging_desc: '视窗发生改变时,点和簇实时更新', + mapbox_color: 'RGB 颜色', + mapbox_color_desc: 'RGB 分簇的颜色', + ranges: '范围', + ranges_desc: '范围用阴影高亮显示', + range_labels: '范围标签', + range_labels_desc: '范围标签', + markers: '标记', + markers_desc: '用三角形标记的值列表', + marker_labels: '标记标签', + marker_labels_desc: '标记标签', + marker_lines: '标记线', + marker_lines_desc: '用线条标记的值列表', + marker_line_labels: '线条标记的标签', + marker_line_labels_desc: '标记线的标签', + line: '行', + line_desc: '一行或多行显示', + bar: '块', + bar_desc: '一块或多块显示', + area: '区域', + area_desc: '一个或多个区域显示', + scatter: '散点', + scatter_desc: '一个或多个散点显示', + yAxis: 'Y轴', + yAxis_desc: '选择Y轴', + y_axis_label1: 'Y1轴标签', + y_axis_label2: 'Y2轴标签', + y_domain1: 'Y1轴的域', + y_domain2: 'Y2轴的域', + y_domain1_desc: 'y1的范围,例如:0,100,表示从0到100', + y_domain2_desc: 'y2的范围,例如:0,100,表示从0到100', + bar_horizontal: '横向柱状图', + d3_format_docs: '自定义格式请参考 https://github.com/mbostock/d3/wiki/Formatting', + select_column: '选择过滤字段', + select_operato: '选择过滤方式', + filter_value: '过滤值', + choose_chart: '选择图形', + base_chart: '基础图形', + bar_chart: '条形图', + line_chart: '线形图', + area_chart: '面积图', + advanced_chart: '高级图', + measurement_chart: '计量图', + big_chart: '大字图', + map_chart: '地图', + other_chart: '其他', + filter_box: '提示器', + table: '表格', + pivot_table: '数据透视表', + dist_bar: '条形图', + bar2: '条形图(T)', + multi: '线形图', + line2: '线形图(T)', + linePlusBar: '线形图(S)', + compare: '线形图(VS)', + linePlusBar1: '条线图', + area2: '面积图', + area1: '面积图(T)', + pie: '饼形图', + bubble: '气泡图', + radar: '雷达图', + scatter_chart: '散点图', + sankey: '蛇形图', + directed_force: '拓扑图', + horizon: '热力图', + mapbox: '热力图', + treemap: '树状图', + box_plot: '箱体图', + para: '帕拉图', + cal_heatmap: '日历图', + sunburst: '环形图', + big_number: '大字图', + big_number_total: '大字图(T)', + bullet: '子弹图', + dash: '仪表图', + world_cloud: '云字图', + world_map: '世界地图', + markup1: '叙述', + markup: '标记', + iframe: 'iframe', + separator: '分隔器', + echarts_bar: '[E]柱状图', + echarts_line: '[E]折线图', + echarts_line_bar: '[E]柱状折线图', + echart_line_bar: '[E]柱状折线图', + line_bar: '折线指标 和 柱状指标', + line_bar_desc: '折线指标 和 柱状指标', + bar_choice: '柱状指标', + line_choice: '折线指标', + bar_choice_desc: '柱状指标', + line_choice_desc: '折线指标, 其他为柱状指标', + echart_chart: 'Echart', + + menu_viztype: [ + { chart: 'area', icon: 'fa fa-area-chart', name: '饼图'}, + { chart: 'bar', icon: 'fa fa-bar-chart', name: '柱状图' }, + { chart: 'big_number', icon: 'fa fa-header', name: '大字图' }, + { chart: 'big_number_total', icon: 'fa fa-header', name: '大字图(合计)' }, + { chart: 'box_plot', icon: 'fa fa-bar-chart', name: '箱形图' }, + { chart: 'bubble', icon: 'fa fa-bar-chart', name: '水泡图' }, + { chart: 'bullet', icon: 'fa fa-bar-chart', name: '子弹图' }, + { chart: 'cal_heatmap', icon: 'fa fa-bar-chart', name: '日历热力图' }, + { chart: 'compare', icon: 'fa fa-line-chart', name: '对比图' }, + { chart: 'directed_force', icon: 'fa fa-bar-chart', name: '力导向' }, + { chart: 'dist_bar', icon: 'fa fa-bar-chart', name: '柱状图' }, + { chart: 'filter_box', icon: 'fa fa-check-square', name: '提示器' }, + { chart: 'heatmap', icon: 'fa fa-bar-chart', name: '热力图' }, + { chart: 'histogram', icon: 'fa fa-bar-chart', name: '柱状图' }, + { chart: 'horizon', icon: 'fa fa-bar-chart', name: '地平线图' }, + { chart: 'iframe', icon: 'fa fa-columns', name: '叙述' }, + { chart: 'line', icon: 'fa fa-line-chart', name: '折线图' }, + { chart: 'mapbox', icon: 'fa fa-bar-chart', name: '箱体图' }, + { chart: 'markup', icon: 'fa fa-bar-chart', name: '标记' }, + { chart: 'para', icon: 'fa fa-bar-chart', name: '帕拉图' }, + { chart: 'pie', icon: 'fa fa-pie-chart', name: '饼图' }, + { chart: 'pivot_table', icon: 'fa fa-table', name: '数据透视表' }, + { chart: 'sankey', icon: 'fa fa-bar-chart', name: '蛇形图' }, + { chart: 'separator', icon: 'fa fa-bar-chart', name: '分割线' }, + { chart: 'sunburst', icon: 'fa fa-bar-chart', name: '旭日图' }, + { chart: 'table', icon: 'fa fa-table', name: '表格' }, + { chart: 'treemap', icon: 'fa fa-bar-chart', name: '树状图' }, + { chart: 'word_cloud', icon: 'fa fa-bar-chart', name: '文字云' }, + { chart: 'world_map', icon: 'fa fa-map-marker', name: '世界地图' }, + { chart: 'echarts_china_map', icon: 'fa fa-map-marker', name: '中国地图' }, + { chart: 'china_city_map', icon: 'fa fa-map-marker', name: '中国城市地图' }, + { chart: 'linePlusBar', icon: 'fa fa-line-chart', name: '折线柱状图' }, + { chart: 'multi', icon: 'fa fa-line-chart', name: '折线柱状图(混合)' }, + { chart: 'ag_grid', icon: 'fa fa-table', name: 'AG Grid' }, + { chart: 'echarts_bar', icon: 'fa fa-bar-chart', name: '[E]柱状图' }, + { chart: 'echarts_bar_h', icon: 'fa fa-bar-chart', name: '[E]柱状图(横)' }, + { chart: 'echarts_bar_progress', icon: 'fa fa-bar-chart', name: '[E]柱状进度图' }, + { chart: 'echarts_bar_waterfall', icon: 'fa fa-bar-chart', name: '[E]瀑布柱状图' }, + { chart: 'echarts_line', icon: 'fa fa-line-chart', name: '[E]折线图' }, + { chart: 'echarts_line_bar', icon: 'fa fa-line-chart', name: '[E]柱状折线图' }, + { chart: 'echarts_pie_m', icon: 'fa fa-pie-chart', name: '[E]饼图(指标比例)' }, + { chart: 'echarts_pie_h', icon: 'fa fa-pie-chart', name: '[E]饼图(嵌套)' }, + { chart: 'echarts_pie_g', icon: 'fa fa-pie-chart', name: '[E]饼图(分组)' }, + { chart: 'echarts_pie_h_g', icon: 'fa fa-pie-chart', name: '[E]饼图(嵌套分组)' }, + { chart: 'echarts_radar_map', icon: 'fa fa-globe', name: '[E]雷达图' }, + { chart: 'echarts_dash_board', icon: 'fa fa-tachometer', name: '[E]仪表盘' }, + { chart: 'echarts_big_number', icon: 'fa fa-tachometer', name: '[E]大字图' }, + { chart: 'echarts_big_number_compare', icon: 'fa fa-tachometer', name: '[E]大字对比图' }, + { chart: 'echarts_bubble', icon: 'fa fa-tachometer', name: '[E]气泡图' }, + { chart: 'echarts_word_cloud', icon: 'fa fa-file-word-o icon-span', name: '[E]文字云' }, + { chart: 'echarts_quadrant', icon: 'fa fa-file-word-o icon-span', name: '[E]象限图' }, + ], + + current_chart: '当前图形:', + where_clause: 'Where 子句', + having_clause: 'Having 子句', + input_parent_node: '输入父节点名称', + child_node: '子节点', + parent_node: '父节点', + choose_child_node: '选择子节点', + choose_option: '选择显示项', + show_option: '显示项', + choose_groupby_option: '选择 groupby 项', + choose_column_option: '选择 column 项', + measure: '度量', + choose_value_option: '选择 value 项', + setting_style: '设置样式', + column_style: '字段样式', + add_column_style: '添加字段样式', + base_setting: '基本设置', + field_default: '字段缺省值', + date_default: '日期缺省值', + add_default: '添加缺省值', + field: '字段', + length: '长度', + isMulti: '是否多选', + typeChoices: [ + { key: '从集合中选择缺省值', value: 'true' }, + { key: '从sql语句中查询缺省值集合', value: 'false' }, + ], + choose_default_value: '缺省值选择', + default_value: '缺省值', + default_value_desc: '填写缺省值, 中间用英文逗号间隔', + sql: 'sql语句', + default_sql: 'sql获取缺省值', + type: '类型', + from: '开始日期', + to: '截止日期', + add_filter: '增加过滤条件', + bar_stack: '柱状图堆叠', + add_barStack: '增加柱状图堆叠', + stack_name: '堆叠名称', + only_left: '仅左Y轴', + only_left_desc: '仅显示左边Y轴.', + only_bottom: '仅下X轴', + only_bottom_desc: '仅显示下边X轴.', + y_axis_metrics: 'Y轴指标', + y_axis_metrics_desc: 'Y轴指标', + y_axis_format: 'Y轴样式', + y_axis_format_desc: 'Y轴样式. 例如:{value}', + y_axis_degree: 'Y轴刻度', + y_axis_degree_desc: 'Y轴刻度.例如:{"min":0,"max":100}', + y_axis_name: 'Y轴名称', + y_axis_name_desc: 'Y轴名称.', + + x_axis_metrics: 'X轴指标', + x_axis_metrics_desc: 'X轴指标', + x_axis_format: 'X轴样式', + x_axis_format_desc: 'X轴样式. 例如:{value}', + x_axis_degree: 'X轴刻度', + x_axis_degree_desc: 'X轴刻度.例如:{"min":0,"max":100}', + x_axis_name: 'X轴名称', + x_axis_name_desc: 'X轴名称.', + + y_left_metrics: '左Y轴指标', + y_left_metrics_desc: '左Y轴指标', + y_right_metrics: '右Y轴指标', + y_right_metrics_desc: '右Y轴指标', + y_left_format: '左Y轴格式', + y_left_format_desc: '左Y轴格式. 对应指标顺序. 例如:{value};{value}', + y_right_format: '右Y轴格式', + y_right_format_desc: '右Y轴格式. 对应指标顺序. 例如:{value};{value}', + y_left_degree: '左Y轴刻度', + y_left_degree_desc: '左Y轴刻度. 对应指标顺序. 例如:{"min":0,"max":100};{"min":0,"max":100};', + y_right_degree: '右Y轴刻度', + y_right_degree_desc: '右Y轴刻度. 对应指标顺序. 例如:{"min":0,"max":100};{min:0,"max":100};', + + x_bottom_metrics: '下X轴指标', + x_bottom_metrics_desc: '下X轴指标', + x_top_metrics: '上X轴指标', + x_top_metrics_desc: '上X轴指标', + x_bottom_format: '下X轴格式', + x_bottom_format_desc: '下X轴格式. 对应指标顺序. 例如:{value};{value}', + x_top_format: '上X轴格式', + x_top_format_desc: '上X轴格式. 对应指标顺序. 例如:{value};{value}', + x_bottom_degree: '下X轴刻度', + x_bottom_degree_desc: '下X轴刻度. 对应指标顺序. 例如:{"min":0,"max":100};{"min":0,"max":100};', + x_top_degree: '上X轴刻度', + x_top_degree_desc: '上X轴刻度. 对应指标顺序. 例如:{"min":0,"max":100};{"min":0,"max":100};', + + top_padding: '上边距', + top_padding_desc: '上边距', + bottom_padding: '下边距', + bottom_padding_desc: '下边距', + left_padding: '左边距', + left_padding_desc: '左边距', + right_padding: '右边距', + right_padding_desc: '右边距', + is_avg: '显示平均值', + is_avg_desc: '显示平均值.', + is_max_min: '显示最大最小值', + is_max_min_desc: '显示最大最小值.', + is_bar_value: '显示数值', + is_bar_value_desc: '显示数值.', + is_stack: '是否堆叠', + + + + // viz_type + + druidTimeSeries: '时间', + druidTimeSeries_fieldSetRows: [ + ['granularity', 'druid_time_origin'], + ['since', 'until'], + ], + druidTimeSeries_desc: '时间相关的属性', + datasourceAndVizType: '数据源和图表类型', + datasourceAndVizType_fieldSetRows: [ + ['datasource'], + ['viz_type'], + ], + sqlaTimeSeries: '时间', + sqlaTimeSeries_fieldSetRows: [ + ['granularity_sqla', 'time_grain_sqla'], + ['since', 'until'], + ], + sqlaTimeSeries_desc: '时间相关的属性', + sqlClause: 'SQL', + sqlClause_fieldSetRows: [ + ['where', 'having'], + ], + sqlClause_desc: '用于定制SQL语句', + NVD3TimeSeries: '高级分析', + NVD3TimeSeries_fieldSetRows1: [ + ['metrics'], + ['groupby'], + ['limit', 'timeseries_limit_metric'], + ], + NVD3TimeSeries_desc: '使用高级分析选项', + NVD3TimeSeries_fieldSetRows2: [ + ['rolling_type', 'rolling_periods'], + ['time_compare'], + ['num_period_compare', 'period_ratio_type'], + ['resample_how', 'resample_rule'], + ['resample_fillmethod'], + ], + filters1: '筛选', + filters1_desc: '使用逗号分隔多个过滤条件,如`US,FR,Other`', + filters2: '结果过滤器', + filters2_desc: '后汇总后应用的过滤器。将值字段留空以过滤空字符串或空值', + chart_options: '图表选项', + dist_bar_viz: '分布-柱状图', + dist_bar_viz_fieldSetRows: [ + ['metrics'], + ['groupby'], + ['columns'], + ['row_limit'], + ['show_legend', 'show_bar_value'], + ['bar_stacked', 'order_bars'], + ['y_axis_format', 'bottom_margin'], + ['x_axis_label', 'y_axis_label'], + ['reduce_x_ticks', 'contribution'], + ['show_controls', 'bar_horizontal'], + ], + tooltip_text: '提示文本', + breakDowns: '拆分', + breakDowns_desc: '项目的拆分方式', + ag_grid: '复杂表格', + ag_grid1_fieldSetRows: [ + ['groupby', 'metrics'], + ], + ag_grid1_desc: '进行聚合查询', + ag_grid2: '选项', + ag_grid2_fieldSetRows: [ + ['表时间戳格式'], + ['行数限制'], + ['排序列'], + ], + linePlusBar_viz: '分布-柱状折线图', + linePlusBar_viz_fieldSetRows: [ + ['groupby'], + ['metrics'], + ['row_limit', 'bottom_margin'], + ['x_axis_label', 'x_axis_format'], + ['y_axis_label1', 'y_axis_format1'], + ['y_axis_label2', 'y_axis_format2'], + ['reduce_x_ticks', 'contribution'], + ], + multi_viz: '分布-多图', + multi_viz_fieldSetRows: [ + ['groupby'], + ['line', 'yAxis1'], + ['bar', 'yAxis2'], + ['area', 'yAxis3'], + ['scatter', 'yAxis4'], + ['row_limit', 'bottom_margin'], + ['x_axis_label', 'x_axis_format'], + ['y_axis_label1', 'y_axis_format1'], + ['y_axis_label2', 'y_axis_format2'], + ['y_domain1', 'y_domain2'], + ['reduce_x_ticks', 'contribution'], + ], + pie_viz: '饼图', + pie_viz_fieldSetRows: [ + ['metrics', 'groupby'], + ['limit'], + ['pie_label_type'], + ['donut', 'show_legend'], + ['labels_outside'], + ], + line_viz: '时间序列-折线图', + line_viz_fieldSetRows: [ + ['show_brush', 'show_legend'], + ['rich_tooltip', 'y_axis_zero'], + ['y_log_scale', 'contribution'], + ['show_markers', 'x_axis_showminmax'], + ['line_interpolation'], + ['x_axis_format', 'y_axis_format'], + ['x_axis_label', 'y_axis_label'], + ], + bar_viz: '时间序列-柱状图', + bar_viz_fieldSetRows: [ + ['show_brush', 'show_legend', 'show_bar_value'], + ['rich_tooltip', 'y_axis_zero'], + ['y_log_scale', 'contribution'], + ['x_axis_format', 'y_axis_format'], + ['line_interpolation', 'bar_stacked'], + ['x_axis_showminmax', 'bottom_margin'], + ['x_axis_label', 'y_axis_label'], + ['reduce_x_ticks', 'show_controls'], + ], + compare_viz: '时间序列-百分比变化', + area_viz: '时间序列-堆积图', + area_viz_fieldSetRows: [ + ['show_brush', 'show_legend'], + ['rich_tooltip', 'y_axis_zero'], + ['y_log_scale', 'contribution'], + ['x_axis_format', 'y_axis_format'], + ['x_axis_showminmax', 'show_controls'], + ['line_interpolation', 'stacked_style'], + ], + table_viz: '表视图', + table_viz_fieldSetRows: [ + ['table_timestamp_format'], + ['row_limit'], + ['page_length'], + ['order_by_cols'], + ['include_search', 'table_filter'], + ], + markup_fieldSetRows: [ + ['markup_type', 'code'], + ], + pivot_table_viz: '透视表', + pivot_table_viz_fieldSetRows: [ + ['groupby', 'columns'], + ['metrics', 'pandas_aggfunc'], + ], + separator_fieldSetRows: [ + ['code'], + ], + word_cloud_viz: '词汇云', + world_cloud_fieldSetRows: [ + ['series', 'metric', 'limit'], + ['size_from', 'size_to'], + ['rotation'], + ], + treemap_fieldSetRows1: [ + ['metrics'], + ['groupby'], + ], + treemap_fieldSetRows2: [ + ['treemap_ratio'], + ['number_format'], + ], + cal_heatmap_viz: '时间热力图', + cal_heatmap_viz_fieldSetRows: [ + ['metric'], + ['domain_granularity'], + ['subdomain_granularity'], + ], + box_plot_fieldSetRows: [ + ['metrics'], + ['groupby', 'limit'], + ], + bubble_viz: '气泡图', + bubble_viz_fieldSetRows1: [ + ['series', 'entity'], + ['x', 'y'], + ['size', 'limit'], + ], + bubble_viz_fieldSetRows2: [ + ['x_log_scale', 'y_log_scale'], + ['show_legend'], + ['max_bubble_size'], + ['x_axis_label', 'y_axis_label'], + ], + bullet_viz: '子弹图', + bullet_viz_fieldSetRows: [ + ['metric'], + ['ranges', 'range_labels'], + ['markers', 'marker_labels'], + ['marker_lines', 'marker_line_labels'], + ], + big_number_viz: '数字和趋势线', + big_number_viz_fieldSetRows: [ + ['metric'], + ['compare_lag'], + ['compare_suffix'], + ['y_axis_format'], + ], + big_number_total_fieldSetRows: [ + ['metric'], + ['subheader'], + ['y_axis_format'], + ], + histogram: '直方图', + histogram_fieldSetRows1: [ + ['all_columns_x'], + ['row_limit'], + ], + histogram2: '直方图选项', + histogram_fieldSetRows2: [ + ['link_length'], + ], + all_columns_x: '数字列', + all_columns_x_desc: '选择数字列来绘制直方图', + link_length1: '不分组', + link_length1_desc: '选择直方图的数量', + sunburst_fieldSetRows: [ + ['groupby'], + ['metric', 'secondary_metric'], + ['row_limit'], + ], + sunburst_metric: '主指标', + sunburst_metric_desc: '主要指标用来定义的弧段尺寸', + sunburst_secondary_metric: '次指标', + sunburst_secondary_metric_desc: '次指标用于定义相对主指标的颜色', + sunburst_groupby: '层次', + sunburst_groupby_desc: '定义层次', + sankey_fieldSetRows: [ + ['groupby'], + ['metric'], + ['row_limit'], + ], + sankey_groupby: '源/目标', + sankey_groupby_desc: '选择源和目标', + directed_force_viz: '有向图', + directed_force_viz_fieldSetRows1: [ + ['groupby'], + ['metric'], + ['row_limit'], + ], + directed_force_viz2: '有向图', + directed_force_viz_fieldSetRows2: [ + ['link_length'], + ['charge'], + ], + world_map_fieldSetRows: [ + ['entity'], + ['country_fieldtype'], + ['metric'], + ], + world_map_bubbles: '气泡', + world_map_bubbles_fieldSetRows: [ + ['show_bubbles'], + ['secondary_metric'], + ['max_bubble_size'], + ], + world_map_entity: '国家', + world_map_entity_desc: '3位国家码', + world_map_metric: '色彩度量项', + world_map_metric_desc: '国家颜色表示的统计项', + world_map_secondary_metric: '气泡大小', + world_map_secondary_metric_desc: '气泡大小表示的度量项', + filter_box_fieldSetRows: [ + ['date_filter'], + ['groupby'], + ['metric'], + ], + filter_box_groupby: '筛选条件', + filter_box_groupby_desc: '筛选字段', + para_viz: '平行坐标', + para_viz_fieldSetRows: [ + ['series'], + ['metrics'], + ['secondary_metric'], + ['limit'], + ['show_datatable', 'include_series'], + ], + heatmap_viz: '热力图', + heatmap_viz_label: '轴和度量', + heatmap_viz_fieldSetRows1: [ + ['all_columns_x'], + ['all_columns_y'], + ['metric'], + ], + heatmap_viz2: '热力图选项', + heatmap_viz_fieldSetRows2: [ + ['linear_color_scheme'], + ['xscale_interval', 'yscale_interval'], + ['canvas_image_rendering'], + ['normalize_across'], + ], + horizon_fieldSetRows: [ + ['series_height', 'horizon_color_scale'], + ], + mapbox_fieldSetRows: [ + ['all_columns_x', 'all_columns_y'], + ['clustering_radius'], + ['row_limit'], + ['groupby'], + ['render_while_dragging'], + ], + mapbox2: '点', + mapbox_fieldSetRows2: [ + ['point_radius'], + ['point_radius_unit'], + ], + mapbox3: '标记', + mapbox_fieldSetRows3: [ + ['mapbox_label'], + ['pandas_aggfunc'], + ], + mapbox4: '视觉调整', + mapbox_fieldSetRows4: [ + ['mapbox_style'], + ['global_opacity'], + ['mapbox_color'], + ], + mapbox5: '视图(Viewport)', + mapbox_fieldSetRows5: [ + ['viewport_longitude'], + ['viewport_latitude'], + ['viewport_zoom'], + ], + mapbox_all_columns_x: '经度', + mapbox_all_columns_x_desc: '表示经度的列', + mapbox_all_columns_y: '纬度', + mapbox_all_columns_y_desc: '表示纬度的列', + mapbox_pandas_aggfunc: '聚合标签', + mapbox_pandas_aggfunc_desc: '聚合函数用于集群标签', + mapbox_rich_tooltip: '提示', + mapbox_rich_tooltip_desc: '鼠标放在集群上时显示的提示信息', + mapbox_groupby_desc: '按照一个或多个字段分组。必须指定经度和纬度。', + + echart_bar: '[E]柱状图', + metrics_and_dim: '指标和维度', + metrics_and_dim_desc: '指标和维度', + muti_y_axis: '多Y轴', + muti_y_axis_desc: '多Y轴', + muti_x_axis: '多X轴', + muti_x_axis_desc: '多X轴', + padding: '边距', + padding_desc: '边距', + other_option: '其他配置项', + other_option_desc: '其他配置项', + x_axis: 'X轴', + y_axis: 'Y轴', + + echarts_bar_h: '[E]柱状图(横)', + echarts_bar_progress: '[E]柱状进度图', + echarts_bar_waterfall: '[E]瀑布柱状图', + echarts_pie_m: '[E]饼图(指标比例)', + echarts_pie_m_desc: '[E]饼图(指标比例)', + label_position: '标签位置', + label_position_desc: '标签位置', + label_position_choices: [ + ['outside', '外部'], + ['inside', '内部'], + ['center', '中间'], + ], + label_format: '标签格式', + label_format_desc: '例如: {b} : {c} ({d}%)', + circle_type: '环状类型', + circle_type_desc: '环状类型', + circle_type_choices: [ + ['none', '无'], + ['big', '大'], + ['medium', '中'], + ['small', '小'], + ], + rose_type_choices: [ + ['none', '无'], + ['radius', '面积比例'], + ['area', '半径比例'], + ], + rose_type: '玫瑰类型', + rose_type_desc: '玫瑰类型', + col_num: '每行显示个数', + inner_metrics: '内圈指标', + inner_metrics_desc: '内圈指标', + outer_metrics: '外圈指标', + outer_metrics_desc: '外圈指标', + echarts_pie_h: '[E]饼图(嵌套)', + echarts_pie_h_desc: '[E]饼图(嵌套)', + + echarts_pie_g: '[E]饼图(分组)', + echarts_pie_g_desc: '[E]饼图(分组)', + + echarts_pie_h_g: '[E]饼图(嵌套分组)', + + echarts_radar_map: '[E]雷达图', + is_circle: '圆形', + is_full: '填充', + + echarts_dash_board: '[E]仪表盘', + echarts_big_number: '[E]大字图', + echarts_big_number_compare: '[E]大字对比图', + echarts_bubble: '[E]气泡图', + echarts_word_cloud: '[E]文字云', + dash_min: '刻度最小值', + dash_max: '刻度最大值', + dash_name: '仪表盘名称', + dash_splitNum: '刻度分割数', + dash_expr: '结果表达式', + dash_suffix: '后缀', + dash_style: '仪表盘样式', + + // explore + export_to_json: '导出到.json格式', + export_to_csv: '导出为.csv格式', + no_result: '没有结果', + viz_type_description: '要显示的可视化类型', + table_language: { + lengthMenu: "显示 _MENU_ 条", + search: '查找', + zeroRecords: '没有数据', + paginate: { + first: '第一页', + last: '最后一页', + next: '下一页', + previous: '上一页', + }, + info: '第 _PAGE_ 页 / 总 _PAGES_ 页, 共 _TOTAL_ 条数据', + infoEmpty: '没有数据', + infoFiltered: '(过滤总条数 _MAX_ 条)', + }, + choose_nav_target: '请选择要导航的目标', + page_size: '页大小', + export_csv: '导出csv', + export_excel: '导出excel', + save_as: '另存为', + save: '保存', + query: '查询', + force_refresh_dashboard: '强制刷新整个仪表板', + edit_dashboard_property: '编辑此仪表板的属性', + add_newSlice_to_dashboard: '向仪表板添加新的切片', + unsave_change: '您有未保存的更改。', + click: '点击', + click_to_save: '右上角的按钮保存更改。', + remove_slice: '移除报表', + refresh_data: '刷新数据', + edit_slice: '编辑报表', + print_slice: '打印报表', + move_slice: '移动报表', + toogle_chart_desc: '是否显示图表描述', + served_data: '数据缓存时间', + click_to_refresh: '. 点击强制刷新', + error: '错误', + error_add_slice_dash: '很抱歉,切片添加至仪表盘时出错', + name: '名称', + modified: '修改时间', + add_slices: '添加切片', + refresh_interval: '刷新间隔', + refresh_options: [ + [0, "不刷新"], + [10, '10秒'], + [30, '30秒'], + [60, '1分钟'], + [300, '5分钟'], + ], + choose_refresh_desc: '选择此仪表板的刷新频率', + active_dashboard_filters: '仪表板过滤器', + load_template: '加载模板', + live_css_editor: '实时CSS编辑器', + load_a_css_template: '加载CSS模板', + save_dashboard: '保存仪表板', + overwrite_dashboard: '覆盖仪表板', + error_add_dashboard: '您必须为新仪表板选择一个名称', + success: '成功', + success_save_dashboard: '此仪表板已成功保存。', + dashboard_name: '[仪表板名称]', + y1_axis_format: 'Y1轴数值格式', + y2_axis_format: 'Y2轴数值格式', + no_access_datebase: '看起来你没有可访问的数据库', + untitled_query: '无标题查询', + search_user: '[用户]', + search_results: '搜索结果', + search_from: '[开始日期]-', + search_to: '[截止日期]-', + query_status: '[查询状态]', + search: '搜索', + TIME_OPTIONS: [ + ['now', '现在'], + ['1 hour ago', '1小时前'], + ['1 day ago', '1天前'], + ['7 days ago', '7天前'], + ['28 days ago', '28天前'], + ['90 days ago', '90天前'], + ['1 year ago', '1年以前'], + ], + STATUS_OPTIONS: [ + ['success', '成功'], + ['failed', '失败'], + ['running', '运行中'], + ], + select_database: '选择一个数据库', + close_tab: '关闭标签', + rename_tab: '重命名标签', + expand_tool_bar: '展开工具栏', + hide_tool_bar: '隐藏工具栏', + share_query: '共享查询', + select_schema: '选择一个 Schema', + add_table: '添加表', + open_in_sql_editor: '在SQL编辑器中打开', + + // querytable column and field + query_table_columns: [ + '状况', '数据库', '用户', '日期', + '进度', '结果数', 'sql', '查询链接', + ], + state: '状况', + db: '数据库', + user: '用户', + date: '日期', + progress: '进度', + rows: '结果数', + sql: 'sql', + querylink: '查询链接', + query_history_columns: [ + '状况', '开始于', '持续时间', '进度', + '结果数', 'sql', '数据库', '操作', + ], + started: '开始于', + duration: '持续时间', + output: '数据库', + actions: '操作', + failed: '失败', + + data_preview: '数据预览', + run_query: '运行查询', + run_selection: '运行选择', + running: '运行中', + offline: '离线', + database: '数据库', + reset_state: '复位状态', + visualize_query_data: '可视化此查询中的数据', + overwrite_query_text: '使用此表上的查询覆盖编辑器中的文本', + run_query_new_tab: '在新标签中运行查询', + remove_query_from_log: '从日志中删除查询', + query_csv: '.CSV', + query_visualize: '可视化选项', + query_result: '查询结果', + query_history: '查询历史记录', + preview_for: '预览', + pk: '主键', + fk: '外键', + index: 'Index', + no_query_history: '没有查询记录...', + fetch_data_preview: '获取数据预览', + query_asyc: '此查询异步运行', + fetch_result: '获取结果', + query_no_data: '该查询没有返回任何数据', + run_query_asyc: '异步运行查询', + create_table_as_result: '使用查询结果创建表', + new_table_name: '新表名', + query_in_new_tab: '在新标签页中进行查询', + view_results: '查看结果', + pick_chart_type: '请选择一个图表类型!', + need_data_column: '要使用此图表类型,您至少需要一个标记为日期的列', + no_result_avaliable: '此查询没有可用的结果', + chart_type: '[图表类型]', + datasource_name: '数据源名称', + visualize: '可视化', + vis_chart_type: '图表类型', + vis_datasource_name: '模型名称', + + // visualizemodal column and field + vis_columns: ['列', '是否维度', '是否日期', '聚合函数',], + vis_column: '列', + vis_is_dimension: '是否维度', + vis_is_date: '是否日期', + vis_agg_func: '聚合函数', + + agg_func_options: [ + { value: 'sum', label: '求和(x)' }, + { value: 'min', label: '最小值(x)' }, + { value: 'max', label: '最大值(x)' }, + { value: 'avg', label: '平均值(x)' }, + { value: 'count_distinct', label: '计数' }, + ], + run_query_display_results: '运行查询以在此显示结果', + stop: '停止', + limit_tooltip1: '显示的查询结果中的行数在服务器端限制为', + limit_tooltip2: '行', + run_async: '异步运行', + enter_new_title_tab: '输入标签的新标题', + copy_url_clipboard: '将URL复制到剪贴板', + view_keys: '查看键和索引', + sort_columns_alphabetically: '按字母顺序排列列', + original_table_column_order: '原始表列顺序', + remove_table_preview: '删除表预览', + copy_partition_query_to_clipboard: '将分区查询复制到剪贴板', + copy_select_statement_to_clipboard: '将查询语句复制到剪贴板', + raw_sql: '原始SQL', + source_sql: '源SQL', + none: '无', + picture_upload_error: '请选择jpg, png, jpeg图片格式上传', + menu_name: '菜单名', + parent_menu: '父菜单', + dash_source: '仪表盘资源', + set_index: '设为首页', + add: '添加', + modify: '修改', + delete: '删除', + portal_preview: '门户预览', + upload_logo: '上传logo', + schedule_settings: '调度设置', + select_scheduling: '选择调度方式', + schedule_expression: '调度表达式', + schedule_tooltip: '注: 时间用 `YYYY-MM-DD hh:mm:ss` 或者 `YYYY-MM-DD` 字符串表示, 多个条件用&&连接', + cron_help_href: 'cron表达式详情链接', + condition_setting: '条件设置', + monitor_dashboard: '监测仪表盘', + choose_dash: '选择仪表盘', + monitor_slice: '监测切片', + choose_monitor_slice: '选择监测切片', + monitor_metric: '监测指标', + specifies_expression: '指定表达式', + mail_send_slice: '邮件发送切片', + choose_send_slice: '选择发送切片', + receiver_address: '收件人地址', + done_success: '操作成功', + done_fail: '操作失败', + unknown_error: '未知错误', + yes: '是', + closed: '已关闭', + activation: '激活', + start_up: '启动', + add_schedule: '添加调度', + serial_number: '序号', + scheduling_method: '调度方式', + start_time: '开始时间', + end_time: '结束时间', + is_active: '是否激活', + status: '状态', + mailbox_settings: '邮箱设置', + smtp_server: 'SMTP服务器', + port: '端口', + sender_name: '发件人名称', + sender_address: '发件人地址', + user_name: '用户名', + password: '口令', + test_conn: '测试连接', + modify_success: '修改成功', + modify_failed: '修改失败', + return: '返回', + connect_success: '连接成功', + connect_failed: '连接失败', + operate_failed: '操作失败', + operate_success: '操作成功', + interval: '间隔', + cron: 'cron表达式', + save_failed:'保存失败', + save_success:'保存成功', + upload_failed:'上传失败', + favorites: '收藏', + created_content:'创建内容', + recent_activity:'近期活动', + security_access:'安全与访问', + no_fav_slice:'没有收藏的切片,去点击星星收藏!', + no_fav_dash: '没有收藏的仪表板,去点击星星收藏!', + creator: '创建人', + slice: '切片', + favorited: '收藏', + slc_fav_column: ['切片', '创建人', '收藏'], + dashboard: '仪表板', + dash_fav_column: ['仪表板', '创建人', '收藏'], + no_slices: "没有切片", + no_dashboards: "没有仪表板", + slc_create_column: ['切片', '收藏'], + dash_create_column: ['仪表板', '收藏'], + action : '操作', + item: '项目', + time: '时间', + recent_action_column: ['操作', '项目', '时间'], + roles:'角色', + databases: '数据库', + datasources: '数据源', + enter_slice_name: '请输入切片名称', + select_dashboard: '请选择仪表盘', + enter_dashboard_name: '请输入仪表盘名称', + overwrite_slice: '覆盖切片', + slice_name:'[切片名称]', + save_go_dash: '保存并转到仪表盘', + save_a_slice: '保存一个切片', + add_to_new_dash: '添加到新的仪表盘', + do_not_add_to_dash: '不要添加到仪表盘', + add_slice_to_existing_dash: '将切片添加到现有仪表盘', + choose_slice_theme: '选择切片主题', + load_theme: '加载主题', + china_map: '中国地图', + main_metric: '主指标', + metric_show_legend: '显示图例的指标', + min_legend: '图例最小值', + min_legend_desc: '输入柱状图例的最小值', + max_legend: '图例最大值', + max_legend_desc: '输入柱状图例的最大值', + high: '高', + low: '低', + pick_at_least_groupby: '为[分组]选择至少一个字段', + china_city_map: '中国城市地图', + longitude: '经度', + longitude_desc: '表示经度的列', + latitude: '纬度', + latitude_desc: '表示纬度的列', + bar_column: '柱状图列', + bar_column_desc: '表示右侧柱状图的列', + echarts_quadrant: '[E]象限图', + origin_x_axis: '焦点横坐标', + origin_x_axis_desc: '焦点x轴坐标', + origin_y_axis: '焦点纵坐标', + origin_y_axis_desc: '焦点y轴坐标', + min_x_axis: 'X轴最小值', + min_x_axis_desc: 'X轴最小值', + max_x_axis: 'X轴最大值', + max_x_axis_desc: 'X轴最大值', + min_y_axis: 'Y轴最小值', + min_y_axis_desc: 'Y轴最小值', + max_y_axis: 'Y轴最大值', + max_y_axis_desc: 'Y轴最大值', + first_module_infor:'第一模块信息', + second_module_infor:'第二模块信息', + third_module_infor:'第三模块信息', + fourth_module_infor:'第四模块信息', + sliceResizeAble: [ + ['true', '是'], + ['false', '否'] + ], + slice_resize_able: '窗口改变大小刷新切片', + subtitle: '[副标题]', +}; + +export default zh_CN; diff --git a/superset/config.py b/superset/config.py index 61b111bde576..2322f97d0196 100644 --- a/superset/config.py +++ b/superset/config.py @@ -143,8 +143,8 @@ LANGUAGES = { 'en': {'flag': 'us', 'name': 'English'}, 'it': {'flag': 'it', 'name': 'Italian'}, - # 'fr': {'flag': 'fr', 'name': 'French'}, - # 'zh': {'flag': 'cn', 'name': 'Chinese'}, + 'fr': {'flag': 'fr', 'name': 'French'}, + 'zh': {'flag': 'cn', 'name': 'Chinese'}, } # --------------------------------------------------- # Image and file configuration diff --git a/superset/views/core.py b/superset/views/core.py index 8a5de069efe1..4907ab848159 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -26,6 +26,7 @@ from flask_babel import gettext as __ from flask_babel import lazy_gettext as _ +from flask.ext import babel from sqlalchemy import create_engine from werkzeug.routing import BaseConverter @@ -392,7 +393,6 @@ def add(self): category="", category_icon='',) - class SliceAsync(SliceModelView): # noqa list_columns = [ 'slice_link', 'viz_type', @@ -2260,6 +2260,11 @@ def sqllab(self): 'superset/sqllab.html', bootstrap_data=json.dumps(d, default=utils.json_iso_dttm_ser) ) + + @has_access + @expose("/rest/api/getLocale", methods=['GET', 'POST']) + def getLocale(self): + return str(babel.get_locale()) appbuilder.add_view_no_menu(Superset) @@ -2333,3 +2338,4 @@ def caravel(url): # noqa # --------------------------------------------------------------------- + From 795a05e82a9852f5fba0448adaf47f7f8638d7df Mon Sep 17 00:00:00 2001 From: lxzhangchao <1099326813@qq.com> Date: Fri, 7 Jul 2017 15:44:52 +0800 Subject: [PATCH 2/3] Using react-intl-universal to improve multi language in react page --- .../components/ExploreViewContainer.jsx | 3 -- .../explore/components/SaveModal.jsx | 52 +++++++++++++------ .../javascripts/explore/stores/language.js | 18 +++++++ superset/assets/package.json | 3 ++ 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx index 91b19be5eba2..67141241a362 100644 --- a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx +++ b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx @@ -21,7 +21,6 @@ const propTypes = { standalone: PropTypes.bool.isRequired, triggerQuery: PropTypes.bool.isRequired, queryRequest: PropTypes.object, - localMessage: PropTypes.object, }; class ExploreViewContainer extends React.Component { @@ -154,7 +153,6 @@ class ExploreViewContainer extends React.Component { onHide={this.toggleModal.bind(this)} actions={this.props.actions} form_data={this.props.form_data} - localMessage={this.props.localMessage} /> }
@@ -196,7 +194,6 @@ function mapStateToProps(state) { triggerQuery: state.triggerQuery, forcedHeight: state.forced_height, queryRequest: state.queryRequest, - localMessage: state.localMessage, }; } diff --git a/superset/assets/javascripts/explore/components/SaveModal.jsx b/superset/assets/javascripts/explore/components/SaveModal.jsx index f83add4330a8..f9c3d517dd75 100644 --- a/superset/assets/javascripts/explore/components/SaveModal.jsx +++ b/superset/assets/javascripts/explore/components/SaveModal.jsx @@ -5,7 +5,15 @@ import $ from 'jquery'; import { Modal, Alert, Button, Radio } from 'react-bootstrap'; import Select from 'react-select'; import { connect } from 'react-redux'; +import intl from 'react-intl-universal'; +import zh_CN from "../stores/zh_CN.js"; +import en_US from "../stores/en_US.js"; +import { getLanguage } from '../stores/language.js'; +const locales = { + "en_US": en_US, + "zh_CN": zh_CN +}; const propTypes = { can_overwrite: PropTypes.bool, @@ -17,12 +25,12 @@ const propTypes = { alert: PropTypes.string, slice: PropTypes.object, datasource: PropTypes.object, - localMessage: PropTypes.object, }; class SaveModal extends React.Component { + constructor(props) { super(props); this.state = { @@ -36,8 +44,20 @@ class SaveModal extends React.Component { }; } componentDidMount() { + this.loadLocales(); this.props.actions.fetchDashboards(this.props.user_id); } + + loadLocales() { + intl.init({ + currentLocale: getLanguage(), + locales, + }) + .then(() => { + this.setState({initDone: true}); + }); + } + onChange(name, event) { switch (name) { case 'newSliceName': @@ -73,7 +93,7 @@ class SaveModal extends React.Component { if (sliceParams.action === 'saveas') { sliceName = this.state.newSliceName; if (sliceName === '') { - this.setState({ alert: this.props.localMessage.enter_slice_name }); + this.setState({ alert: intl.formatMessage({id:'enter_slice_name', defaultMessage: `Please enter a slice name`}) }); return; } sliceParams.slice_name = sliceName; @@ -88,7 +108,7 @@ class SaveModal extends React.Component { case ('existing'): dashboard = this.state.saveToDashboardId; if (!dashboard) { - this.setState({ alert: this.props.localMessage.select_dashboard }); + this.setState({ alert: intl.formatMessage({id:'select_dashboard', defaultMessage: `Please select a dashboard`}) }); return; } sliceParams.save_to_dashboard_id = dashboard; @@ -96,7 +116,7 @@ class SaveModal extends React.Component { case ('new'): dashboard = this.state.newDashboardName; if (dashboard === '') { - this.setState({ alert: this.props.localMessage.enter_dashboard_name }); + this.setState({ alert: intl.formatMessage({id:'enter_dashboard_name', defaultMessage: `Please enter a dashboard name`}) }); return; } sliceParams.new_dashboard_name = dashboard; @@ -126,7 +146,6 @@ class SaveModal extends React.Component { this.setState({ alert: null }); } render() { - const localMessage = this.props.localMessage; return ( - {localMessage.save_a_slice} + {intl.formatMessage({id:'save_a_slice', defaultMessage: `Save A Slice`})} @@ -156,7 +175,7 @@ class SaveModal extends React.Component { checked={this.state.action === 'overwrite'} onChange={this.changeAction.bind(this, 'overwrite')} > - {`Overwrite slice ${this.props.slice.slice_name}`} + {`${intl.formatMessage({id:'overwrite_slice', defaultMessage: `Overwrite slice`})} ${this.props.slice.slice_name}`} } @@ -165,16 +184,16 @@ class SaveModal extends React.Component { inline checked={this.state.action === 'saveas'} onChange={this.changeAction.bind(this, 'saveas')} - > {localMessage.save_as}   + > + {intl.formatMessage({id:'save_as', defaultMessage: `Save as`})}   -

@@ -182,7 +201,7 @@ class SaveModal extends React.Component { checked={this.state.addToDash === 'noSave'} onChange={this.changeDash.bind(this, 'noSave')} > - {localMessage.do_not_add_to_dash} + {intl.formatMessage({id:'do_not_add_to_dash', defaultMessage: `Do not add to a dashboard`})} - {localMessage.add_slice_to_existing_dash} + {intl.formatMessage({id:'add_slice_to_existing_dash', defaultMessage: `Add slice to existing dashboard`})}
@@ -220,7 +239,7 @@ class SaveModal extends React.Component { className="btn pull-left" onClick={this.saveOrOverwrite.bind(this, false)} > - {localMessage.save} + {intl.formatMessage({id:'save', defaultMessage: `Save`})}
@@ -247,7 +266,6 @@ function mapStateToProps(state) { user_id: state.user_id, dashboards: state.dashboards, alert: state.saveModalAlert, - localMessage: state.localMessage, }; } diff --git a/superset/assets/javascripts/explore/stores/language.js b/superset/assets/javascripts/explore/stores/language.js index 2a2d66220495..24aa36c43aba 100644 --- a/superset/assets/javascripts/explore/stores/language.js +++ b/superset/assets/javascripts/explore/stores/language.js @@ -21,3 +21,21 @@ export function chooseMessage() { return en_US; } } + +export function getLanguage() { + function getLocale() { + const locale = $.ajax({ + url: '/superset/rest/api/getLocale', + async: false, + }); + return locale.responseText + } + switch (getLocale()) { + case 'en': + return 'en_US'; + case 'zh': + return 'zh_CN'; + default: + return 'en_US'; + } +} \ No newline at end of file diff --git a/superset/assets/package.json b/superset/assets/package.json index 5d5022def10b..be49674af743 100644 --- a/superset/assets/package.json +++ b/superset/assets/package.json @@ -53,6 +53,7 @@ "datatables.net": "^1.10.13", "datatables.net-bs": "^1.10.12", "immutable": "^3.8.1", + "intl": "^1.2.5", "jquery": "^3.2.1", "jsdom": "9.12.0", "lodash.throttle": "^4.1.1", @@ -71,6 +72,8 @@ "react-dom": "^15.5.1", "react-gravatar": "^2.6.1", "react-grid-layout": "^0.14.4", + "react-intl": "^2.3.0", + "react-intl-universal": "^1.1.1", "react-map-gl": "^1.7.0", "react-redux": "^5.0.2", "react-resizable": "^1.3.3", From f7f01df11dd80808956616322938532cc050b700 Mon Sep 17 00:00:00 2001 From: lxzhangchao <1099326813@qq.com> Date: Fri, 7 Jul 2017 15:54:19 +0800 Subject: [PATCH 3/3] Using react-intl-universal to improve multi language in react page --- superset/assets/javascripts/explore/index.jsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/superset/assets/javascripts/explore/index.jsx b/superset/assets/javascripts/explore/index.jsx index 00f2767f13dc..ed4eeb070500 100644 --- a/superset/assets/javascripts/explore/index.jsx +++ b/superset/assets/javascripts/explore/index.jsx @@ -14,16 +14,12 @@ import ExploreViewContainer from './components/ExploreViewContainer'; import { exploreReducer } from './reducers/exploreReducer'; import { appSetup } from '../common'; import './main.css'; -import { zh_CN } from './stores/zh_CN.js'; -import { en_US } from './stores/en_US.js'; -import { chooseMessage } from './stores/language.js'; appSetup(); initJQueryAjax(); const exploreViewContainer = document.getElementById('js-explore-view-container'); const bootstrapData = JSON.parse(exploreViewContainer.getAttribute('data-bootstrap')); -const localeMessage = chooseMessage(); const controls = getControlsState(bootstrapData, bootstrapData.form_data); delete bootstrapData.form_data; @@ -44,7 +40,6 @@ const bootstrappedState = Object.assign( triggerQuery: true, triggerRender: false, alert: null, - localMessage: localeMessage, }, ); const store = createStore(exploreReducer, bootstrappedState,