How to make PoEdit correctly parse custom quot;ngettextquot; implementation?(如何使 PoEdit 正确解析自定义“gettext执行?)
问题描述
我编写了一个 gettext 包装器,它使 l10n 的整个过程稍微简单一些,但不知何故,我无法让 PoEdit 正确识别和解析对该函数的复数版本调用.这是我最初拥有的:
I've coded a gettext wrapper that makes the whole process of l10n a little bit simpler but somehow I can't get PoEdit to correctly identify and parse plural version calls to the function. This is what I originally had:
_e(array('%d house', '%d houses'), 5);
但这根本不起作用,PoEdit 什么都不选.我也试过了:
But that doesn't work at all, PoEdit picks nothing at all. I also tried:
_e('%d house', '%d houses', 5);
这次 PoEdit 捕捉到 %d house
但不是 %d house
的复数形式,但是如果我尝试完全相同但使用 ngettext()
称它完美运行,单数和复数形式都被识别:
This time PoEdit catches the %d house
but not the plural form of %d houses
, however if I try exactly the same but with a ngettext()
call it works perfectly, both the singular and plural forms are identified:
ngettext('%d house', '%d house', 5);
我已正确 (?) 将 _e
关键字添加到项目设置中,但它没有选择复数变体.我还注意到 PoEdit 只有 _
、gettext
和 gettext_noop
作为默认的按键,没有任何参考ngettext
、dngettext
或 dcngettext
函数,但它仍然可以正确接收 ngettext
调用...这让我想知道 PoEdit 是否对 ngettext
关键字进行了硬编码——那真的很难过.
I've correctly (?) added the _e
keyword to the project settings, but it doesn't pick up plural variations. I've also noticed that PoEdit only has _
, gettext
and gettext_noop
as the default keyworks to pick up, there is no reference whatsoever to the ngettext
, dngettext
or dcngettext
functions but it can still correctly pick up the ngettext
calls... This makes me wonder if PoEdit has hardcoded the ngettext
keyword - that would be really sad.
无论如何,有没有办法让 PoEdit(或任何其他类似的应用程序)正确解析自定义函数?
Anyway, is there any way to make PoEdit (or any other similar app), correctly parse custom functions?
推荐答案
我找到了解决方案,关键字必须用以下表达式定义:
I've found the solution, the keyword has to be defined with the following expression:
_e:1,2
来源:http://osdir.com/ml/editors.poedit.user/2008-05/msg00012.html
这篇关于如何使 PoEdit 正确解析自定义“gettext"执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使 PoEdit 正确解析自定义“gettext"执行?
基础教程推荐
- 在多维数组中查找最大值 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01