diff options
author | Florian Dold <florian@dold.me> | 2021-05-07 18:30:25 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-05-07 18:30:25 +0200 |
commit | c7c1c923b8208696c72216651e4788c551eb3c1c (patch) | |
tree | 86e102cd55308e5ececfc4af0eefcbe0b58bbfd8 | |
parent | 32efd06d974ba447d631363a62c4e551c44a17d3 (diff) | |
download | www_shared-c7c1c923b8208696c72216651e4788c551eb3c1c.tar.gz www_shared-c7c1c923b8208696c72216651e4788c551eb3c1c.zip |
update pot file only when it has changes
-rwxr-xr-x | update-messages | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/update-messages b/update-messages index 582481c..7565b9a 100755 --- a/update-messages +++ b/update-messages | |||
@@ -19,7 +19,15 @@ languages=$($sitegen/list-languages) | |||
19 | echo Using languages $languages | 19 | echo Using languages $languages |
20 | 20 | ||
21 | echo "Updating message catalog" | 21 | echo "Updating message catalog" |
22 | env "PYTHONPATH=$sitegen:${PYTHONPATH-:}" pybabel extract -F locale/babel.map -o locale/messages.pot . | 22 | env "PYTHONPATH=$sitegen:${PYTHONPATH-:}" pybabel extract -F locale/babel.map -o locale/messages.pot~ . |
23 | |||
24 | diffcount=$(diff locale/messages.pot locale/messages.pot~ | grep "^>" | wc -l) | ||
25 | |||
26 | # Only copy pot file if more than the timestamp changed | ||
27 | if [[ $diffcount -gt 1 ]]; then | ||
28 | cp locale/messages.pot~ locale/messages.pot | ||
29 | fi | ||
30 | |||
23 | 31 | ||
24 | echo "Updating existing translations" | 32 | echo "Updating existing translations" |
25 | for lang in $languages; do | 33 | for lang in $languages; do |