Skip to content

Commit

Permalink
Merge branch 'explore--update_button_labels' of https://github.com/ti…
Browse files Browse the repository at this point in the history
…mifasubaa/incubator-superset into explore--update_button_labels
  • Loading branch information
timifasubaa committed Sep 28, 2017
2 parents 659aabd + 14ec8a5 commit 7c61f1b
Show file tree
Hide file tree
Showing 135 changed files with 16,479 additions and 3,808 deletions.
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Check the [OS dependencies](https://superset.incubator.apache.org/installation.h
source env/bin/activate

# install for development
python setup.py develop
pip install -e .

# Create an admin user
fabmanager create-admin --app superset
Expand Down Expand Up @@ -331,6 +331,8 @@ key is to instrument the strings that need translation using
a module, all you have to do is to `_("Wrap your strings")` using the
underscore `_` "function".

We use `import {t, tn, TCT} from locales;` in js, JSX file, locales is in `./superset/assets/javascripts/` directory.

To enable changing language in your environment, you can simply add the
`LANGUAGES` parameter to your `superset_config.py`. Having more than one
options here will add a language selection dropdown on the right side of the
Expand All @@ -342,6 +344,10 @@ navigation bar.
'zh': {'flag': 'cn', 'name': 'Chinese'},
}

We need to extract the string to be translated, run the following command:

pybabel extract -F ./babel/babel.cfg -k _ -k __ -k t -k tn -k tct -o ./babel/messages.pot .

As per the [Flask AppBuilder documentation] about translation, to create a
new language dictionary, run the following command:

Expand All @@ -358,6 +364,14 @@ to take effect, they need to be compiled using this command:

fabmanager babel-compile --target superset/translations/

In the case of JS translation, we need to convert the PO file into a JSON file, and we need the global download of the npm package po2json.
We need to be compiled using this command:

npm install po2json -g

Execute this command to convert the en PO file into a json file:

po2json -d superset -f jed1.x superset/translations/en/LC_MESSAGES/messages.po superset/translations/en/LC_MESSAGES/messages.json

## Adding new datasources

Expand Down
4 changes: 4 additions & 0 deletions babel/babel.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[ignore: superset/assets/node_modules/**]
[python: superset/**.py]
[jinja2: superset/**/templates/**.html]
[javascript: superset/assets/javascripts/**.js]
[javascript: superset/assets/javascripts/**.jsx]
[javascript: superset/assets/visualizations/**.js]
[javascript: superset/assets/visualizations/**.jsx]
encoding = utf-8
Loading

0 comments on commit 7c61f1b

Please sign in to comment.