Adding translations
If you followed our recommendations and used the English language for all captions in the plugin GUI, and in all strings in the code, almost all users will be able to use your plugin. Moreover, as we have made all strings translatable by enclosing them in self.tr()
calls, it is very easy to translate our plugin into another language.
To do this, we need to prepare a so-called project file. This is a plain text file with a very simple structure. Create a new file and save it as selectradius.pro
in the plugin root directory. Then, add the following content to it:
( 1) SOURCES = __init__.py \ ( 2) selectradius_plugin.py \ ( 3) gui/selectradiusdialog.py \ ( 4) gui/aboutdialog.py \ ( 5) ( 6) FORMS = ui/selectradiusdialogbase.ui \ ( 7) ui/aboutdialogbase.ui ( 8) ( 9) TRANSLATIONS = i18n/selectradius_uk.ts \ (10) i18n/selectradius_de.ts
As you can see, there is a list of all plugin source files from all subdirectories (lines 1
to...