From: Vincent F. <vin...@gm...> - 2011-11-18 14:29:28
|
Hi, I thought that translations in i18n folder worked on both Plone 3 and 4, is it not the case? In Plone 4, the po files in the the i18n directory are loaded with the same engine as po files in the locales folder, right? It should merge translations if there is several po files with the same domain. If not, I think it's a bug. Vincent On Fri, Nov 18, 2011 at 1:01 PM, Maurits van Rees < m.v...@ze...> wrote: > 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 > _______________________________________________ > Plone-i18n mailing list > Plo...@li... > https://lists.sourceforge.net/lists/listinfo/plone-i18n > |