Skip to content

Commit

Permalink
chore: update babel doc (#17679)
Browse files Browse the repository at this point in the history
* chore: update babel doc

* update .po file

* update translation workflow
  • Loading branch information
zhaoyongjie authored Dec 8, 2021
1 parent cd88b8e commit 12f1d91
Show file tree
Hide file tree
Showing 16 changed files with 146,074 additions and 72,871 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/superset-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,4 @@ jobs:
pip-upgrade
pip install -r requirements/base.txt
- name: Test babel extraction
run: |
flask fab babel-extract --target superset/translations \
--output superset/translations/messages.pot \
--config superset/translations/babel.cfg -k _,__,t,tn,tct
run: ./scripts/babel_update.sh
15 changes: 4 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -1039,22 +1039,15 @@ LANGUAGES = {
}
```
### Extracting new strings for translation
```bash
pybabel extract -F superset/translations/babel.cfg -o superset/translations/messages.pot -k _ -k __ -k t -k tn -k tct .
```
This will update the template file `superset/translations/messages.pot` with current application strings. Do not forget to update
this file with the appropriate license information.
### Updating language files
```bash
pybabel update -i superset/translations/messages.pot -d superset/translations --ignore-obsolete
./scripts/babel_update.sh
```
This will update language files with the new extracted strings.
This script will
1. update the template file `superset/translations/messages.pot` with current application strings.
2. update language files with the new extracted strings.
You can then translate the strings gathered in files located under
`superset/translation`, where there's one per language. You can use [Poedit](https://poedit.net/features)
Expand Down
12 changes: 9 additions & 3 deletions scripts/babel_extract.sh → scripts/babel_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ pybabel extract \
--copyright-holder=Superset \
--project=Superset \
-k _ -k __ -k t -k tn -k tct .
cat $LICENSE_TMP $ROOT_DIR/superset/translations/messages.pot > messages.pot.tmp \
&& mv messages.pot.tmp $ROOT_DIR/superset/translations/messages.pot \
&& cd $CURRENT_DIR
cat $LICENSE_TMP superset/translations/messages.pot > messages.pot.tmp \
&& mv messages.pot.tmp superset/translations/messages.pot

pybabel update \
-i superset/translations/messages.pot \
-d superset/translations \
--ignore-obsolete

cd $CURRENT_DIR
Loading

0 comments on commit 12f1d91

Please sign in to comment.