Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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);

But that doesn't work at all, PoEdit picks nothing at all. I also tried:

_e('%d house', '%d houses', 5);

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);

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.

Anyway, is there any way to make PoEdit (or any other similar app), correctly parse custom functions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
355 views
Welcome To Ask or Share your Answers For Others

1 Answer

I've found the solution, the keyword has to be defined with the following expression:

_e:1,2

Source: http://osdir.com/ml/editors.poedit.user/2008-05/msg00012.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...