1
votes

I have a web project (php+js) translated by gettext. Later it was only translated at server side, pushing translations to JS by varying weird ways. Now i converted it to all gettext, convert my .po files by po2json and load them into Jed library. But this way I load all translations, even never used on client !

What i want to do now:

xgettext -js-options *.js > js-empty.po
xgettext -php-options *.php > php-empty.po
magic both-translated.po js-empty.po > js-translated.po
magic both-translated.po php-empty.po > php-translated.po

What should i use as 'magic' ?

P.S. I will be doing actual translation in one file and then split just for optimization, on every build.

1

1 Answers

0
votes

I have found the solution:

msgcomm both-translated.po js-empty.po -o js-translated.po

Visual inspection confirms what lines are translated, and the following command confirms what number of 'msgid' is equal in empty and translated files:

grep msgid $1 | wc -l

Adding more value to answer: where's well recommended Python library https://pypi.python.org/pypi/polib, or in main Linux distributions, packages 'python3-polib' or 'python-polib'. I was considering using it to perform the task and maybe will use in future for other gettext-related tasks.