Hello everyone,
I am currently working on making the ParaView UI translatable. As such, this thread is meant to be a progress update and a forum for your advice!
Objectives
The scope of this internationalization is to make all translatable strings visible in the base ParaView UI, and let developers translate their plugins and make an easy-to-use community translation workflow. Translations will be made from an online crowd-translation CMS, but we have yet to decide which one to use.
Non-romance languages should, of course, be available, as I will use the most the tools Qt5 has to offer, from build-in method to translation manager utilities.
Debug messages and logs will not be translated for now.
String refactoring
I have done a long (and I hope exhaustive) refactoring of strings in the ParaView sources, framing every relevant string inside the tr() method so that Qt searches for a translation in the user language.
New string good practices
The new proposed good practices would be:
-
Strings to be translated should be translated at declaration ! There should not be any tr() around QString variables. Strings with .arg() are valid.
-
When inside a QObject-derived class that has the Q_OBJECT macro; literal strings should be placed inside the tr() static method.
-
Otherwise strings should be in the QCoreApplication::translate(), with the context argument being the containing class or the containing file if outside of any class.
Implementation progress and concerns
I have used the handy CMake macros of Qt to make Qt generate translation source files (.ts) from source files, subsequently compiling them into a single binary, which I made ParaView load and use.
I have not yet seriously looked into the translations of PV XML files. One solution would be to extract relevant strings using a utility, add them in a cpp header and then let Qt’s lupdate add them to translations.
It has not yet been determined if the translation will be directly included in the ParaView binary release.
Open questions:
I don’t know if we should use the machine locale to translate at PV startup or leave PV in English at first, and if we should have a rollout menu with available languages or ask users for a translation file with a File Dialog?
Should the .ts translation file be put inside ParaView source or in another repository (like Slicer does)?
And if they are outside of PV sources, should I create a CMAKE variable specifying the ts’ path?
I would love to have your opinions on it!
Conclusion
If you would like to get involved, you can check my string refactoring MR and my CMake translation file generation MR - combining both gives a mostly translatable UI!
For any questions or comments, feel free to reply!
Kind regards,
Nicolas