16

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.

deimus
  • 9,565
  • 12
  • 63
  • 107

3 Answers3

19

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
Flimm
  • 136,138
  • 45
  • 251
  • 267
Cédric Julien
  • 78,516
  • 15
  • 127
  • 132
2

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

make update-po

or:

make update-gmo
lanoxx
  • 12,249
  • 13
  • 87
  • 142
0

For those who use meson:

<project_id>-pot and <project_id>-update-po.

E.g. for iputils project:

$ dir="/tmp/build"
$ meson . $dir && ninja iputils-pot -C $dir && ninja iputils-update-po -C $dir

SOURCE: https://mesonbuild.com/i18n-module.html

pevik
  • 4,523
  • 3
  • 33
  • 44