[Qgis-developer] plugin translation
Richard Duivenvoorde
rdmailings at duif.net
Sun Mar 20 11:47:34 PDT 2016
On 20-03-16 18:21, matteo wrote:
> Hi all (again),
> as I'm continue to working on the translation of the plugin I've find
> out a little problem.
>
> All the DIALOG windows of the plugin are translatable (and I can easily
> do that with Qt Linguist) but all the plugin MENUS (and submenus) don't
> appear to be in the my_plugin_it.ts file.
>
> All this "voices" are in the my_plugin.py file (so the main plugin file)
> under the *initGui* function, for example:
>
>
> self.actionProgramLocations = QAction( "&Program &Locations",
> self.iface.mainWindow())
>
> even if in the my_plugin.pro file within the i18n directory I specified
> that the main file should be included: (that's my pro file):
>
> FORMS = ../ui/*
>
> SOURCES = ../my_plugin.py
>
> TRANSLATIONS = my_plugin_it.ts
>
>
> Am I missing something? Or should I specify more details in the .pro file?
Hi Matteo,
does your plugin have something as a helper function like this one
(created by the plugin builder):
https://github.com/rduivenvoorde/sectorplot/blob/master/SectorPlot/sectorplot.py#L174
This is the 'magic' that makes it know to Qt that a certain string is to
be translated, see for example:
https://github.com/rduivenvoorde/sectorplot/blob/master/SectorPlot/sectorplot.py#L275
Without this your ts file will only contain the strings from your ui
files I think.
Hope this helps.
Regards,
Richard Duivenvoorde
More information about the Qgis-developer
mailing list