plural forms translation, ngettext

I was asked in
https://bugs.documentfoundation.org/show_bug.cgi?id=83128 about
supporting ngettext-alike plural forms.

https://gerrit.libreoffice.org/#/c/61426/ is my proposal on that.

To current Translate::get(id) we add Translate::nget(id, cardinality)
when requesting the translation.

To current NC_(context, string) we add NNC_(context, singular, plural)
when declaring the strings for translation

We add --keyword=NNC_:1c,2,3 to our xgettext invocation resulting in a
change in the output .po for my calc SCSTR_TOTAL example from

msgctxt "SCSTR_TOTAL"
msgid "%1 results found"
msgstr ""

to

msgctxt "SCSTR_TOTAL"
msgid "1 result found"
msgid_plural "%1 results found"
msgstr[0] ""
msgstr[1] ""

Locally at least this works to give the desired expected results of "1
result found" vs "2 results found" for the simple example.

caolanm->cloph: would this work smoothly with our current pootle stuff?

Ah, https://gerrit.libreoffice.org/#/c/62637/ conflicted because this
is already dealt with :slight_smile:

A Chaoláin a chara

  I've been updating the Irish translations and I'm seeing the plural
forms live on Pootle for the first time - thanks for implementing
this! It will improve the quality of our localized version of
LibreOffice quite a bit.

There's one small issue however: the number of plural forms showing up
for Irish is incorrect; we should have five plural forms with the
following specification:

"Plural-Forms: nplurals=5; plural=n==1 ? 0 : n==2 ? 1 : (n>2 && n<7) ?
2 :(n>6 && n<11) ? 3 : 4;\n"

but I'm only seeing 3 for the LibreOffice translations. This was fixed
in upstream Pootle a few years ago:

https://github.com/translate/translate/issues/3255

(and in CLDR, and elsewhere).

Would it be possible to update the documentfoundation.org Pootle
instance with this new string?

Míle buíochas
Kevin

A Chaoláin a chara

There's one small issue however: the number of plural forms showing
up for Irish is incorrect; we should have five plural forms with the
following specification:

"Plural-Forms: nplurals=5; plural=n==1 ? 0 : n==2 ? 1 : (n>2 && n<7)
? 2 :(n>6 && n<11) ? 3 : 4;\n"

...

Would it be possible to update the documentfoundation.org Pootle
instance with this new string?

I think sophi will fix those up from your submission to this list

Hi Kevin,

A Chaoláin a chara

There's one small issue however: the number of plural forms showing
up for Irish is incorrect; we should have five plural forms with the
following specification:

"Plural-Forms: nplurals=5; plural=n==1 ? 0 : n==2 ? 1 : (n>2 && n<7)
? 2 :(n>6 && n<11) ? 3 : 4;\n"

...

Would it be possible to update the documentfoundation.org Pootle
instance with this new string?

I think sophi will fix those up from your submission to this list

I've corrected number of plurals and added the equation you indicated in
Pootle, let me know if you still meet problems.

Cheers
Sophie