Re: Challenges in translating GNOME recipes


8.12.2016 17:43 Enrico <liverig gmail com> wrote:

 About your mention to "My current approach is to provide separate
translations for
 singular and plural, but I guess this way of doing this will never be
 entirely ngettext-ly correct.", have you considered using the gettext
( ?

Yes, Matthias did. Here is an example:

#: src/gr-details-page.c:656
#, c-format
msgid "You've cooked this recipe before"
msgid_plural "You've cooked this recipe %d times"
msgstr[0] ""
msgstr[1] ""

Indeed, ngettext() and similar functions seem to be necessary
here. One shouldn't try to resolve the pluralization problems
oneself, first because they are too complex, second because
they are already resolved by gettext.

But in this particular case this pluralization will not work
as you want it in languages which don't have plural forms,
for example east Asian languages. In these languages they will
see "You've cooked this recipe 1 time" instead. Also there are
languages (e.g., Russian) which reuse a singular form for plural
numbers ending with 1 (e.g., 21, 31, 41...) so they will see:

"You've cooked this recipe 29 times"
"You've cooked this recipe 30 times"
"You've cooked this recipe before"    // 31 disappeared!
"You've cooked this recipe 32 times"
"You've cooked this recipe 33 times"

So if you really want a separate form for 1 then do it
programmatically but also leave the full pluralization support
for plurals.

2016-12-08 13:07 GMT-02:00 Matthias Clasen <matthias clasen gmail com
mailto:matthias clasen gmail com >:
   - The app also has an ingredient list and allows to search by
   ingredients, as well as by other criteria. In those places,
   ingredients should clearly be translated, and we need to be able to
   map from the translated ingredient names to the language in which they
   appear in the recipes (which may be different from recipe to recipe,
   depending on whether the recipe is from the preinstalled set, or
   entered by the user...)

Will these ingredients appear in the middle of sentences or only in
headers, as a list of ingredients and the body will always remain
unchanged? Will they be extracted from the body of the recipe automatically
or will an author have to provide a separate list of ingredients and
maybe tag them correctly manually? Please note that some languages
use declension: there are suffixes added to the words so the same word
may have several forms and processing it automatically is not a trivial
task. Of course there are software solutions which can deal with this
problem. At least sometimes. :-)

   - When scaling ingredients (e.g double a recipe), we need to be able
   to change translated ingredients and units from singular to plural
   forms. My current approach is to provide separate translations for
   singular and plural, but I guess this way of doing this will never be
   entirely ngettext-ly correct.

If these ingredients are in the middle of the recipe body, inside the
sentences then changing singular to plural or one plural form to another
plural form maintaining a correct grammatical form is even more complex.



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