diff options
author | Burt P <pburt0@gmail.com> | 2017-07-26 01:02:24 -0500 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2017-07-30 10:13:21 -0700 |
commit | c4cd8b7528bac0dd8bd91d808da47285a387a443 (patch) | |
tree | 90d48a8b21d774fa8f9aebf92da0007f27c1d196 /po | |
parent | dc3e86a7cb4cf33352c290a5a8e164cf8d803cdc (diff) |
po/updatepo.sh: updates
* include includes/
* output git description in stats
* fix spelling mistake
* set/reset X-Poedit-Basepath header
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'po')
-rw-r--r-- | po/updatepo.sh | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/po/updatepo.sh b/po/updatepo.sh index cd30b4bb..d5b0f9d6 100644 --- a/po/updatepo.sh +++ b/po/updatepo.sh @@ -1,5 +1,8 @@ #!bash +GITVER=`git describe --always --dirty` +GITHASH=`git rev-parse HEAD` + echo "Update gettext translation files." DER=`pwd` @@ -14,12 +17,12 @@ echo "hardinfo.pot has $MSGTOTALOLD strings" mv hardinfo.pot hardinfo.pot.old echo "" > hardinfo.pot # empty existing file to join (-j) with -for d in hardinfo/ shell/ modules/; +for d in hardinfo/ shell/ modules/ includes/; do - # work form hardinfo root to get reasonable file reference comments + # work from hardinfo root to get reasonable file reference comments cd .. echo -n `pwd`; echo "/$d ..." - find "$d" -type f -name "*.c" -print | sort | xargs xgettext -j -d hardinfo -o "$DER/hardinfo.pot" -k_ -kN_ -kC_:1c,2 -kNC_:1c,2 -c/ --from-code=UTF-8 + find "$d" -type f -name "*.[hc]" -print | sort | xargs xgettext -j -d hardinfo -o "$DER/hardinfo.pot" -k_ -kN_ -kC_:1c,2 -kNC_:1c,2 -c/ --from-code=UTF-8 cd "$DER" done; @@ -29,15 +32,21 @@ CHANGE="$TDIFF" if [ $TDIFF -gt 0 ]; then CHANGE="+$TDIFF"; fi if [ $TDIFF -eq 0 ]; then CHANGE="no change"; fi echo "hardinfo.pot now has $MSGTOTAL strings ($CHANGE)" +echo "(as of $GITVER $GITHASH)" for f in *.po do cp "$f" "$f.old" - msgmerge -q -N "$f" hardinfo.pot > tmp.po && mv tmp.po "$f" + + msgmerge -q -N "$f" hardinfo.pot > tmp.po + + # set/reset the X-Poedit-Basepath header + grep -v '"X-Poedit-Basepath\:[^"]*"' tmp.po | sed 's:\("Language\:[^"]*"\):\1\n"X-Poedit-Basepath\: ../\\n":' >"$f" + + rm -f tmp.po + + # stats UNMSG=`msgattrib --untranslated "$f" | grep -E "^msgstr \"\"" | wc -l` - DONE=" " - if [ $UNMSG -eq 0 ]; then - DONE="x" - fi + DONE=" "; if [ $UNMSG -eq 0 ]; then DONE="x"; fi echo "- [$DONE] $f : ($UNMSG / $MSGTOTAL remain untranslated)" done |