Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gettext : How to update po and pot files after the source is modified

I've got a python project with internationalized strings. I've modified the source codes and the lines of the strings are changed, i.e. in pot and po files lines of he strings are not pointing to correct lines.

So how to update the po and pot files to new string locations in files.

like image 240
deimus Avatar asked Sep 21 '11 07:09

deimus


2 Answers

You could have a look to this script to update your po files with new code. It use xgettext and msgmerge.

echo '' > messages.po # xgettext needs that file, and we need it empty
find . -type f -iname "*.py" | xgettext -j -f - # this modifies messages.po
msgmerge -N existing.po messages.po > new.po
mv new.po existing.po
rm messages.po
like image 87
Cédric Julien Avatar answered Nov 10 '22 15:11

Cédric Julien


Using autoconf and automake you can simply change into the po subdirectory and run:

make update-po

or:

make update-gmo
like image 2
lanoxx Avatar answered Nov 10 '22 16:11

lanoxx