如何使PoEdit正确解析自定义"ngettext"?执行? [英] How to make PoEdit correctly parse custom "ngettext" implementation?

查看:81
本文介绍了如何使PoEdit正确解析自定义"ngettext"?执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个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仅将_gettextgettext_noop作为要拾取的默认键盘,没有对ngettextdngettextdcngettext函数的任何引用,但是它可以仍然可以正确接听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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆