Tryton - Issues

 

Issue6277

Title Translate selection values computed with methods
Priority feature Status invalid
Superseder Nosy List ced, pokoli, yangoon
Type feature request Components trytond
Assigned To Keywords
Reviews

Created on 2017-02-16.12:49:53 by pokoli, last changed by ced.

Messages
msg31991 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-02-17.10:15:06
On 2017-02-17 09:58, Sergi Almacellas Abellana wrote:
> 
> But issue3672 is for error messages, which is not the same as selection values. 

Why? It is for any translated string.

> I think this can be solved by adding a new attribute (i.e: translate_values) on the selection fields which will return the values to translate. 
> 
> This attribute will accept the following values:
> 
> * None (default value)
> * a list of couples
> 
> If the value is None it will return the values of the selection field. If the selection field is a method it will be called (with an empty record in case of instanc emethod). In case this does not return all the translations, they can be manually specified by using a list of couples. 

Too much complex.

> On a first thought, I added a third option which is a method to return all the translation values but I think this is not necessary as all the possible options must be know in advance in order to translate them.

This is too constraint full to have to know all options in advance.
msg31988 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-02-17.09:58:43
But issue3672 is for error messages, which is not the same as selection values. 

I think this can be solved by adding a new attribute (i.e: translate_values) on the selection fields which will return the values to translate. 

This attribute will accept the following values:

* None (default value)
* a list of couples

If the value is None it will return the values of the selection field. If the selection field is a method it will be called (with an empty record in case of instanc emethod). In case this does not return all the translations, they can be manually specified by using a list of couples. 

On a first thought, I added a third option which is a method to return all the translation values but I think this is not necessary as all the possible options must be know in advance in order to translate them.
msg31976 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-02-16.13:27:27
I do not agree, if a selection is a function there is no way to ensure to receive the full list of options. So the general translation process can not do that job.
It is the responsibility of the selection method to provide translated strings.
But for issue2356, I think the best way to ease the creation of dynamic selection but translated will be by implementing issue3672
msg31974 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-02-16.12:49:53
Currently only the selection values computed with a list are translated [1], but as seen issue2356 there are some cases which is interesting to restrict the values depending on other fields. 

In order to retrieve all the possible translations we should call the method with and empty record (if instance method) in order to retrieve all the possible translations. 


[1] http://hg.tryton.org/trytond/file/287383ca412e/trytond/ir/translation.py#l269
[2]
History
Date User Action Args
2017-02-17 10:15:06cedsetstatus: chatting -> invalid
messages: + msg31991
2017-02-17 10:04:28yangoonsetnosy: + yangoon
2017-02-17 09:58:43pokolisetstatus: invalid -> chatting
messages: + msg31988
2017-02-16 16:35:52cedsetstatus: chatting -> invalid
2017-02-16 13:27:27cedsetstatus: unread -> chatting
nosy: + ced
messages: + msg31976
2017-02-16 12:49:53pokolicreate

Showing 10 items. Show all history (warning: this could be VERY long)