Notice how the first compilation with pyside-5.15.4 returns translate with 3 arguments instead of 4.
When we eventually use QtCompat.translate() we run into the following error:
File "/dd/shows/DEV01/user/work.akelada/tools/cent7_64/package/launchpad/0.1.2/python/launchpad/Ui_launchpad_UI.py", line 205, in retranslateUi
MainWindow.setWindowTitle(QtCompat.translate("MainWindow", u"MainWindow", None))
File "/dd/tools/cent7_64/package/qt_py/1.3.6/python/Qt.py", line 844, in _translate
"Expected 4 or 5 arguments, got {0}.".format(len(args) + 2))
TypeError: Expected 4 or 5 arguments, got 3.
Now translate("MainWindow", u"MainWindow", None) will work since n defaults to -1.
In this pull request, I update the logic in
translate()
to allow optional arguments.I decided to open this pull request after I ran into a ui file compilation difference:
Notice how the first compilation with
pyside-5.15.4
returns translate with 3 arguments instead of 4. When we eventually useQtCompat.translate()
we run into the following error:Now
translate("MainWindow", u"MainWindow", None)
will work sincen
defaults to-1
.