Hi devs,

 

For do the plugin translations I use

 

1) Linguist from QT5

2) The command line: 

    Pylupdate4 -noobsolete PluginName.pro (Is there a new version 5??)

3) and the classical code:

 

        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'PluginName_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':

                QCoreApplication.installTranslator(self.translator)

 

        def tr(self, message):

            return QCoreApplication.translate(QWaterPlugin.SETTINGS, message)

 

 

The problem is that the option to use self.tr('message string') is not working. 
It only works when I use QCoreApplication.translate('Escope', 'message string') 
even if a tr function defined.

 

It used to work with linguist from QT4.

 

What  Am I doing wrong? BTW Is there a new better way to translate plugins?

 

Another thing, every time I update the translations strings with Pylupdate4, I 
have to translate all my plugin forms again even without any changes, any 
help???

 

Thanks,

 

Jorge Almerio

 

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to