On Wednesday 03 January 2007 17:30, Giovanni Bajo wrote:
> Your source code should look like this:
>
> self.trUtf8("foo bar translate this")
>
> Notice that the return value of tr()/trUtf8() is obviously a QString
> (duck-typable and convertible to Python's unicode), so your application
> will still be fully unicode. It's only the literal in the source code
> (*immediatly* surrounded by the tr() call) which is a 8-byte str.
>
> BTW: since all my sources are UTF-8, I prefer to specify it as default
> encoding for tr (QTextCodec.setCodecForTr) so that I can later use the
> shorter tr() everywhere in the code.
In my case the code looks like this: self.trUtf8
(some_message_from_the_database)
These are all predefined messages so it's not a problem to translate them, why
it's a unicode string? Well, getting something from the database always
returns a unicode string with my current settings (and with good reason, some
data requires it).Perhaps I'm doing something wrong or addressing it the wrong way but I fail to comprehend why trUtf8 (which is supposed to be unicode) doesn't accept unicode. -- Rick van Hattem Rick.van.Hattem(at)Fawo.nl
pgpWCE2DwWGLt.pgp
Description: PGP signature
_______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
