Re: Context in translations, Q_() and gettext



Le dimanche 08 juillet 2007 �2:18 -0400, Matthias Clasen a �it :
> GLib offers the Q_() macro for adding context to translations, but 
> the solution of embedding the context into the msgid is error-prone 
> for translators and can lead to regular msgids being misinterpreted 
> as having a context. 
> 
> When this was last discussed on this list 1 1/2 years ago, there
> seemed to be consensus that a solution that keeps context and msgid
> separate is preferable. Since then, GNU gettext has added support 
> for this in the form of msgctxt, which has been available in gettext
> 0.15 for a year now. 
> 
> I'd like to add support for separate message context to the next 
> GLib release (i.e. not 2.14, which is almost done), in the form of 
> a C_(Context,Msgid) macro. An implementation of this can be found
> in http://bugzilla.gnome.org/show_bug.cgi?id=142676 . The patch
> also modifies the Q_() macro so that it can keep working even if
> the contexts in .po files are converted to msgctxt (xgettext can
> do this automatically)
> 
> There is a number of questions that I'd like to find answers for
> before we decide to push for adoption of msgctxt:
> 
> - Have the translation tools caught up with msgctxt yet, or will
>   msgctxt cause problems for translators ?

Hi Matthias,

It's a great idea to implement this new capability.

It seems that only KBabel has implemented it, from 1.11, KDE 3.5:
http://lxr.kde.org/source/KDE/kdesdk/kbabel/ChangeLog

poEdit has a bug report for this:
http://sourceforge.net/tracker/index.php?func=detail&aid=1680554&group_id=27043&atid=389153

And I think GTranslator has no support either. I didn't find anything in
the ChangeLog:
http://svn.gnome.org/viewcvs/gtranslator/trunk/ChangeLog

Anyway, KBabel is currently the better maintained tool with the greatest
functionnalities. And this is said by a GNOMEr... :-)

> - Will it be a big problem for people using alternative gettext
>   implementations if msgctxt starts to appear in .po files ? 
>   Do we need to provide a script to "fold back" msgctxt into 
>   msgid prefixes, for use with old msgfmt implementations, 
>   or can we expect everybody to use GNU gettext for creating 
>   .mo files ? 

I think we should go ahead, and fix alternative gettext implementations,
if any. 

> - How can we handle existing translations when context moves
>   from the msgid to msgctxt ? 
>   Does msgmerge handle this intelligently, or do we need some 
>   conversion script ?

Needs some testing. It should at least generate a fuzzy.

> - Can we make the transition from Q_() to C_() smoother ? 
>   Unfortunately, xgettext does not provide a way to extract
>   strings from a 2-argument macro like C_() to msgid-prefix
>   form.
> 
> As a test balloon for this, I have added support for separate
> context to the GtkBuilder xml format, in the following form:
> 
> <property name="foo" 
>           translatable="yes"
>           context="context">message</property>
> 
> A patch which makes intltool handle this format can be found
> here http://bugzilla.gnome.org/show_bug.cgi?id=454894. The patch 
> allows intltool to extract this as either
> 
>  pgettext ("context", "message")
> 
> or
> 
>  gettext ("context|message")
> 
> GtkBuilder will work with the resulting .mo files for both 
> variants.

I find it very clean. But I'm not experienced enough in the programming
part to evaluate all possible side effects.

Claude 




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