12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #!/bin/sh
- abort() {
- test -n "$1" && echo >&2 "$1"
- exit 1
- }
- scriptisin="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
- # The script is executed from the parent of po/, which is also the
- # parent of the script directory and of the src/ directory.
- # We go through $scriptisin so that it can be executed from whatever
- # directory and still work correctly
- cd "$scriptisin/.."
- test -e po || abort "po/ directory not found"
- test -d po || abort "po/ is not a directory!"
- # Get a list of the languages we have to update/create
- cd po || abort "couldn't change directory to po!"
- # This assumes that we won't have dirnames with space, which is
- langs=""
- for lang in * ; do
- if test ! -d $lang; then
- continue
- fi
- langs="$langs $lang"
- done
- cd ..
- potfile=po/luanti.pot
- echo "updating pot"
- xgettext --package-name=luanti \
- --add-comments='~' \
- --sort-by-file \
- --add-location=file \
- --keyword=N_ \
- --keyword=wgettext \
- --keyword=fwgettext \
- --keyword=fgettext \
- --keyword=fgettext_ne \
- --keyword=strgettext \
- --keyword=wstrgettext \
- --keyword=core.gettext \
- --keyword=showTranslatedStatusText \
- --keyword=fmtgettext \
- --output $potfile \
- --from-code=utf-8 \
- `find src/ -name '*.cpp' -o -name '*.h'` \
- `find builtin/ -name '*.lua'`
- sed '/^#\. ~<number>.*relative_to/,/^#: /{ /^#: /!d; }' -i $potfile
- for lang in $langs ; do
- pofile=po/$lang/luanti.po
- if test -e $pofile; then
- echo "[$lang]: updating strings"
- msgmerge --update --sort-by-file $pofile $potfile
- else
-
- echo "[$lang]: NEW strings"
- msginit --locale=$lang --output-file=$pofile --input=$potfile
- fi
- done
|