Context in GNOME translations

The same expression may be translated in many ways, depending on the context. GNOME already had its hack to specify context for original messages, but in the future GNOME will use GNU Gettext’s msgctxt. This way it will be much easier to understand the context in original messages, and we’ll be adopting the same syntax as (I believe) KDE 4.

Nowadays, GNOME message catalogs can specify the original message context in the beginning of the original message itself. The context is written before a pipe, and the translator ought to ommit the context and the pipe in the translated message. This is far from being intuitive, and is very error prone. That’s why developers usually warn inexperienced translators with comments, as in this example from GTK+ translation:

#. translators, strip the prefix up to and including the first |
#: gtk/gtkprintoperation.c:1509
msgid "print operation status|Printing"
msgstr "Imprimindo"

KDE translation also has its peculiarities, among which is the way context is specified. KDE message catalogs also inform context in the beginning of original messages, although in a different way. Let’s see this example from the official documentation:

#: kdeui/kstdaction.cpp:669
msgid ""
"_: beginning (of line)n"
"&Home"
msgstr "&Dateianfang"

This divergence exists because GNU Gettext started supporting context only in version 0.15, in June 2006. Today it even supports GNOME’s context syntax, but Gettext’s own context syntax is much cleaner and easier to understand. As a demonstration, let’s rewrite the previous examples. The GTK+ translation would become:

#: gtk/gtkprintoperation.c:1509
msgctxt "print operation status"
msgid "Printing"
msgstr "Imprimindo"

And KDE’s example would look like:

#: kdeui/kstdaction.cpp:669
msgctxt "beginning (of line)"
msgid "&Home"
msgstr "&Dateianfang"

Much better, isn’t it? Lucas Rocha already said GNOME 2.22 will rock; as a translator, I believe the next versions will be even better!

For further information on Gettext support for context, read the GNU info pages on the message catalog format, and on how to implement context in C code.

2 respostas em “Context in GNOME translations

  1. I’m also very happy about this. I think the most important part of this is that automatic QA with pofilter (or similar tools) will now work better with these strings. Now the work begins to get rid of the existing things – I really hope that a clean upgrade path exists so that we don’t end with lots of fuzzy / untranslated entries (in underresourced languages, many files only get attention once in a few years :-/ ) I think it will also be important to help developers understand the difference between comments and context. Unnecessary disambiguation with context will cause more translations (and small teams are already not coping!) And context doesn’t mean that comments are not needed 🙂

  2. Pingback: Leonardo Fontenelle | msgctxt for GNOME 2.26?

Deixe um comentário