Files
mailnag/gen_po_template
2012-12-20 21:45:57 +01:00

28 lines
571 B
Bash
Executable File

#!/bin/bash
# extracts strings from *.py and .ui files and
# generates a gettext .pot template.
glade_dir=./data
python_dir=./Mailnag
pot_file=./po/mailnag.pot
if [ ! -d ./po ]; then
mkdir ./po
fi
if [ -f $pot_file ]; then
rm $pot_file
fi
# generate string headers of all glade files
for f in $glade_dir/*.ui ; do
intltool-extract --type=gettext/glade $f
done
# write template files
pyfiles=`find $python_dir -iname "*.py" -printf "%p "`
xgettext $pyfiles $glade_dir/*.h --keyword=_ --keyword=N_ --from-code=UTF-8 --output=$pot_file
# clean up
rm $glade_dir/*.h