superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kri...@apache.org
Subject [incubator-superset] branch master updated: feat: added i18n statements to sqllab (#7194)
Date Mon, 01 Apr 2019 20:43:27 GMT
This is an automated email from the ASF dual-hosted git repository.

kristw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 37d7b2c  feat: added i18n statements to sqllab (#7194)
37d7b2c is described below

commit 37d7b2c040c7dec6a884835a37b82e4dbd00dcde
Author: Enrico Berti <hello@enricoberti.com>
AuthorDate: Mon Apr 1 22:43:22 2019 +0200

    feat: added i18n statements to sqllab (#7194)
    
    Closes #7193
---
 superset/assets/src/SqlLab/components/LimitControl.jsx   |  4 ++--
 superset/assets/src/SqlLab/components/ResultSet.jsx      |  2 +-
 .../assets/src/SqlLab/components/ShareSqlLabQuery.jsx    |  4 ++--
 superset/assets/src/SqlLab/components/SqlEditor.jsx      | 16 ++++++++--------
 .../src/SqlLab/components/TemplateParamsEditor.jsx       | 12 +++++++-----
 5 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/superset/assets/src/SqlLab/components/LimitControl.jsx b/superset/assets/src/SqlLab/components/LimitControl.jsx
index 2c5d3b2..7b9734b 100644
--- a/superset/assets/src/SqlLab/components/LimitControl.jsx
+++ b/superset/assets/src/SqlLab/components/LimitControl.jsx
@@ -76,8 +76,8 @@ export default class LimitControl extends React.PureComponent {
   renderPopover() {
     const textValue = this.state.textValue;
     const isValid = this.isValidLimit(textValue);
-    const errorMsg = 'Row limit must be positive integer' +
-      (this.props.maxRow ? ` and not greater than ${this.props.maxRow}` : '');
+    const errorMsg = t('Row limit must be positive integer') +
+        (this.props.maxRow ? t(' and not greater than %s', this.props.maxRow) : '');
     return (
       <Popover id="sqllab-limit-results">
         <div style={{ width: '100px' }}>
diff --git a/superset/assets/src/SqlLab/components/ResultSet.jsx b/superset/assets/src/SqlLab/components/ResultSet.jsx
index 2e8c1d0..22b6b0d 100644
--- a/superset/assets/src/SqlLab/components/ResultSet.jsx
+++ b/superset/assets/src/SqlLab/components/ResultSet.jsx
@@ -220,7 +220,7 @@ export default class ResultSet extends React.PureComponent {
           </React.Fragment>
         );
       } else if (data && data.length === 0) {
-        return <Alert bsStyle="warning">The query returned no data</Alert>;
+        return <Alert bsStyle="warning">{t('The query returned no data')}</Alert>;
       }
     }
     if (query.cached) {
diff --git a/superset/assets/src/SqlLab/components/ShareSqlLabQuery.jsx b/superset/assets/src/SqlLab/components/ShareSqlLabQuery.jsx
index be0fdd5..dce572e 100644
--- a/superset/assets/src/SqlLab/components/ShareSqlLabQuery.jsx
+++ b/superset/assets/src/SqlLab/components/ShareSqlLabQuery.jsx
@@ -42,7 +42,7 @@ class ShareSqlLabQuery extends React.Component {
   constructor(props) {
     super(props);
     this.state = {
-      shortUrl: 'Loading ...',
+      shortUrl: t('Loading ...'),
       showOverlay: false,
     };
     this.getCopyUrl = this.getCopyUrl.bind(this);
@@ -69,7 +69,7 @@ class ShareSqlLabQuery extends React.Component {
     return (
       <Popover id="sqllab-shareurl-popover">
         <CopyToClipboard
-          text={this.state.shortUrl || 'Loading ...'}
+          text={this.state.shortUrl || t('Loading ...')}
           copyNode={<i className="fa fa-clipboard" title={t('Copy to clipboard')} />}
         />
       </Popover>
diff --git a/superset/assets/src/SqlLab/components/SqlEditor.jsx b/superset/assets/src/SqlLab/components/SqlEditor.jsx
index fdb7d45..960a4af 100644
--- a/superset/assets/src/SqlLab/components/SqlEditor.jsx
+++ b/superset/assets/src/SqlLab/components/SqlEditor.jsx
@@ -144,19 +144,19 @@ class SqlEditor extends React.PureComponent {
       {
         name: 'runQuery1',
         key: 'ctrl+r',
-        descr: 'Run query',
+        descr: t('Run query'),
         func: this.runQuery,
       },
       {
         name: 'runQuery2',
         key: 'ctrl+enter',
-        descr: 'Run query',
+        descr: t('Run query'),
         func: this.runQuery,
       },
       {
         name: 'newTab',
         key: 'ctrl+t',
-        descr: 'New tab',
+        descr: t('New tab'),
         func: () => {
           this.props.actions.addQueryEditor({
             ...this.props.queryEditor,
@@ -168,7 +168,7 @@ class SqlEditor extends React.PureComponent {
       {
         name: 'stopQuery',
         key: 'ctrl+x',
-        descr: 'Stop query',
+        descr: t('Stop query'),
         func: this.stopQuery,
       },
     ];
@@ -287,9 +287,9 @@ class SqlEditor extends React.PureComponent {
     if (this.props.latestQuery && this.props.latestQuery.limit_reached) {
       const tooltip = (
         <Tooltip id="tooltip">
-          It appears that the number of rows in the query results displayed
-          was limited on the server side to
-          the {this.props.latestQuery.rows} limit.
+          {t(`It appears that the number of rows in the query results displayed
+           was limited on the server side to
+           the %s limit.`, this.props.latestQuery.rows)}
         </Tooltip>
       );
       limitWarning = (
@@ -341,7 +341,7 @@ class SqlEditor extends React.PureComponent {
             </span>
             <span className="m-l-5">
               <Hotkeys
-                header="Keyboard shortcuts"
+                header={t('Keyboard shortcuts')}
                 hotkeys={hotkeys}
               />
             </span>
diff --git a/superset/assets/src/SqlLab/components/TemplateParamsEditor.jsx b/superset/assets/src/SqlLab/components/TemplateParamsEditor.jsx
index 38b1647..1ee3e4f 100644
--- a/superset/assets/src/SqlLab/components/TemplateParamsEditor.jsx
+++ b/superset/assets/src/SqlLab/components/TemplateParamsEditor.jsx
@@ -79,11 +79,13 @@ export default class TemplateParamsEditor extends React.Component {
   renderDoc() {
     return (
       <p>
-        Assign a set of parameters as <code>JSON</code> below
-        (example: <code>{'{"my_table": "foo"}'}</code>),
-        and they become available
-        in your SQL (example: <code>SELECT * FROM {'{{ my_table }}'} </code>)
-        by using&nbsp;
+        {t('Assign a set of parameters as')}
+        <code>JSON</code>
+        {t('below (example:')}
+        <code>{'{"my_table": "foo"}'}</code>
+        {t('), and they become available in your SQL (example:')}
+        <code>SELECT * FROM {'{{ my_table }}'} </code>
+        {t(') by using')}&nbsp;
         <a
           href="https://superset.apache.org/sqllab.html#templating-with-jinja"
           target="_blank"


Mime
View raw message