Reputation: 157
I have inherited a sample.pot file. Now, I have added new messages in a1.c and a2.cpp. Is it possible for me to use xgettext and output the contents to same sample.pot instead of creating a new one? Eg:-
xgettext -d sample -s -o sample.pot a1.c
xgettext -d sample -s -o sample.pot a2.cpp
Is this preferred way to go in order to update the template such that old messages are also preserved? The other question is how do we distinguish translatable strings from normal strings in source code. I assume xgettext will pull all strings from mentioned source code file.
It would be great if anybody can share the correct approach..Thanks
Upvotes: 5
Views: 3631
Reputation: 2340
The simplest way to achieve this is:
xgettext -o sample.pot -s a1.c a2.cpp sample.pot
You don't need -j
, --join-existing
because xgettext accepts .po
and .pot
files as regular input files.
The option -j
, --join-existing
is rarely useful. In conjunction with -D
, --directory
it has the effect that the output file sample.pot
used as an input file is not searched in the list of directories. If you use -l c
, --language=c
you need -j
, --join-existing
because sample.pot
would otherwise be parsed as a C/C++ source file.
Besides, -o sample.pot
, --output=sample.pot
has exactly the same effect as -d sample
, --default-domain=sample
. You can safely omit one of them.
Upvotes: 2
Reputation: 1280
Does the -j
, --join-existing
option ("join messages with existing file") not do what you need?
Note that you can specify more than one input file on the command line.
xgettext -d sample -s -j -o sample.pot a1.c a2.cpp
Upvotes: 4