[Qgis-developer] Fwd: Re: Processing algorithm's groups and names translation.

Alexander Bruy alexander.bruy at gmail.com
Thu Jul 16 04:12:11 PDT 2015


Hi all,

this topic was raised previously and problem is a bit more complex
then just using self.tr() for algorithm name and group. Such approach
will work only for very limited amount of algorithms with pure-Python
implementation.

But what to do with algorithms, defined via description files? In this
case algorithm name and group written in description files and use
English. Seems we need something more advanced then just
overriding getCommandLineName().


2015-07-15 17:54 GMT+03:00 Victor Olaya <volayaf at gmail.com>:
> No need to do that
>
> There is a name property for algorithms (used by the toolbox, not the
> cmd line), and then there is the getCommandLineName() method, (which
> is used by the command line). The problem here is that, by default,
> the getCommandLineName method returns a name that is derived from the
> alg name. It is easy to fix that, just override that method for all
> algorithms. The problem is that "all" algorithms means hundreds of
> them...
>
> It's something that should have been done from the beginning, but I
> just assumed that it was a good idea to rely on the base
> implementation which uses the human-readable name for the cmd line
> name, so there was no need to implement that method ofr every
> algorithm, saving some work. Lazy me...
>
> So, in short, the code actually supports what you propose...but
> algorithms do not use it,
>
> Let me know if you have questions
>
> 2015-07-15 16:01 GMT+02:00 Arnaud Morvan <arnaud.morvan at camptocamp.com>:
>>
>> Thanks for your reponse,
>>
>> This is functionnal but seems difficult to maintain.
>> How to verify that every algorithm is translated in each language ?
>>
>> Why don't add in each algorithm a "title" property
>>
>>     self.name = '...'             # used by command line
>>     self.title = self.tr('...')     # used by toolbox
>>
>> eventually with a fallback on self.name for compatibility with
>> algorithms from external plugins.
>> Like this we could use the normal workflow with transifex.
>>
>> Does the groups have another use than toobox item text ? can we replace :
>>     self.group = '...'
>> by
>>     self.group = self.tr('...')
>>
>> Arnaud
>>
>> Le 15/07/2015 12:26, Victor Olaya a écrit :
>>>
>>> Arnaud
>>>
>>> I added a mechanism for defining alternative names for algorithms.
>>> This allows to provide more informative names than the original ones,
>>> without having to break the cmd interface.
>>>
>>> The name replacements are stored in this file:
>>>
>>>
>>> https://github.com/qgis/QGIS/blob/master/python/plugins/processing/gui/algnames.txt
>>>
>>> If the algorithm is listed there, the alternative name is use.
>>> Otherwise, the original name is used.
>>>
>>> Maybe we could have several files like that (algnames_fr.txt,
>>> algnames_es.txt, etc), and just use the one corresponding to the
>>> current language. That would be a very easy solution to implement and
>>> very practical for all translators. It's differnet from how
>>> translation is done now, but I think it will be better for Processing,
>>> to be able to rename algorithms without changing their commandline
>>> name
>>>
>>> Let me know what you think about this
>>>
>>> Cheers
>>>
>>>
>>>
>>> 2015-07-15 11:16 GMT+02:00 Arnaud Morvan <arnaud.morvan at camptocamp.com>:
>>>>
>>>> Hi,
>>>>
>>>> In processing algorithms, parameters names are translatable (and
>>>> completely
>>>> translated in french),
>>>> but algorithm names and groups couldn't be translated because processing
>>>> commandline interface use them in english.
>>>> On the other side, it would be good for users to get algorithm names
>>>> translated inside toolbox.
>>>>
>>>> Has someone begin to work on this or an idea about how to get names
>>>> translated inside toolbox.
>>>>
>>>> Maybe we could help on this ?
>>>>
>>>> Best regards
>>>>
>>>> Arnaud
>>>> _______________________________________________
>>>> Qgis-developer mailing list
>>>> Qgis-developer at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>>
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
Alexander Bruy


More information about the Qgis-developer mailing list