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

Shane Hathaway shane at zope.com
Mon Aug 18 16:47:12 EDT 2003


Philipp von Weitershausen wrote:
> Shane Hathaway wrote:
> 
>> Philipp von Weitershausen wrote:
>>
>>> What if there is more than just the 'title' attribute that is to be 
>>> translated?
>>
>>
>>
>> Well, that would be quite a surprise to me.  In my universe, 
>> permissions are so simple that only the 'title' attribute will be 
>> presented to the user.  Developers might want to see the raw 
>> permission ID sometimes.
> 
> 
> I'm not talking about this example specifically. There are quite a few 
> directives that have more than one attribute translated. For example::
> 
>   <browser:editform
>       schema="some.schema"
>       name="edit"
>       label="This form label shall be translated"
>       menu="some_menu_id"
>       title="This menu title shall be translated"
>       />

Ok, I see what you mean.

I might want to write the above directive this way:

  <browser:editform name="edit">
    <schema src="some.schema"/>
    <label msgid="my-form-msg-id" text="Default form label"/>
    <menu id="menu_id" msgid="my-menu-msg-id" text="Default menu title"/>
  </browser:editform>

This introduces the following rules:

- Every i18n-aware string in ZCML files should be contained in an 
attribute called "text".  All message IDs should be in an attribute 
called "msgid".  This makes it easy to write a tool that scans for 
translatable strings in ZCML.

- If there are multiple attributes that need to be translated, that's a 
strong indicator that you actually need to use child elements instead of 
attributes.  Consider attributes to be shortcuts for child elements.

Incidentally, another rule I'm introducing is that all Python dotted 
names should use the same XML attribute, "src".  This will make it 
easier to recognize and find dotted names.

In general, I want ZCML to be more modular.  I don't know how well the 
current ZCML machinery would support this, but I'd rather ignore 
implementation issues for now.

Shane




More information about the Zope3-dev mailing list