How to create .po files using xgettext on Windows?

2019-02-08 23:28发布

I'm following this tutorial about building a multilingual web sites using PHP gettext http://onlamp.com/pub/a/php/2002/06/13/php.html

I understand the tutorial until this part:

After you have the directories all prepared, it's time to create the actual "pot" file, as it is usually referred to: the messages.po file. To do this, you will need to have PHP files that use the gettext() function to "mark" strings to be translated and use the xgettext command.

$ xgettext -n *.php

Do I have to write that in the command line? In which folder do I have to be when I execute that command? Is that the Linux version of the command or for Windows?

(I enabled the gettext extension in my wamp ini file) Do I have to download gettext utilites from the GNU web page in order to create .po files?

标签: php gettext
1条回答
在下西门庆
2楼-- · 2019-02-08 23:57

You can use graphical tools like Poedit to create, edit and compile .po files : http://www.poedit.net/

Features :

  • Automatic compilation of .mo files (optional).
  • You can use Poedit to scan source code for translatable strings.
  • [...]

If you prefer the command line, xgettext (from the gettext tools) is the command to extract strings from sources. It's a GNU software available on Linux (already packaged for your distribution) and Windows (via Cygwin for example).

查看更多
登录 后发表回答