plone domain translations in add-ons for Plone 3 and 4
Maurits van Rees <m.van.rees-1kr/[email protected]> Fri, 18 Nov 2011 13:01:58 +0100
| Newsgroups | gmane.comp.web.zope.plone.internationalization |
|---|---|
| Organization | Zest Software |
| Message-ID | <[email protected]> |
Hi,
Say you have created an add-on that has a few extra translations for the
plone domain.
If this add-on only targets Plone 3 you should add the translations to
the i18n directory.
If this add-on only targets Plone 4 you should add the translations to
the locales directory.
See my blog about that from last year:
http://maurits.vanrees.org/weblog/archive/2010/10/i18n-plone-4#extra-translations-for-an-existing-domain
But what should an add-on author do when he wants to support both Plone
3 and Plone 4 in the same code base? My blog points to some dangers there.
One option that works is to use the i18n directory and to conditionally
register translations from the plonelocales directory when on Plone 4,
like this:
<i18n:registerTranslations directory="plonelocales"
xmlns:zcml="http://namespaces.zope.org/zcml"
zcml:condition="have plone-4" />
See the example in this revision of collective.sortmyfolder:
http://dev.plone.org/browser/collective/collective.sortmyfolder/trunk/collective/sortmyfolder?rev=246304
Note that I removed it later because the plone domain was ultimately not
needed in this package. And note that in this case we have a normal
locales directory with translations for our own domain and this should
*always* be registered, so we cannot add the plone domain translations
there.
An obvious downside to this approach is that plone domain translations
are then done in two spots. Dutch plone translations would be both in
i18n/collective.sortmyfolder-plone-nl.po and
plonelocales/nl/LC_MESSAGES/plone.po. Picking one of those as the
master and copying that to the other location works fine, as long as the
plone specific headers are set in the po file, which i18ndude takes care of.
Another option is of course to drop support for Plone 3 in that add-on
and stick to the (plone)locales solution. If wanted you can add a note
that it still works on Plone 3 except that it misses a few translations.
Are there other options out there?
BTW, I am considering the first approach for Products.PloneGlossary. If
you care about your language in that package you should already take a
look at trunk and update your po files (plone domain and ploneglossary
domain), as I have cleaned things up two days ago.
--
Maurits van Rees http://maurits.vanrees.org/
Web App Programmer at Zest Software: http://zestsoftware.nl
"Logical thinking shows conclusively that logical thinking
is inconclusive." - My summary of Gödel, Escher, Bach
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d