Yii Po 文件导入器 - 复数
如何在这个 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最好寻找一个已经支持复数和 msgctx 的 PHP gettext 库。
I think it better to look for a PHP gettext library that already has plurals and msgctx support.