0

I have some 500 php files which contain some Japanese texts that are to translated. I want to add gettext to all those japanese texts. How can I add it automatically in all php files

1 Answers1

0

As a starter you can extract all strings:

$ find DIRECTORY -name '*.php*' >POTFILES
$ xgettext -a --files-from=POTFILES

That results in a file messages.po in the current directory, containing all possibly translatable strings. When you open messages.po in a PO editor like emacs (key s) or Poedit (check the docs), you can directly visit the source file from the PO file.

Adding gettext() calls automatically is not supported because you will normally have a lot of false positives.

Guido Flohr
  • 1,871
  • 15
  • 28