mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-29 14:29:54 +00:00
Script for updating translations (#1030)
Script for updating translation strings and print stats
This commit is contained in:
parent
0128660d40
commit
66a905f1d6
@ -73,12 +73,14 @@ When adding a localization for a new language, initialize the directory structur
|
|||||||
$ pybabel init -i messages.pot -d src/translations -l xx
|
$ pybabel init -i messages.pot -d src/translations -l xx
|
||||||
```
|
```
|
||||||
|
|
||||||
### Update an existing loclization
|
### Update an existing localization
|
||||||
|
|
||||||
|
Tip: Use the script **translation_update.sh** in this dir to automatically extract strings, update existing localizations, and print translation statistics.
|
||||||
|
|
||||||
After strings have been added or changed in the code, update the existing localizations.
|
After strings have been added or changed in the code, update the existing localizations.
|
||||||
|
|
||||||
```
|
```
|
||||||
pybabel update -i messages.pot -d src/translations
|
$ pybabel update -i messages.pot -d src/translations
|
||||||
```
|
```
|
||||||
|
|
||||||
Then edit the updated messages.po file for your language. Make sure to update fuzzy strings and translate new ones.
|
Then edit the updated messages.po file for your language. Make sure to update fuzzy strings and translate new ones.
|
||||||
|
18
python/web/translation_update.sh
Executable file
18
python/web/translation_update.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
# Check for the existence of a python venv in the current dir
|
||||||
|
if ! test -e venv; then
|
||||||
|
echo "No python venv detected. Please run start.sh first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source venv/bin/activate
|
||||||
|
|
||||||
|
pybabel extract -F babel.cfg -o messages.pot .
|
||||||
|
pybabel update -i messages.pot -d src/translations
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Translation stats:"
|
||||||
|
find . -name \*.po -print -execdir msgfmt --statistics messages.po \;
|
Loading…
Reference in New Issue
Block a user