[Zope3-dev] Re: translate() default value

Philipp von Weitershausen philipp at weitershausen.de
Tue Jul 26 09:24:00 EDT 2005


Dmitry Vasiliev wrote:
> Philipp von Weitershausen wrote:
> 
>> Dmitry Vasiliev wrote:
>>
>>> Philipp von Weitershausen wrote:
>>>
>>>> Dmitry Vasiliev wrote:
>>>>
>>>>> Hi Everyone,
>>>>>
>>>>> In the most cases users of the translate() expect untranslated 
>>>>> string will be returned if no translation is performed. See for 
>>>>> example Issue #298 (http://www.zope.org/Collectors/Zope3-dev/298).
>>>>> Is this reasonable to change the translate() to return untranslated 
>>>>> string by default instead of None?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> I think so. I also don't agree with myself anymore regarding the 
>>>> fixing of issue 298; your proposal sounds a lot better.
>>>>
>>>> So, +1 to the change. The question remains what to do on X3.0 
>>>> branch. Changing the semantics of zope.i18n.translate could already 
>>>> jeopardize backward compatability between X3.0 and 3.1; such a 
>>>> change between X3.0.0 and X3.0.1 could be even be worse...
>>>>
>>>> Thoughts?
>>>
>>>
>>>
>>>
>>> The simplest solution is to change all translate(text) calls to 
>>> translate(text, default=text).
>>
>>
>>
>> Ah, when I wrote my original mail I thought of this solution but 
>> scrapped it because I didn't think it would work (e.g. think of 
>> explicit message ids). By looking at the code of zope.i18n.translate 
>> now and a quick test on the interpreter prompt, I think that it'll be 
>> appropriate.
>>
>>> I think we need to do it for 3.1 also.
>>
>>
>>
>> Well, I dunno... I think changing the behaviour of zope.i18n.translate 
>> regarding the default argument should be enough. Explicit defaults 
>> where they're not needed are dead chickens. We need the dead chickens 
>> for X3.0 but why introduce them for 3.1 as well?
> 
> 
> Hmm... You're right. Then I'll fix issue #298 both on the trunk and on 
> the branch.

Great! Thank you.

Philipp



More information about the Zope3-dev mailing list