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

chore: update babel doc #17679

Merged
merged 3 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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