[Zope3-dev] Re: i18n domains vs. unique message ids -OR- whyShakespearean English was better

Philipp von Weitershausen philipp at weitershausen.de
Mon Aug 18 13:56:56 EDT 2003


Shane Hathaway wrote:
> Fred L. Drake, Jr. wrote:
> 
>> Philipp von Weitershausen writes:
>>  > It would have to be solved for ZCML, though. Where do we specify 
>> the  > 'view_permission' message id in the statement::
>>  >  >    <permission id="zope.View" title="View" /> ?
>>  >  > Maybe::
>>  >  >    <permission id="zope.View" title="[view_permission] View" />
>>
>> This seems reasonable to me.  The only possible issue would be using
>> the implied message id for something where the default text looks like
>> that; I'll propose that:
>>
>>     <permission id="zope.View" title="[] [View] more text" />

BTW, Stephan Richter came up with::

   <permission id="zope.View" title="[[View]] more text" />

for escaping [].

We've also thought about some other character that wouldn't require 
escaping twice::

   <permission id="zope.View" title="%view_permission% View" />

and escaped::

   <permission id="zope.View" title="%%View% more text" />

> Why not write it this way?
> 
>   <permission id="zope.View" msgid="view_permission" title="View" />

What if there is more than just the 'title' attribute that is to be 
translated? Also, attributes in ZCML elements are defined through a 
schema. The schema fields handle the conversion. So when you say 
<browser:editform schema="somemodule.myinterface" />, the GlobalObject 
field, which is used for the 'schema' attribute, will resolve that 
string and return it.
All lookup functionality is contained in the field. No change would have 
to be done to the configuration machinery, the MessageID field would 
simply know how to parse something like "[View]

> Then again, maybe permission IDs should also be message IDs.

No, it's an ID. Ideally, it will not appear to the user in the UI.

Martijn Faassen and Godefroid Chapelle are currently arguing on IRC, 
that an XML namespace like i18n (as known in ZPTs) should be used.

   <permission id="zope.View" i18n:attributes="title" title="View" />

Stephan Richter and I basically vote against this as

1.) Namespaces have a different meaning in ZCML than in ZPT. In ZPT, 
they 'hide' tal, metal and i18n commands from the xhtml namespace and 
they are meant to be used as attributes. In ZCML, we use namespaces to 
indicate different configuration domains, like 'zope', 'browser', 
'meta', etc.

2.) Supporting this ZPT-like i18n namespace in ZCML would require 
extensive changes to the ZCML XML machinery. One could argue that it 
doesn't belong there. As stated above, schema fields contain all the 
logic that is necessary to resolve the data provided in the XML 
attribute. They are self-contained, so to speak.

3.) Not every attribute would be allowed to be translated. In the above 
example, the 'id' attribute would not be allowed, because it's a global 
identifier. How would ZCML know that? Maybe only allow MessageID fields 
to be translated? Well, why not put that funcationally into the 
MessageID field in the first place...?

What are your opinions on this?

Philipp




More information about the Zope3-dev mailing list