Yii Po 文件导入器 - 复数

发布于 2024-12-19 06:06:29 字数 764 浏览 3 评论 0原文

如何在这个 Yii 类中添加对复数形式的支持:

http://code.google.com/p/yii/source/browse/tags/1.1.8/framework/i18n/gettext/CGettextPoFile.php

现在的模式

     $pattern='/(msgctxt\s+"(.*?(?<!\\\\))")?'
            . '\s+msgid\s+"(.*?(?<!\\\\))"'
            . '\s+msgstr\s+"(.*?(?<!\\\\))"/';

对应于这样的内容(在 po 文件内):

msgid "Edit Comments"
msgstr "Modifier les commentaires"

但复数定义如下所示:

msgid "%s comment"
msgid_plural "%s comments"
msgstr[0] "%s commentaire"
msgstr[1] "%s commentaires"

问题是,根据语言的不同,可能有 msgstr[3]、msgstr[4] ...

How can I add support for plural forms in this Yii class:

http://code.google.com/p/yii/source/browse/tags/1.1.8/framework/i18n/gettext/CGettextPoFile.php

?

Right now the pattern is

     $pattern='/(msgctxt\s+"(.*?(?<!\\\\))")?'
            . '\s+msgid\s+"(.*?(?<!\\\\))"'
            . '\s+msgstr\s+"(.*?(?<!\\\\))"/';

which corresponds to something like this (inside the po file):

msgid "Edit Comments"
msgstr "Modifier les commentaires"

But a plural definition looks like this:

msgid "%s comment"
msgid_plural "%s comments"
msgstr[0] "%s commentaire"
msgstr[1] "%s commentaires"

The problem is that depending on the language, there can be msgstr[3], msgstr[4] ...

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

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

发布评论

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

评论(1

潦草背影 2024-12-26 06:06:29

我认为最好寻找一个已经支持复数和 msgctx 的 PHP gettext 库。

I think it better to look for a PHP gettext library that already has plurals and msgctx support.

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