[RFC][PATCH] minimal i18n support: default _() pass-through function; 'make pot' will create PO template

Alexander Belchenko bialix at ukr.net
Tue May 8 20:55:50 BST 2007


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

Lukáš Lalinský пишет:
> On Ut, 2007-05-08 at 18:44 +0300, Alexander Belchenko wrote:
>> The subject says all.
>> This is very minimal background to start working on
>> preparing bzrlib string resources to translations.
>>
>> With this patch bzrlib can use _() without any errors,
>> (but and without using translations in runtime)
>> and we able to upload POT file in Rosetta.
>>
>> Now I convert only short help to translatable form,
>> as example.
> 
> Just a couple of things I've noticed... 
> 
> POT files are usually not versioned, since they are auto-generated. And
> you even include pygettext in the patch, so generating the file doesn't
> require any additional dependencies.

May be you're right. I just want to see it included in sources tarball,
this is main reason why I add bzr.pot to bzr.dev. May be I'm wrong here.
Surely I'm not expert in gettext.
I expect that we will update bzr.pot not very often, and usually when
release manager declare feature freeze period.

> Another things is that the _() function shouldn't applied to static
> strings, like _basic_help in this example. The GNU gettext manual
> recommends to use gettext_noop() or N_() to mark these strings for
> translations, and then use gettext() or _() at run-time [1]. In this
> simple patch it doesn't matter, but I think it would be confusing to use
> _() for both cases later.
> 
> [1]
> http://www.gnu.org/software/gettext/manual/html_node/Special-cases.html

I'm not completely understand this point.
We are working with Python, not with C.
There is no static strings in Python.

We may talk only about translated messages and original untranslated messages.

Python documentation for gettext module recommends to use such approach
when access to untranslated strings:

http://docs.python.org/lib/node742.html

In second example you can see mentioned N_() approach. So for clarity
reason we can use N_() when it needed. But only one case when I think we
need access to untranslated strings is smart sever.

We can manipulate with _() in runtime as we need.
And what is more, in Python both expressions _('foo') and N_('foo')
will calling some function (named _ and N_ respectively) with string argument.

If we return to my patch, I think all UI messages shoud use _(),
and only in special cases (like with smart server) we can use N_().


Thank you for you suggestions.

[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGQNXGzYr338mxwCURAvkGAJ0dRPyGbVHi0/4z9v7UfZZiKCm8TACZAZOT
q7rifXLHEoyaJoVwVk5Jh1g=
=TTuL
-----END PGP SIGNATURE-----



More information about the bazaar mailing list