Using pyside2-lupdate to update strings in .ts file
-
Hi, I have a .ts file where I have made the translations of my program to English. The strings of my program are written in Spanish and I generated a first version .ts file in UTF-8 to translate all the strings to English through Qt Linguist.
I have added new strings to the program and I would like to add them to the .ts file without overwriting the existing translations. I have run the same command again on the file that already has translations and this time the UTF8 characters are not being added correctly (they are added as symbols). On the other hand if I recreate the file from 0 there is no problem but I lose all the translations I already had.The command I am using is
pyside2-lupdate project.pro
The content of project. pro file is:
CODECFORTR = UTF-8 SOURCES = VRConfigurator/__init__.py TRANSLATIONS = VRConfigurator/translations/en_GB.ts
-
@JesusM97 is there any constraint on the version?
pyside2-lupdate
was a bit outdated back in the day, and it was a python adaptation oflupdate
. I remember many bug reports on it, so if you are free to use a newer version, please usePySide6
, we includepyside6-lupdate
which is the same C++lupdate
tool with some extra options to use Python with it. For sure less buggy, and more up-to-date.With that being said, we have a short tutorial on the i18n topic in https://doc.qt.io/qtforpython-6/tutorials/basictutorial/translations.html I hope it's useful.
-
@CristianMaureira I'll make a backup of the project and try to update it to PySide-6 to see if it doesn't give me too many problems.
It's a fairly advanced project that I started with PySide2 just because almost all the tutorials I found were for that version. If I succeed, I'll try again to make the translation and I'll comment if I get the same error. -
-
@CristianMaureira I have updated the whole application to PySide6 and now it generates well the .ts file with UTF8 encoding and updating correctly the text strings.
Thank you very much!