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

Philipp von Weitershausen philipp at weitershausen.de
Mon Aug 18 12:39:00 EDT 2003


Fred L. Drake, Jr. wrote:
> Philipp von Weitershausen writes:
>  > It is an issue nonetheless. The reason why I brought this up instead of 
>  > supporting _("message id", "default text"), like you suggested, right 
>  > away, was, that Stephan told me he felt strongly about using domains. I 
> 
> I'm not sure that using domains for the part-of-speech problem is the
> right way to go, but I'm no I18N expert and am willing to bow to the
> experience of others.
> 
> I think the part-of-speech problem certainly is easier to deal with if
> _() and the tools are extended for easier use of default text:
> 
>     ------------------------------------------------
>     _("View [as a noun]", "View")
>     _("View [as a verb]", "View")
>     ------------------------------------------------
> 

...

>> We could change extract.py to write the default text into the POT 
>> as a coment. That way we could use explicit message ids even for 
>> more complicated phrases without making it too complicated for the 
>> translator.
> 
> +1
> 
> That would certainly improve life for the translator.

I personally actually tend to prefer having explicit message ids like 
view_permission, adapter_component etc. wherever possible. The change 
would only affect MessageIDFactory and extract.py. The source code 
itself could be migrated step by step.

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" />

That would only require a change in zope.configuration.fields.MessageID

>  > have given that some thought and it appears to me as a very obvious 
>  > solution, yet the extraction tools, for example, will hardly be able to 
>  > figure out what domain we're using in a certain python module.
> 
> Perhaps I don't understand the problem with this:
> 
>     ------------------------------------------------
>     from zope.i18n.messageid import MessageIDFactory
> 
>     _d1 = MessageIDFactory("domain-1")
>     _d2 = MessageIDFactory("domain-2")
>     ------------------------------------------------

Would the tool then be so smart to figure out that

  _d1('some text')

means 'some text' needs to be translated in "domain-1"?

>  > BTW, the Plone project for example uses distinct message IDs all over 
>  > the place. I've found that to be quite a clear approach. Maybe we should 
>  > adopt that rule for at least the most common phrases like components and 
>  > permissions.
> 
> I presume this is still within a single domain, so the ids are things
> like "view-permission".  Is that right?

Correct. Actually, the convention is to use underscores, so it would be 
view_permission, add_folder_permission etc.

Philipp




More information about the Zope3-dev mailing list