将 Poedit 与 XAMPP 结合使用

发布于 2024-09-19 09:24:25 字数 860 浏览 3 评论 0原文

我现在正在努力使用 PHP 的 gettext() 函数进入翻译文件并使用 Poedit 创建文件。 Poedit 也没有附带帮助文件,我尝试了很多在网上找到的东西,但没有任何效果。 我使用的是带有 XAMPP 配置的 Mac OSX。

在 OSX 上,我的 XAMPP 目录

/Applications/XAMPP/xamppfiles/htdocs/

位于此目录中,我使用

<?php echo _("Hello World"); ?>

以下文件夹创建了 gettext.php:

/locale/
/locale/it_IT/LC_MESSAGES/

使用 Poedit,当我这样做时 > >文件>新目录

语言:意大利语
国家: 意大利
字符集:UTF-8
源代码字符集:UTF-8
基本路径:/Applications/XAMPP/xamppfiles/htdocs/

然后我将 default.po 保存到 /locale/it_IT/LC_MESSAGES/

“更新目录失败。单击“更多>>”欲了解详情

13:04:10: Poedit did not find any files in scanned directories.
13:04:11: Entries in the catalog are probably incorrect.
13:04:11: Updating the catalog failed. Click on 'More>>' for details.

I am struggling for quite a while now to get into translation files with PHP's gettext() function and creating the files with Poedit. Poedit didn't come with a helpfile either and I tried lots of things found online but nothing works..
I am on Mac OSX with an XAMPP configuration.

on OSX my XAMPP dir is

/Applications/XAMPP/xamppfiles/htdocs/

inside this dir I created gettext.php with

<?php echo _("Hello World"); ?>

and the following folders:

/locale/
/locale/it_IT/LC_MESSAGES/

With Poedit when I do > File > New Catalog

Language: Italian
Country: Italy
Charset: UTF-8
Source code charset: UTF-8
Base path: /Applications/XAMPP/xamppfiles/htdocs/

Than I save default.po to /locale/it_IT/LC_MESSAGES/

"Updating the catalog failed. Click on 'More>>' for details

13:04:10: Poedit did not find any files in scanned directories.
13:04:11: Entries in the catalog are probably incorrect.
13:04:11: Updating the catalog failed. Click on 'More>>' for details.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Oo萌小芽oO 2024-09-26 09:24:25

Poedit 和 gettext 本身一样有些奇怪。我刚刚尝试并自己收到了错误消息,因为我忘记了一项关键设置。进入目录>选项和路径选项卡,将基本路径复制到路径列表中。我猜 Poedit 使用基本路径来定位 .po 文件。除非您设置(源?)路径之一,否则不会找到实际的源文件。然后菜单项目录>从源文件中读取也应该可用。

Poedit is partially strange like gettext itself. I've just tried and got the error message myself, because I forgot one crucial setting. Go into catalogue > options, and the paths tab, duplicate the base path into the path list. Poedit uses the base path for locating the .po files, I'd guess. The actual source files aren't found unless you set one of the (source?) paths. Then the menu entry catalogue > read from source files should be available as well.

怪我鬧 2024-09-26 09:24:25

其他参考:
当我尝试更新 Javascript 源代码时,我看到了同样的神秘消息。

事实证明我没有将 Javascript 解析器添加到 PoEdit 中。
我通过执行以下有用的步骤解决了问题:

如何使用 poedit 从 js 文件生成 po 文件

For other reference:
I saw the same cryptic message when I tried to update Javascript sources.

It turns out I didn't have the Javascript parser added to PoEdit.
I fixed the problem by following these helpful steps:

how to generate po file from js file using poedit

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文