[Zope-CMF] [dev] i18n improvements - a proposal

yuppie y.2005- at wcm-solutions.de
Tue Aug 9 13:11:00 EDT 2005


Hi!


Zope 2.8.1 with Five 1.1 and Zope 2.9 will come with integrated i18n 
support. Localizer / PTS are no longer needed.

CMF currently has limited i18n support and describes in INSTALL.txt how 
to use it with Localizer and TranslationService.


I propose the following changes on CMF trunk:


1.) Using zope.i18nmessageid.MessageIDFactory in Python code:

This allows to extract message strings with pygettext / zope3 tools and 
to set domain, mapping and default in Python code.

Each product will have a factory in utils.py that is used by Python code 
like this::

   from Products.CMFDefault.utils import CMFDefaultMessageID as _
   message = _('foo')


2.) Using different domains for different products:

While 'cmf_default' should be used by the core products (CMFCore, 
CMFDefault, CMFTopic, CMFSetup) I'd like to use 'cmf_calendar' for 
CMFCalendar.

This might cause some problems in the first place, but resolving these 
issues is necessary for third party add-ons.


3.) Adding a utility script for extracting i18n messages:

i18nextract.py is quite zope3 specific, but with some modifications it 
seems to work quite well for CMF. I'd like to add a modified 
i18nextract.py to the root of the CMF repository.

We could use that script to provide *.pot files in a CMFDefault/locale 
and CMFCalendar/locale.


4.) Adding i18n support for settings loaded from profiles:

This is the most difficult part and so far I just have some ideas.

One issue is extracting message strings. I hope to find a way to use the 
i18n namespace in profile XML files. This would allow to use the 
standard tools.

The other issue is handling some settings like 'Title' and 'Description' 
fields as MessageIDs. AFAICS a first step would be adding a 'domain' 
field to Actions and TypeInfos. Don't know if we can just use the old 
attributes and return MessageIDs instead of strings or if we need new 
attributes. This depends on possible backwards compatibility issues.


5.) Adding translations:

If someone wants to maintain one or more translations we could ship CMF 
with translations and enable the i18n machinery by default.


I'd like to work at least on the first 3 items for CMF 1.6. AFAICS this 
should not break anything on Zope 2.8.0. But maybe we should anyway make 
Zope 2.8.1 the required platform for CMF 1.6.

Any comments?


Cheers,

	Yuppie



More information about the Zope-CMF mailing list