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?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
It depends on the creator of the plugin. The localization is available:
i18n(short for internationalization) sub-directory in the plugins directory
trand it calls
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
fr.ts in the
i18n directory. It is an XML file, you had better to translate it using Qt5 Linguist for translation. Finally use
to create the
QGIS will use the language automatic, depending on the language settings of the OS or QGIS.