Mikko Rantalainen
Mikko Rantalainen

Reputation: 15935

How to get plural translation for string that requires context?

I know that the gettext library has pgettext() which can be used to translate a piece of string for given context. I also know that it has ngettext() which can be used to translate string which should have different singular and plurar forms.

How to translate a string which should have different singular and plurar forms and depends on context? It seems that logical extension called pngettext() doesn't exist.

I'd want to use such behavior from PHP but I'd be happy to know a solution for plain C only.

Upvotes: 2

Views: 312

Answers (2)

Stas Trefilov
Stas Trefilov

Reputation: 203

Functionality available in vertilia/text userland php library, together with heredoc/nowdoc php syntax which is not parsed correctly by xgettext as to my knowledge...

Disclaimer: I am a developer of vertilia/text.

Upvotes: 1

Lauri Nurmi
Lauri Nurmi

Reputation: 591

There seems to be npgettext() in Python's gettext documentation, and for C, a macro by that name is defined in gettext.h (but not libintl.h).

Upvotes: 1

Related Questions