I build a plugin with PyQGIS.

If the user changes the language of QGIS interface then automatically my Plugin dialog and messages need to change that particular language (we just looking into French only).

Is it possible? If yes, how?

1 Answer 1


It depends on the creator of the plugin. The localization is available:

  1. If there is an i18n (short for internationalization) sub-directory in the plugins directory
  2. All messages in the plugin are used inside a translator function (if plugin builder is used it is called tr and it calls QCoreApplication.translate.

If you create your own plugin, use the Plugin builder and check localization in the wizard.

To add a new language to the plugin you have to create a new language file (e-g- fr.ts). Plugin builder contains helper scripts to create the new language file, before you have to add your language to the Makefile LOCALES variable.


Then use on Linux

make transup

To update/create fr.ts in the i18n directory. It is an XML file, you had better to translate it using Qt5 Linguist for translation. Finally use

make transcomp

to create the fr.qm.

QGIS will use the language automatic, depending on the language settings of the OS or QGIS.

  • make transup and make transcomp commends need to run on Linux is there way to run on windows? Commented Jan 13, 2021 at 8:29
  • 1
    I have no experiences in this topic on Windows. I suppose you can use pylupdate5 from the command line. It is part of Qt5. Check update-strings.sh
    – Zoltan
    Commented Jan 13, 2021 at 11:15
  • 1
    pylupdate5 -noobsolete a.py b.py -ts i18n/fr.ts
    – Zoltan
    Commented Jan 13, 2021 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.