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?
It depends on the creator of the plugin. The localization is available:
i18n
(short for internationalization) sub-directory in the plugins directorytr
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.
LOCALES = fr
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