gnome2-branch: Translations with disambiguation prefix now possible

Christian Stimming stimming at tuhh.de
Tue Oct 18 08:30:30 EDT 2005


Dear list and listening (no pun intended) Translators,

as we move towards the gnome2 release I remembered that the newer 
libraries will finally enable a very helpful feature in the 
translations: The libglade library now supports a disambiguation prefix 
for msgids. (What's that: [1] below.) To be more precise: This feature 
has been added to libglade-2.3.2 (released 2004-01-12) and also in the 
stable libglade-2.4.0 (released 2004-05-17). According to 
README.dependencies all targeted distros now offer these libraries.

This means that for translation purposes, we can modify GUI label 
strings in the glade files and add a disambiguating prefix to them, if 
needed [2]. An example would be "Transfer", which might be disambiguated 
by 1. "button for creating a new transaction|Transfer" and 2. 
"transaction category/action|Transfer" and have different translations 
for these two. In those cases, only the latter part is translated, but 
of course according to the disambiguating prefix (e.g. German: 1. 
"Buchen", 2. "Ueberweisung", obviously both are totally different). To 
activate this, one has to add the disambiguating prefix to the string in 
the glade file, separated by a '|' from the actual string, and 
additionally the XML attribute "context" has to be set to "yes" for that 
property. This attribute has to be added by hand so far, but glade-2 
will at least keep it if the file is edited afterwards.

@Translators:

If you encounter any msgid that contains a '|' in gnucash, then the part 
before the '|' is a comment and your translation should only contain the 
translation for the part after the '|'. As described, the translations 
in de.po would look like this:

   msgid "button for creating a new transaction|Transfer"
   msgstr "Buchen"

@Developers:

If you encounter a GUI label anywhere in a glade file that contains a 
'|' character, please simply ignore the prefix part in front of the '|'. 
The actual program GUI in libglade will only show the part after the '|'.

If anyone wants to add such a disambiguating comment herself/himself, 
please remember to add the XML attribute 'context="yes"' to the property 
that contains the disambiguated string.

However, I think that such disambiguated strings will occur only very 
rarely and only for a handful of GUI strings in total, so they will 
probably only be added during translation review phase and probably by 
myself anyway. And this won't happen before we've merged the 1.8.x 
translations into the current development branch of CVS, which in turn 
won't happen before we've merged gnome2-dev back into HEAD...

So this message doesn't call for or announce any immediate action, but 
rather serves as a reminder for myself about this new possibility in the 
upcoming gnucash-2.0.0.

Christian



[1] What's a disambiguation prefix in a translated string, and why do we 
need that? Think of any english word that can both be a noun and a verb 
(e.g. "a file" and "to file"). Think of the fact that almost always in 
at least some languages the translation of the verb is radically 
different from the translation of the noun (e.g. in German the noun is 
"Datei" and the verb is "ablegen"). Now think of a GUI button that is 
labelled with this word. Now think of a case where this button has the 
meaning of the verb, and another case where this button has the meaning 
of the noun (e.g. "File" meaning "to file something somewhere" as 
opposed to "File" meaning "do something with a file"). There you are -- 
the msgid in both cases is identical, but the msgstr should be 
different. Therefore a disambiguating addition is needed in the msgids. 
In the example this can be as simple as (in gettext manual's format) 
"noun|File" and "verb|File". The translators will translate only the 
latter part, so for that German example we would have msgid "noun|File" 
-> msgstr "Datei" and msgid "verb|File" -> msgstr "ablegen". You could 
just as well also use the real meaning as disambiguating prefix: "to 
file something somewhere|File" and so on.

Also mentioned here:
http://mail.gnome.org/archives/gnome-devel-list/2003-December/msg00088.html
http://mail.gnome.org/archives/desktop-devel-list/2003-December/msg00512.html

[2] Quote from libglade manual: Libglade also supports disambiguating 
properties by prefixing them with a |-separated context string, e.g. 
"Menu/Printer|Open" vs. "Menu/File|Open". You must tell Libglade that 
the property has a prefix by setting the "context" attribute of the 
<property> element to "yes". To learn more about this technique, read 
the chapter "How to use gettext in GUI programs" in the gettext manual, 
and see the GLib API documentation for g_strip_context(). [from 
http://developer.gnome.org/doc/API/2.0/libglade/libglade-i18n.html ]


More information about the gnucash-devel mailing list