[PyQt] How does sip.setapi("QString",2) work with translations?

Brett Stottlemyer brett at stottlemyer.com
Sat Nov 27 20:27:13 GMT 2010

Hi, all-

I'd like to use  sip.setapi("QString",2), but I'm using internationalization
as well and it is giving me some trouble.

If I try:
> qApp.translate("test","Internationalize")
I get Unicode "Internationalize" as the result (as expected)

When I try:
> qApp.translate("test","Internationalize %1").arg("42")
I get
AttributeError: 'unicode' object has no attribute 'arg'.  I guess this is
expected, too, but I was hoping Phil had done some magic to have it work as

Is there a way to get this to work using Qt style formatting?  Or do I need
to convert everything to python-style, like this:
> qApp.translate("test","Internationalize %d")%42


More information about the PyQt mailing list