I incorporated a gettext-like localization system in my app, but my translation function looks like this:
t($category, $string, [$plural_string, $number, $vprintf_arguments])
My PoEdit keywords:
t:2
t:2,3
$string
, and it works apparently$string
and $plural_string
- but it's not :(It only sees $string
, so I don't get the plural forms parsed... How can I fix that? I don't want to switch my function to a different argument format because I like this one :(
Also this function acts like a sprintf replacement:
Anyway PoEdit should not interfere with non quoted arguments, right? I mean it will only parse $plural_string as string if it looks like 'abc abc'
gettext only deals with one string at a time. What you may be after is ngettext. (look it up for syntax)
There, you'll put in one text for singular, another for plural, but also the number.
The smart thing about this is, that many languages have a totally different plural structure, than English. Russian, for instance, uses three different forms. One is for where the count ends in a pronounced 'one': 1, 21, 31, 41 etc. The second form is for counts, which end in a pronounced 2, 3 or 4. The third form is for the rest...
And, with ngettext, this can be done. Yeah, in poedit, one has to correctly define the target language's plural structure, but then, it just works.