[PyKDE] Feedback Needed on Possible tr() Changes
Jan L. Nauta
jln at magentammt.com
Mon May 26 16:05:01 BST 2003
> This still doesn't reproduce the C++ behaviour. If somebody ships a class
> library, implemented in Python and including translation files,
> then there is the possibility that an application translation will be used
> instead of the
> intended class library one.
Well, it _almost_ reproduces the C++ behaviour. But also doesn't require any
changes to existing (generated) Python code. And it even has the benefit
that you can 'override' translations, which depending on your viewpoint can
also be a disadvantage.
I also don't agree with your counter example. If somebody ships translation
files they will be searched _before_ the application translation. The
application translation is only used as a fall-back. In more complicated
situations, you could use a list of translators. This allows you to control
the sequence used to search the translators.
Regards, jln
> -----Original Message-----
> From: pykde-admin at mats.imk.fraunhofer.de
> [mailto:pykde-admin at mats.imk.fraunhofer.de]On Behalf Of Phil Thompson
> Sent: Monday, May 26, 2003 3:50 PM
> To: Jan L. Nauta; pykde at mats.imk.fraunhofer.de
> Subject: Re: [PyKDE] Feedback Needed on Possible tr() Changes
>
>
> On Monday 26 May 2003 8:20 am, Jan L. Nauta wrote:
> > Or another alternative would be:
> >
> > 4. Your implementation of QObject::tr() now does a dynamic lookup of the
> > class name. You could use the QTranslator::contains() method to
> check if a
> > particular context/string is available in a translator,
> starting with the
> > class. If the class doesn't have a translation, check with the base
> > class(es)...
> >
> > <code>
> > if python_translator installed :
> > class = class type of self
> > while class :
> > if python_translator.contains(class.name, string) :
> > return translated string
> > class = base class
> >
> > previous implementation
> > </code>
> >
> > All you need now is a PyQt call to set the python_translator. If the
> > python_translator isn't set, the 'old' implementation is used.
> This way no
> > sources have to be changed, and the new behavious is only available if
> > requested.
>
> This still doesn't reproduce the C++ behaviour. If somebody ships a class
> library, implemented in Python and including translation files,
> then there is
> the possibility that an application translation will be used
> instead of the
> intended class library one.
>
> Phil
>
> _______________________________________________
> PyKDE mailing list PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>
More information about the PyQt
mailing list