[gnome-software] Multiple plurals in one sentence



Hello,

As some of you probably know, we have recently been struggling with the
bug bgo#726990 [1]. With two recent commits [2, 3] I believe we have finally
fixed it. Here are some my comments about how we have fixed it and how to
provide the translations correctly.

First of all, I'd like to apologize the translators to the following languages:
Spanish, Russian, Slovenian, Slovak, and Galician, who have been unlucky to
commit their translation between our two commits. The first one turned out
to be insufficient for some languages so we have provided the second commit.
The translators for these 5 languages probably will have to partially revert
to the older translations of this sentence because they were more appropriate.

Here are some hints for all translators. The full sentence is:
"%i applications and %i add-ons installed" and will be translated as four
cases. Three first cases are simple:

1. There are no applications and no add-ons: "No software installed";
2. There are no applications but some add-ons: "%i add-on(s) installed";
3. There are some applications but no add-ons: "%i application(s) installed".

These cases are handled normally by ngettext() and don't need explanations.
The fourth case is complex: there are some applications and some add-ons.
The plural/singular form of "application(s)" depends on the number of
applications, "add-on(s)" depends on the number of add-ons, and the rest
of the sentence ("... and ... installed") may depend on the number of
applications,
the number of add-ons, and the total sum of both. ngettext() does not handle
such cases.

We have decided to split the sentence into 3 strings:

* "%i application(s)"--the correct form depends on the number of applications;
* "%i add-on(s)"--the correct form depends on the number of add-ons;
* "%s and %s installed"--the correct form depends on the total sum of
  applications and add-ons, and "%s" are replaced with the correct forms
  of "application(s)" and "add-on(s)".

In some languages, like English, there is no difference between singular
and plural form of "... and ... installed". In some languages there is
a difference but since the total sum of applications and add-ons is
at least 1 + 1 = 2 then only plural form will be used. But there are
languages which have more cases than singular and plural, for example
they may have double form or separate plural forms for "few" and "many".

Example: Spanish should be something like:

msgid "%i application"
msgid_plural "%i applications"
msgstr[0] "%i aplicación"
msgstr[1] "%i aplicaciones"

msgid "%i add-on"
msgid_plural "%i add-ons"
msgstr[0] "%i complemento"
msgstr[1] "%i complementos"

msgid "%s and %s installed"
msgid_plural "%s and %s installed"
msgstr[0] "%s y %s instalado"
msgstr[1] "%s y %s instalados"

(The above is my guess, I don't know Spanish! :) )
Of course, the singular case "%s y %s instalado" will not be used but
this is the right place to put double form etc.

In some languages the word "installed" is placed at the beginning of the
sentence and its correct form is agreed with the word "application(s)".
(Also there may be languages where it must be agreed with "add-on(s)".)
In these cases you should translate "installed" together with "application(s)".

Example: Slovak should be something like:

msgid "%i application"
msgid_plural "%i applications"
msgstr[0] "Bolo nainštalovaných %i aplikácií"
msgstr[1] "Bola nainštalovaná %i aplikácia"
msgstr[2] "Boli nainštalované %i aplikácie"

msgid "%i add-on"
msgid_plural "%i add-ons"
msgstr[0] "%i doplnkov"
msgstr[1] "%i doplnok"
msgstr[2] "%i doplnky"

+msgid "%s and %s installed"
+msgid_plural "%s and %s installed"
+msgstr[0] "%s a %s"
+msgstr[1] "%s a %s"
+msgstr[2] "%s a %s"

(The above is also my guess, sorry if I misunderstand anything.)
Similar rules should be applied if the correct form of "and" depends
on the number of applications, add-ons, or total sum of both.
As you can see, this algorithm is flexible and can cover many cases,
I hope it actually covers all cases.

Do not hesitate to ask me here or in bugzilla if you need help in your
language. Also please reopen the bug [1] or report the new bug if
the translation to your language cannot be provided with this algorithm.

Best regards,

Rafał

[1] https://bugzilla.gnome.org/show_bug.cgi?id=726990
[2] https://git.gnome.org/browse/gnome-software/commit/?id=a8c4497
[3] https://git.gnome.org/browse/gnome-software/commit/?id=f4a0371


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]