After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 102922 - gcalctool uses broken sentence hacks in messages
gcalctool uses broken sentence hacks in messages
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Rich Burridge
Rich Burridge
Depends on:
Blocks:
 
 
Reported: 2003-01-09 11:07 UTC by Christian Rose
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Rose 2003-01-09 11:07:13 UTC
From gtk.c:451:

        SPRINTF(str, _("Invalid %s number.\nMust be in the range 0 - 9"),
                (X->CFtype == M_CON) ? _("constant") : _("function"));

Please don't use sentence hacks like this. Below is the full explanation of
why this is a problem.

---
Never split sentences in several gettext calls. This splits the sentence
into several messages, and a sentence can only be properly translated in
its entirety, since word order, proper terminology and grammar vary a lot
between languages. Unfortunately, it's too common to see something like
these frightening fictual examples in the source code:

   g_printf (_("There are "),
             NO_FROBNICATORS,
             _(" frobnicators available."));
   

   g_printf (_("You chose a yellow "));
   if (choice == FISH_CHOICE) {
     g_printf (_("fish."));
   } else {
     g_printf (_("cat."));
   }
   

Remember that each and every call to _() will result in a message that can
end up at any place and in any order in the po file. " frobnicators
available." and "There are " won't make much sense for themselves and can
easily be accidentally mistranslated when out of context. Even though these
messages may look suspicious, putting together this puzzle of which message
belongs to which other one is a form of source code reverse engineering
that most translators don't want to spend time on. Even worse, sometimes
these splitups make proper translation not only extremely difficult but
even impossible. This can be the case if the splitup results in the same
sentence fragments used in several places but the words need different
tenses or gender in the different cases, which may not be the case in English.

The proper solution is, as stated previously, to change the code so that
the sentences can be marked for translation in their entirety:

   g_printf (_("There are %d frobnicators available."),
             NO_FROBNICATORS);
   

   if (choice == FISH_CHOICE) {
     g_printf (_("You chose a yellow fish."));
   } else {
     g_printf (_("You chose a yellow cat."));
   }
---

Please use a similar solution in this case, moving the case substitution
out of the message.
Comment 1 Christian Rose 2003-01-09 11:12:24 UTC
The same problem applies to

        SPRINTF(str, _("%s %1d already exists.\nOkay to overwrite?"),
                (X->CFtype == M_CON) ? _("Constant") : _("Function"),
cfno);

in the same file.
Comment 2 Rich Burridge 2003-01-09 16:17:44 UTC
Thanks for the excellent writeup on why this was needed.
Done. Fixed in v4.2.4.