[I18n-sig] Re: gettext in the standard library
M.-A. Lemburg
mal@lemburg.com
Mon, 04 Sep 2000 20:39:03 +0200
Martin von Loewis wrote:
>
> > Problems would arise if the source strings were recoded, between string
> > extraction by POT tools, and string usage for translation at run-time.
> > Python will likely "internalise" or convert Unicode strings from UTF-8,
> > and this is a change of representation.
>
> Currently, to put Unicode strings into source code, you'll have to use
> \u escapes in your source(e.g. print u"\u263A"). I'm not aware of any
> editor that transparently displays these beasts.
You could wrap the decoding processing into the _ function:
def _(s):
return unicode(s, "utf-8")
This would allow you not only to use translatable strings,
but also any unicode string encoding you like, e.g. utf-8
or latin1.
Once the "declare" statement is in place you should also be
able to write:
declare encoding = "utf-8"
... u"utf-8 encoded string" ...
in Python source code.
--
Marc-Andre Lemburg
______________________________________________________________________
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/