v1.2.0 Summary Chapter 8: Plug-ins and UI translations 8. Introduction 8.3. Translating the user interface
No documentation was found matching the provided version! Browsing the latest one.

8.3. Translating the user interface

Translating pgModeler's user interface requires using three tools called lupdate, linguist, and lrelease, all of which are part of the Qt framework. The lupdate command will scan the pgModeler's source code directory, extracting the terms that can be translated and storing them in a file called dictionary. The linguist program is used to open the dictionaries generated by lupdate and provide the translation of the terms present in those files. Finally, we use the lrelease to generate a compiled version of the translated dictionaries to be interpreted by pgModeler at startup. A few steps must be executed in a specific order to achieve the correct result:

  1. Use the most recent pgModeler's source code. You can get it from the download page.

  2. Edit the file pgmodeler-intl.pro and add the name of your language file in the form [language]_[TERRITORY].ts. This format is similar to the locale information used by POSIX systems. The .pro file is used by the lupdate command to scan the source code directory and extract the translatable terms. Make sure to add the name of your language file in the variable TRANSLATIONS:

    TRANSLATIONS = lang/pt_BR.ts
                   lang/zh_CN.ts \
                   lang/fr_FR.ts \
                   lang/[language]_[TERRYTORY].ts
    
  3. Now we need to generate the dictionaries (.ts files) by running the command below. Once executed, you can check the folder lang, which will contain the .ts files for each language listed on the TRANSALATIONS variable in pgmodeler-intl.pro: lupdate -no-obsolete pgmodeler-intl.pro

  4. Once the dictionaries are generated, we need to open the desired file in the Qt Linguist application. To do so, run the command: linguist lang/[language]_[TERRYTORY].ts

  5. After opening the file on Qt Linguist, a dialog like the one below will be displayed. Now the hard work begins: you need to translate term by term based on the Source text field. The translated term must be entered on the [Language] translation field in the middle of the highlighted portion on the image below. Finally, you can provide optional comments on the last field. You can get detailed information about Qt Linguist usage on the Qt documentation.

  1. Finally, we can generate the compiled version of the translated dictionaries. For this task, there's a need to run the command lrelease so the output files will be named in the form [language]_[TERRYTORY].qs: lrelease pgmodeler-intl.pro

You can now test the generated dictionary for your native language by normally running pgModeler. If, for any reason, you notice that the translation is not being correctly loaded, you must check your system's current language configuration or manually change the language at pgModeler's general settings. Additional guidance and advanced information about the topics described in this chapter can be retrieved directly from the pgModeler's author via the available support channels.


May 6, 2025 at 08:10