diff options
author | Burt P <pburt0@gmail.com> | 2017-07-11 22:37:18 -0500 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2017-07-12 19:38:41 -0700 |
commit | 223f339eedaec9a97de59305d58f4ff9dd7df225 (patch) | |
tree | 3173d4af38c10e201230aca69a07f71621910e78 /po | |
parent | f1e867b56bf6148c08734d16f1f16ff577a7577d (diff) |
Fixup translation support
* Use `bash updatepo.sh` instead of `make pot`. `make pot` will
cause absolute paths to appear in hardinfo.pot of whomever last
ran it.
* C_() and NC_() support added for contexts
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'po')
-rw-r--r-- | po/HOWTO.txt | 17 | ||||
-rw-r--r-- | po/updatepo.sh | 21 |
2 files changed, 36 insertions, 2 deletions
diff --git a/po/HOWTO.txt b/po/HOWTO.txt index 81b9bd5c..2a0775dd 100644 --- a/po/HOWTO.txt +++ b/po/HOWTO.txt @@ -1,2 +1,15 @@ -update .pot : make pot in build/ -update .po files after .pot update : msgmerge -N XX.po hardinfo.pot > XX_.po && mv XX_.po XX.po + +To update the .pot and existing translations use: + bash updatepo.sh + +----- + +update .pot : + --don't!-- make pot in build/ + absolute paths will appear in the .pot + try : + xgettext -d hardinfo -o hardinfo.pot -k_ -kN_ -kC_:1c,2 -kNC_:1c,2 -c/ --from-code=UTF-8 ... + +update .po files after .pot update : + msgmerge -N XX.po hardinfo.pot > XX_.po && mv XX_.po XX.po + diff --git a/po/updatepo.sh b/po/updatepo.sh index 9289dabd..d1d3c427 100644 --- a/po/updatepo.sh +++ b/po/updatepo.sh @@ -1,3 +1,24 @@ +#!bash + +echo "Update gettext translation files." + +DER=`pwd` +if [ ! -e "updatepo.sh" ] +then + echo "Error: Run from po/, the location of hardinfo.pot and XX.po files." + exit 1 +fi + +mv hardinfo.pot hardinfo.pot.old +echo "" > hardinfo.pot # empty existing file to join (-j) with +for d in shell/ modules/ hardinfo/; +do + # work form hardinfo root to get reasonable file reference comments + cd .. + echo -n `pwd`; echo "/$d ..." + find "$d" -type f -name "*.c" -print | 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; for f in *.po do |