[Qgis-developer] Fwd: Re: Processing algorithm's groups and names translation.
Arnaud Morvan
arnaud.morvan at camptocamp.com
Thu Jul 16 05:56:33 PDT 2015
If we make files algnames_<locale>.txt
=> translators would have to make pull request for each language to
translate the name of a new algorithms.
=> It should be difficult to identify not translated names, to update
text files.
Like alex says: self.tr() method is only applicable to pure-python
algorithms
So my proposition is to create a python script that generate a temporary
python file which calls translate() with all names and groups (iterating
over providers and algorithms).
This file could be parsed normally by pylupdate
And we could call translate at runtime to get displayNames for the toolbox
External plugins algorithms will be added to translations (depending on
plugins installed when running update_ts.sh), but this not seems to be
blocker.
With simplified interface definition file: algclassification.txt
algorithms not present in this text file do not display in simplified
interface
if we made one text file for each language, this would cause simplified
interface to display different algorithms for each language.
This text file can eventually be translated in python to be parsed by
pylupdate
Arnaud Morvan
Ingénieur logiciel
Tél: +33 (0)4 58 48 20 32
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com
Le 16/07/2015 13:12, Alexander Bruy a écrit :
> 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
>
>
More information about the Qgis-developer
mailing list