gpt4 book ai didi

php - 如何在 Windows 上使用 xgettext 创建 .po 文件?

转载 作者:可可西里 更新时间:2023-10-31 22:48:09 25 4
gpt4 key购买 nike

我正在学习有关使用 PHP gettext http://onlamp.com/pub/a/php/2002/06/13/php.html 构建多语言网站的教程

我理解教程直到这部分:

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 版本?

(我在我的 wamp ini 文件中启用了 gettext 扩展)我是否必须从 GNU 网页下载 gettext 实用程序才能创建 .po 文件?

最佳答案

您可以使用Poedit 等图形工具来创建、编辑和编译.po 文件: http://www.poedit.net/

特点:

  • .mo 文件的自动编译(可选)。
  • 您可以使用 Poedit 扫描源代码以查找可翻译的字符串。
  • [...]

如果您更喜欢命令行,xgettext(来自gettext 工具)是从源中提取字符串的命令。它是一个 GNU 软件,可在 Linux(已为您的发行版打包)和 Windows(例如通过 Cygwin)上使用。

关于php - 如何在 Windows 上使用 xgettext 创建 .po 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2258211/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com