ParaView translation system, upcoming workflow and best practices

ParaView now provides a translation system that lets the community translate ParaView’s UI, and then use these translations in ParaView and its derived applications. For now, no complete translations are shipped, as the translation tool is not online yet/has only been online for a few days. This blog presents the translation system itself and is intended for ParaView developers and advanced users willing to try out the new translation system.

Switching language in ParaView

The ParaView interface language can be changed within the Interface language section of the general settings. A restart is required to take effect.

Additionally, if you either want to add new locations for ParaView to search for translation binaries or force the client language, new environment variables have been introduced for these features, PV_TRANSLATIONS_DIR and PV_TRANSLATIONS_LOCALE respectively.

ParaView translations repository

A brand new translation repository can be found at this address. Every translation file is located within a subfolder with its language locale name (en_US being the template folder). This repository is designed to be managed by bots and an upcoming Kitware instance of Weblate, an online translation tool.

It contains translations source files (.ts) created from the sources of ParaView with a Qt utility parsing the code. Translation source files must then be compiled into translation binaries (.qm) in order to be loaded by ParaView. 

This translation repository has been integrated in the ParaView-Superbuild in order to provide these translation binaries in all ParaView releases and nightlies..

Translation workflow

The translation files creation is made of three steps: generating the translation source files from ParaView sources (with the ParaView build system), filling them with translations (within Weblate) and finally compiling them into resource files (by the superbuild) in order to be loaded into ParaView.

The translation workflow for ParaView releases is the following:

  • ParaView translation source files are built by the ParaView CI, and a job is dedicated to keep these .ts files as artifacts.
  • A bot recovers these .ts files and rebases the template files in paraview-translations with these files in order to add new source strings to translate to it.
  • Weblate pulls the changes from paraview-translations and adds the new strings in its database, making them available for translators.
  • Translators suggest translations for source strings.
  • Reviewers approve or reject suggestions.
  • Weblate pushes the translations into the paraview-translations repository.
  • The Superbuild pulls the translations, compiles them into translations binaries and ships them with ParaView releases and nightlies.

As for Weblate, you will be able to create a new account and begin translating ParaView right away, once the instance for ParaView is created. You can already test its interface with the 3D Slicer project.

Developer notes

Nearly every string within the ParaView client should be translatable, except for proper names, numbers, etc. Detailed guidelines about how to write strings for the UI are detailed in the doxygen documentation. There are different guidelines depending on the code context and additional information regarding  proxy XMLs.

A test in the CI enforces these guidelines: the main window is tested by the plugin TranslationTesting. You can test it yourself locally through pv.LoadTranslationsTestingPlugin test.

If a string in the code should not be translatable, the plugin has two ignore lists in its header: TRANSLATION_IGNORE_STRINGS and TRANSLATION_IGNORE_REGEXES.

The language selection in the general settings is handled by the pqLanguageChooserWidget class.

This work was funded by an internal innovative effort of Kitware Europe.

Leave a Reply