如何在Windows上使用xgettext创建.po文件? [英] How to create .po files using xgettext on Windows?
问题描述
我正在学习有关使用PHP gettext构建多语言网站的教程,
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:
拥有所有目录之后 准备好了,现在该创建 实际的"pot"文件,通常是 引用:messages.po文件.到 为此,您将需要安装PHP 使用gettext()函数的文件 标记"要翻译的字符串,以及 使用xgettext命令.
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
我必须在命令行中写吗? 执行该命令时,我必须位于哪个文件夹中? 是该命令的Linux版本还是Windows的版本?
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?
(我在wamp ini文件中启用了gettext扩展名) 为了创建.po文件,是否必须从GNU网页下载gettext实用程序?
(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?
推荐答案
您可以使用 Poedit 之类的图形工具来创建,编辑和编译 .po 文件: http://www.poedit.net/
You can use graphical tools like Poedit to create, edit and compile .po files : http://www.poedit.net/
功能:
- .mo文件的自动编译(可选).
- 您可以使用Poedit扫描源代码以查找可翻译的字符串.
- [...]
如果您更喜欢命令行, xgettext (来自 gettext 工具)是从源中提取字符串的命令.这是一个 GNU 软件,可在Linux(已打包为您的发行版)和Windows(例如通过Cygwin)上使用.
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).
这篇关于如何在Windows上使用xgettext创建.po文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!