如何使PoEdit正确解析自定义"ngettext"?执行? [英] How to make PoEdit correctly parse custom "ngettext" implementation?
问题描述
我已经编写了一个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 houses
的复数形式,但是,如果我尝试完全相同,但是使用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正确解析自定义"ngettext"?执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!