GNOME Bugzilla – Bug 609872
Some explanation about translation context
Last modified: 2011-03-06 20:38:43 UTC
Created attachment 153739 [details] Screenshot of the placeholder string gladeui/glade-editor-property.c around line 1800 contains: gtk_widget_set_tooltip_text (alignment,"XXX Some explanation about translation context please ???"); I saw this on the UI and it's quite ugly, so it's time to figure out something useful :). Moreover, developers tend to mix up translation contexts and translator comments. How about this: Type a word here to differentiate the meaning of this string from the meaning of other occurrences of the same string While we are at it, it would be also nice to provide a similar tooltip for the translator comment box, like: Explain the use case of this string to translators I'll ping gnome-i18n@ for input on this.
(In reply to comment #0) > > How about this: > Type a word here to differentiate the meaning of this string from the meaning > of other occurrences of the same string > Hmmm reading that confuses me; I still dont entirely understand what that field should provide; something like this ? "Green": (context: color || context: fresh - "He was green") "Blue": (context: color || context: emotion; feeling blue) How is the context string used by translators generally ? does it have to be only one word ? Is it generally used for translation of short strings rather than entire sentences ? Could we say something like: "Provide contextual meaning to short strings for translators" ? Or something like: "Provide context to some strings in case of ambiguity" ? > While we are at it, it would be also nice to provide a similar tooltip for the > translator comment box, like: > Explain the use case of this string to translators > > I'll ping gnome-i18n@ for input on this. Great, would be nice to have an opinion from them.
Context is used when the string occurs multiple times in the sources, but the meaning of one string differs from the meaning of other occurrences. See also the gettext manual: http://www.gnu.org/software/gettext/manual/gettext.html#Contexts and http://library.gnome.org/devel/glib/stable/glib-I18N.html#C-:CAPS By default, gettext collects multiple instances of source strings to one entry in the pot file, like this: #: ../src/glade-window.c:2067 ../plugins/gtk+/glade-gtk.c:7149 #: ../plugins/gtk+/glade-gtk.c:7479 msgid "_Edit" msgstr "" This is mostly convenient, because the meaning of the same string is usually the same, but when it is not, translators are in trouble. For example: #. Translators: this is a picture not #. * a disc image brasero.master.hu.po:msgctxt "picture" brasero.master.hu.po-msgid "Please select another image." #. Translators: this is a disc image, not a picture brasero.master.hu.po:msgctxt "disc" brasero.master.hu.po-msgid "Please select another image." The msgctxt field is not meant to be an explanation for translators, just a short identifier to make xgettext know that it should create a unique entry in the pot file. This is usually a short word, as explaining the meaning of the string should be done in the translator comment (lines starting with #.), as you can see above. This is used usually for short strings, because it's easier to misunderstand one word (Is this "Left" meaning "on the left" or "to the left" or the arrow button?) than a longer sentence. Comments are useful when a string is ambiguous[1], and the developer is nice enough to tell us which meaning is currently used. This is the standard comment of programming languages, in the line before the string. [1]: http://uncyclopedia.wikia.com/wiki/GNOME_Localisation#1._Of
I agree with how Gabor is explaining this. The context is to disambiguate otherwise identical strings, the comments is to explain or to provide extra instructions.
Yes I am not trying to argue, I am just trying to understand. From the POV of a programmer, who just uses _("this") to mark stings in the UI as translatable - we do not understand the meaning or exact usage of the context parameter. For example: the suggested text was: "Type a word here to differentiate the meaning of this string from the meaning of other occurrences of the same string" This explains something, but from the last comments I learned something completely new, I learned that setting the context identifier string is necessary /if you want to expose the string for translation more than once/. So I'm not sure how to cook that up into the right sentence, but the developer needs to know that filling in that field will cause an extra duplicate string to be translated "under a new context". Maybe the property title should be something like: "Provide context for this occurrence of this string:" and then the tooltip itself explain the juice: "If this translatable string can show up multiple times with different meanings, you need to explicitly expose it for further translation by indicating the context here" I'm not sure about the wording, but it should tell the user the important fact that multiple strings will be exposed for translation as a result of marking the context (and that they will be exposed under the new color of "context" that they are essentially declaring by typing in a context string).
Ok this has been years, I might as well put something more useful than "XXX help me" So I ended up putting this: _("For short and ambiguous strings: type a word here to differentiate " "the meaning of this string from the meaning of other occurrences of " "the same string"));