]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - util/updatepo.sh
Localize error messages in mainmenu (#11495)
[dragonfireclient.git] / util / updatepo.sh
index bcfa4c4de3a7fce0a1f2fd0cf5877db4f09e4e1d..23e2c61e976599e3607c1d074f2782ccd5802173 100755 (executable)
@@ -13,7 +13,7 @@ abort() {
 # this script is. Relative paths are fine for us so we can just
 # use the following trick (works both for manual invocations and for
 # script found from PATH)
-scriptisin="$(dirname "$(which "$0")")"
+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.
@@ -48,7 +48,24 @@ cd ..
 # directory at the top level. You a recent enough xgettext that supports
 # --package-name
 potfile=po/minetest.pot
-xgettext --package-name=minetest -F -n -o $potfile src/*.cpp src/*.h
+xgettext --package-name=minetest \
+       --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'`
 
 # Now iterate on all languages and create the po file if missing, or update it
 # if it exists already
@@ -56,10 +73,10 @@ for lang in $langs ; do # note the missing quotes around $langs
        pofile=po/$lang/minetest.po
        if test -e $pofile; then
                echo "[$lang]: updating strings"
-               msgmerge -F -U $pofile $potfile
+               msgmerge --update --sort-by-file $pofile $potfile
        else
                # This will ask for the translator identity
                echo "[$lang]: NEW strings"
-               msginit -l $lang -o $pofile -i $potfile
+               msginit --locale=$lang --output-file=$pofile --input=$potfile
        fi
 done