Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js translation -- performance improvment #3390

Merged
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
52cbab5
Chinese page
lxzhangchao Jul 5, 2017
795a05e
Using react-intl-universal to improve multi language in react page
lxzhangchao Jul 7, 2017
f7f01df
Using react-intl-universal to improve multi language in react page
lxzhangchao Jul 7, 2017
5a4e13f
Merge pull request #1 from lxzhangchao/ch_react_page
lxzhangchao Jul 7, 2017
7a01ac9
react_intl_universal
lxzhangchao Jul 7, 2017
551844a
Merge pull request #2 from lxzhangchao/ch_react_page
lxzhangchao Jul 7, 2017
9df5a05
change
lxzhangchao Jul 9, 2017
c173f1a
Merge pull request #3 from lxzhangchao/ch_react_page
lxzhangchao Jul 9, 2017
c1e74cb
change
lxzhangchao Jul 10, 2017
dbe5fe2
change
lxzhangchao Jul 10, 2017
fedbe5c
change
lxzhangchao Jul 10, 2017
b41a419
change
lxzhangchao Jul 11, 2017
e4ebef2
change
lxzhangchao Jul 11, 2017
6935759
change
lxzhangchao Jul 11, 2017
26436d2
Merge pull request #4 from lxzhangchao/ch_react_page
lxzhangchao Jul 11, 2017
4c44cf5
merge
lxzhangchao Jul 17, 2017
b084090
multiple page in js
lxzhangchao Jul 19, 2017
6d718a3
Conflict
lxzhangchao Jul 19, 2017
0cd0139
merge
lxzhangchao Jul 19, 2017
12494ec
merge
lxzhangchao Jul 19, 2017
92a185c
merge
lxzhangchao Jul 19, 2017
33a1d54
merge
lxzhangchao Jul 19, 2017
b9ae383
Merge branch 'master' of https://github.com/apache/incubator-superset…
lxzhangchao Jul 20, 2017
c072433
Js Translations
lxzhangchao Jul 20, 2017
2e779b8
JS Translation
lxzhangchao Jul 20, 2017
503b21e
JS Translations
lxzhangchao Jul 20, 2017
5fd2926
Js translation
lxzhangchao Jul 21, 2017
550b596
JS translations
lxzhangchao Jul 21, 2017
91a4d42
JS translations
lxzhangchao Jul 21, 2017
0931860
Js translaion
lxzhangchao Jul 21, 2017
19006a7
JS en Translation
lxzhangchao Jul 21, 2017
de6af1e
JS Translation
lxzhangchao Jul 23, 2017
c609467
Merge branch 'master' of https://github.com/apache/incubator-superset…
lxzhangchao Jul 23, 2017
63bf3cf
upgrade document
lxzhangchao Jul 24, 2017
2271c20
mergeCode
lxzhangchao Aug 2, 2017
d6a5bb0
Js translation
lxzhangchao Aug 2, 2017
d451439
Merge branch 'master' of https://github.com/apache/incubator-superset…
lxzhangchao Aug 2, 2017
537b5d4
Js tran
lxzhangchao Aug 3, 2017
eaeb2b4
js tran
lxzhangchao Aug 3, 2017
0600674
Merge branch 'master' of https://github.com/apache/incubator-superset…
lxzhangchao Aug 4, 2017
8ab28eb
Merge branch 'master' of https://github.com/apache/incubator-superset…
lxzhangchao Aug 8, 2017
e3acb23
js trans
lxzhangchao Aug 8, 2017
84e485d
Merge branch 'master' of https://github.com/apache/incubator-superset…
lxzhangchao Aug 9, 2017
73af30b
js trans
lxzhangchao Aug 9, 2017
2e2da66
js tran
lxzhangchao Aug 9, 2017
8e463cb
merge
lxzhangchao Aug 10, 2017
4a08560
js trans
lxzhangchao Aug 10, 2017
2f776ab
js trans
lxzhangchao Aug 10, 2017
4e14a5a
js tran
lxzhangchao Aug 10, 2017
b483759
merge
lxzhangchao Aug 11, 2017
4289bbb
js translation
lxzhangchao Aug 11, 2017
e5aa04b
js trans
lxzhangchao Aug 11, 2017
87be912
merge
lxzhangchao Aug 12, 2017
662bca0
js translation
lxzhangchao Aug 12, 2017
b30b742
Merge branch 'master' of https://github.com/apache/incubator-superset…
lxzhangchao Aug 15, 2017
9961ab0
merge Conflict
lxzhangchao Aug 15, 2017
4e9d70d
try load language pack async
Aug 22, 2017
71f96e1
Backend translations things
mistercrunch Aug 22, 2017
02b5c83
Merge remote-tracking branch 'upstream/master' into i18n
Aug 22, 2017
e79ec05
create language pack inside common data
Aug 22, 2017
0d098f5
Merge remote-tracking branch 'upstream/master' into i18n
Aug 23, 2017
5cd0304
Merge remote-tracking branch 'upstream/master' into i18n
Aug 29, 2017
398f081
performance improvement for js i18n.
Aug 29, 2017
f0d7ff5
fix Timer unit test
Aug 30, 2017
bbbbc07
1. add global hook for all tests, to make translation pack avaialble …
Aug 31, 2017
4d9dbeb
parse and build i18n dictionary as a module
Sep 12, 2017
44d5eb6
Merge remote-tracking branch 'upstream/master' into i18n
Sep 12, 2017
cd87a40
Merge remote-tracking branch 'upstream/master' into i18n
Sep 13, 2017
dfcc510
fix sync-backend task, which should run without DOM
Sep 13, 2017
2d977b9
Merge remote-tracking branch 'upstream/master' into i18n
Sep 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
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