i18n conflicts with pdb debugging

John Arbash Meinel john at arbash-meinel.com
Sat Nov 3 18:28:34 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jelmer Vernooij wrote:
> Am Dienstag, den 30.10.2007, 16:47 -0500 schrieb John Arbash Meinel:
>> I've been working with bzr-gtk recently, and I came across an unexpected problem.
>>
>> Specifically, bzr-gtk makes use of the underscore operator "_()" to allow
>> translations of strings. Which is what I would expect us to move towards in Bazaar.
> 
>> However, it seems that when you are using "PDB" it sets the "_" value to the
>> value of the previous command. So doing something like:
>>
>> (pdb) var
>> Value of variable
>> (pdb) _
>> Value of variable
>>
>> Anyway, it means that after dropping into PDB, if you use "var" to inspect a
>> variable (rather than 'p var') it starts to break the rest of bzr-gtk.
>> (Whenever it goes to translate a string, it instead is trying to call some
>> random object.)
>>
>> Because of this behavior, and our desire to use PDB, maybe we should consider
>> following a different convention for translating strings.
> This is more of a gettext<->pdb rather than a bzr-gtk issue I think.
> Gettext uses _() as function for translatable strings. At least that's
> what I'm used to in C, and couldn't find any definitions of "_" in
> bzr-gtk.
> 
> Cheers,
> 
> Jelmer

I think "import gtk" creates a "_()" builtin function. Rather than using
from gettext import gettext as _

Since, as you say, you don't do anything with '_' inside bzr-gtk itself.

So it is actually a GTK issue.

For C code, the standard way of doing it is having a:

#ifdef USING_GETTEXT // or whatever
#define _(var) gettext(var)
#else
#define _(var) (var)
#endif

And a similar one for N_() and n_gettext() or whatever the real function
name is.

So it is a gettext thing, but bzr-gtk makes wide use of it. I'm
wondering if/when we do i18n in Bazaar we want to *not* use the _()
shortcut, since it interferes badly with pdb.

John
=:->


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHLL3SJdeBCYSNAAMRAkwuAKCOfGkOK4aLZNhX+hNVvocfjW0WcACglMEh
9z/tpE1teiVpwPPzC7AJEQI=
=mcZi
-----END PGP SIGNATURE-----



More information about the bazaar mailing list