diff options
author | Florian Dold <florian@dold.me> | 2021-05-07 17:48:56 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-05-07 17:48:56 +0200 |
commit | 794129fc96ec67b4f6bb50f1b568c5877d2e4e75 (patch) | |
tree | a65b5313d410eebd182b31e5a2c7558144816b2b | |
parent | 20d3bab14bc313c3b383f5b447d5d07029400b12 (diff) | |
download | www_shared-794129fc96ec67b4f6bb50f1b568c5877d2e4e75.tar.gz www_shared-794129fc96ec67b4f6bb50f1b568c5877d2e4e75.zip |
add i18n, clean up names
-rwxr-xr-x | build-site (renamed from make_site.py) | 1 | ||||
-rwxr-xr-x | update-messages | 37 |
2 files changed, 37 insertions, 1 deletions
diff --git a/make_site.py b/build-site index 35cc333..935f605 100755 --- a/make_site.py +++ b/build-site | |||
@@ -19,7 +19,6 @@ sys.path.insert(0, ".") | |||
19 | 19 | ||
20 | from sitegen.site import SiteGenerator | 20 | from sitegen.site import SiteGenerator |
21 | 21 | ||
22 | |||
23 | def main(): | 22 | def main(): |
24 | x = SiteGenerator() | 23 | x = SiteGenerator() |
25 | x.run() | 24 | x.run() |
diff --git a/update-messages b/update-messages new file mode 100755 index 0000000..8b0fea2 --- /dev/null +++ b/update-messages | |||
@@ -0,0 +1,37 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # This script extracts translations (into locale/messages.pot), | ||
4 | # updates existing translations (locale/$lang/messages.po) | ||
5 | # and fails if a conflict happened. | ||
6 | # | ||
7 | # @author Florian Dold <dold@taler.net> | ||
8 | |||
9 | SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
10 | set -eu | ||
11 | |||
12 | root=$PWD | ||
13 | sitegen=$SCRIPTPATH | ||
14 | |||
15 | cd $root | ||
16 | |||
17 | languages="" | ||
18 | |||
19 | for i in $( cd locale/; echo */); do | ||
20 | languages="$languages ${i%/}" | ||
21 | done | ||
22 | |||
23 | echo Using languages $languages | ||
24 | |||
25 | echo "Updating message catalog" | ||
26 | env "PYTHONPATH=$sitegen:${PYTHONPATH-:}" pybabel extract -F locale/babel.map -o locale/messages.pot . | ||
27 | |||
28 | echo "Updating existing translations" | ||
29 | for lang in $languages; do | ||
30 | msgmerge -q -U -m --previous locale/$lang/LC_MESSAGES/messages.po locale/messages.pot | ||
31 | done | ||
32 | |||
33 | # Check for conflicts | ||
34 | if grep -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then | ||
35 | echo "ERROR: Conflicts encountered in PO files."; | ||
36 | exit 1; | ||
37 | fi | ||