我有一个带有国际化字符串的python项目。 我已经修改了源代码并且字符串的行被更改了,即在pot和po文件中,字符串的行没有指向正确的行。
那么如何将po和pot文件更新为文件中的新字符串位置。
答案 0 :(得分:14)
您可以查看this script以使用新代码更新您的po文件。它使用xgettext和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
答案 1 :(得分:2)
使用autoconf
和automake
,您只需更改为po
子目录并运行:
make update-po
或:
make update-gmo