How to create .ts files for Qt Linguist with PySide6?



I have a python project written with PySide2 and now I want to migrate to PySide6. I used Qt Linguist to translate UI and created .ts files with help of this command:
pylupdate5 utility from PyQt5 package (but it worked fine for my project with PySide2). Now I plan to get rid of PySide2 and PyQt5 packages.

So, I need to replace pylupdate5 with something from PySide6 package. I assumed lupdate should to the job but it seems it works only with C++ code. It gives me errors like Unterminated C++ character or Unbalanced opening parenthesis in C++ code. An with lupdate -help I don’t see how I may switch it to python mode (similar to uic -g python).

Does anyone know how to create .ts files for Qt Linguist from python source files?

Answer

lupdate of Qt 6.1 does not support Python but in Qt 6.2 that problem no longer exists so you have 2 options:

  • Install Qt 6.2 and use its lupdate.
  • Wait for PySide6 6.2.0 to be released (at this moment it is only available for windows) and use lupdate.


Source: stackoverflow