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

3

17

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.

Befall answered 21/9, 2011 at 7:34 Comment(0)
B
20

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
Blastocyst answered 21/9, 2011 at 9:17 Comment(2)
This is great that you combine the two commands I need into one. +1Shandashandee
@Manu : There is a gettext for windowsGnomic
M
3

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

make update-po

or:

make update-gmo

As a package maintainer we would typically change into the build/po directory and run update-po. This updates the .po files in the source tree (assuming an out-of-tree or VPATH build). The updated .po files are then committed into the repository and after this command a new commit needs to be prepared.

The update-gmo call produces the .gmo files that are normally not committed into the repository, this is usually done automatically during a build.

Mcilroy answered 24/11, 2013 at 2:38 Comment(0)
Y
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

Yeager answered 26/8, 2021 at 23:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.