Status of internationalization
Thomas Arendsen Hein
thomas at intevation.de
Thu Jun 30 10:05:37 UTC 2005
* vseguip at gmail.com <vseguip at gmail.com> [20050630 11:34]:
> On 6/30/05, Thomas Arendsen Hein <thomas at intevation.de> wrote:
> > Ok, someone will add a wrapper in compat.py when it's time to
> > include that.
>
> I propose adding lgettext to compat.py and conditionally use it when
> at python 2.3.
>
> What do you think about it?
Both ways are ok for me, just remember that we need _ and N_, which
usually are:
_ = gettext
def N_(text):
return text
With lgettext this may[1] have to be slightly different:
_ = lgettext
def N_(text):
return text.encode(encoding)
[1]: If we assume that there can be unicode strings in Mercurial,
which happend in another project with the contributors list in an
About dialog.
*Oh, wait!*
Please roll back until my mail which shows the sample implementation
of ui.write.
We have unicode commit messages, authors and such! So it would be
much better to stay at unicode as long as possible:
user = u'Vicent Segu\xed Pascual'
ui.write(_("Author for this: %(author)s\n"), author=user)
With _ = lgettext this would be:
user = u'Vicent Segu\xed Pascual'
ui.write(_("Author for this: %(author)s\n"), author=user.encode(encoding))
Thomas
--
Email: thomas at intevation.de
http://intevation.de/~thomas/
More information about the Mercurial
mailing list