[Merge] lp:~songofacandy/bzr/i18n into lp:bzr

Alexander Belchenko bialix at ukr.net
Wed May 11 11:24:24 UTC 2011


Alexander Belchenko пишет:
> Vincent Ladeuil пишет:
>> <snip/>
>>
>>     > Because _ has special meaning in PDB. Why does it matter?

I can add even more reasons against using _() in first place.

Function _() is just alias to some gettext method which is bound to 
specific language at installing time.

So the usual practice for GUI applications is to install _() into global 
namespace leaving gettext to determine what language user wants to see
and don't care about translations anymore.

I think this is wrong approach, although it may work OK for many 
projects out there.

1) Function _() translates the strings to some language immediately. 
That's could not what you want if you don't plan to show all those 
strings to user from the start. That could be OK for GUI applications, 
which shows most of their strings as menu/interface to the user. But 
this is simply the wrong way for CLI like bzr, who wants to achieve 
speed. Bzr wants to be lazy and don't do extra work until it's really 
needed.

2) Function _() translate the strings to some language immediately.
That will be VERY bad for tests which check output of bzr commands. 
Output never will match until you have forced C locale before running tetst.

3) For QBzr/Explorer I've implemented support for user-defined language 
of the UI, it's stored as language option in bazaar.conf. And that's not 
whim. People asked for this to be able run our GUI in preferred 
language, maybe because translations could be incomplete. I don't see 
why CLI bzr won't support the same.

More guides about proper usage of i18n in QBzr can be found here:

http://bazaar.launchpad.net/~qbzr-dev/qbzr/trunk2a/view/head:/docs/gettext_usage.txt
or
http://bialix.com/qbzr/docs/gettext_usage.html

I believe that approach used in QBzr and Explorer (plus nice 
ZzzTranslations class in explorer) is much more powerful and flexible 
than trying to use plain _(). I can be wrong of course, and will be 
happy to hear the contra arguments. But so far I haven't heard them.
Maybe I'm trying to achieve too much, but in the end I'm not native 
English speaker and proper i18n/l10n stuff is important for me. So maybe 
my own standards a bit higher than in the other projects. Please, bear 
with me.



More information about the bazaar mailing list