A
A
Alexander2013-02-02 13:26:24
PHP
Alexander, 2013-02-02 13:26:24

gettext - translation from Russian

I'm trying to localize texts from Russian into English using gettext.
The question arose: how to specify all forms (3 pieces) of plurals ngettext(), which accepts only 2 forms.

Yes: ngettext('%d window', '%d windows', 22) — displays %d windows
Need '%d windows'.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander, 2013-02-03
Gasselbach @kolpeex

You will probably have to use the syntax with two forms, but create a translation file from Russian to Russian, where only plural forms are translated
: msgid "%d a day ago"
msgid_plural "%d days ago"
msgstr[0] "%d a day ago"
msgstr[ 1] "%d days ago"
msgstr[1] "%d days ago"

V
Vyacheslav Slinko, 2013-02-02
@KeepYourMind

www.php.net/manual/en/function.ngettext.php#87649

T
theaspin, 2013-02-02
@theaspin

gettext — Plurals

R
Roman Danilov, 2013-02-03
@Infra_HDC

Let me clarify the terminology. Now this form of the plural is referred - according to Wikipedia - to the remnants of the dual number in modern Russian . According to the philosophy of naming lines in a .po file, in your case, its contents would look something like this:

msgid "%d days ago"
msgid_dual "%d days ago"
msgid_plural "%d days ago"
msgstr[0] "%d day ago"
msgstr[1] "%d days ago"

If, of course, such an option for using the gettext library was in nature.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question