[Qgis-developer] [Processing] translate parameter selection dropdown contents
Arnaud Morvan
arnaud.morvan at camptocamp.com
Wed Aug 26 05:50:01 PDT 2015
Hello,
In processing algorithms, I want to translate the ParameterSelection
dropdown contents.
I've tested two possibilities on SpatialJoin, which both operate,
and I want to get review before editing all algorithms :
First solution: use of QCoreApplication.translate('SpatialJoin', ...) in
the class header:
https://github.com/arnaud-morvan/QGIS/commit/0daefe838c2b02c8a1bbeffdec551f578424b592
With this form we have to specify context for each string.
Translation is effectively made at import time because language is
set before loading processing plugin.
Second solution: use self.tr method in the defineCharacteristics method :
https://github.com/arnaud-morvan/QGIS/commit/0286c3d95dffeee65ff7a6b7a69919d700815e4b
With this form, we use the self.tr method at runtime on each
defineCharacteristics call, like it is the case for name, group and
parameters names.
I think that it is better to make translations at runtime, that is, in
the defineCharacteristics method.
Does anyone have an opinion on this ?
Arnaud
More information about the Qgis-developer
mailing list