On Montag, 3. Januar 2011, Nahuel Defossé wrote:
> Hi
> 
> I've noticed that both QObject.trUtf8 and QObject.tr do not return
> Python strings, what is rather unconvinient when using the % operator
> to format strings.
> I prefer str % operator since it accepts keyword arguments, something
> that is not that simple QString.arg method.
> 
> What is your advice to get unicode or str from QObject.tr? 

The obvious for Python2 would be 

unicode(QObject.trUtf8("some Python string with %s")) % "placeholder"

For Python3 (using the QString API v2) you already get strings back.

> I tried to
> implement QApplication.translate, QApplication.tr and
> QApplication.trUtf8 with no
> results whether I used the staticmethod decorator or not.
> 
> Thanks
> Nahuel
> _______________________________________________
> PyQt mailing list    [email protected]
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
Detlev Offenbach
[email protected]
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to