Internationalisation of bzr cli

Martin Pool mbp at canonical.com
Mon May 2 08:16:17 UTC 2011


2011/4/30 Stephen J. Turnbull <stephen at xemacs.org>:
> Jelmer Vernooij writes:
>  > On Sat, 2011-04-30 at 09:24 +1000, Ben Finney wrote:
>  > > Martin Ueding <list at martin-ueding.de> writes:
>  > >
>  > > > What kind of alias should I use when wrapping strings?
>  > > >
>  > > > The underscore might be a little troublesome with its special value in
>  > > > the Python interpreter as the last return value.
>  > >
>  > > That exists only in the interactive interpreter.
>  > >
>  > > Using ‘_’ for the ‘gettext’ alias is common practice in a lot of Python
>  > > code; I don't see a good reason not to use it here.
>  > When working on bzr at least some of the Bazaar developers often break
>  > into the debugger where e.g. exceptions occur. Not being able to use _
>  > there is a pain.
>
> if __debug__:
>    _i18n = _
>
> No?

No.  There is some special magic behaviour in the Python repl where _
gets rebound during each evaluation, and this interferes with its use
as a variable in the code under inspection (or vice versa).

As bzr-gtk uses _i18n() that sounds like a pretty good precedent.
People can always set up an editor macro that changes _( into _i18n(
as they type.

Martin



More information about the bazaar mailing list