Recipe for overriding translations

3 messages Options
Embed this post
Permalink
Maurits van Rees-3

Recipe for overriding translations

Reply Threaded More More options
Print post
Permalink
Hi,

I created a buildout recipe for overriding translations:
http://pypi.python.org/pypi/collective.recipe.i18noverrides

It creates an i18n directory within one or more zope 2 instances in
your buildout.  It copies some .po files to those directories.  The
translations in those .po files will override any other translations.
This only works for overriding i18n directories, not for locales.

See that pypi page for details, but if your buildout.cfg has two zope
instances (two zeo clients most likely) the configuration can be
something like this:

[buildout]
parts = instance1 instance2 i18noverrides
...

[i18noverrides]
recipe = collective.recipe.i18noverrides
source = ${buildout:directory}/translations
destinations =
    ${instance1:location}
    ${instance2:location}

Create a translations directory in your buildout and put some po files
in it.  Run bin/buildout and the recipe will create an i18n directory
in each of the instances and copy those po files there.  Restart the
instances and those translations will be used.

--
Maurits van Rees | http://maurits.vanrees.org/
            Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Plone-i18n mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Vincent Fretin

Re: Recipe for overriding translations

Reply Threaded More More options
Print post
Permalink
Hi,

Really nice! Thanks!

I didn't aware you could add an i18n directory in a zope instance and
those po files have priority to the one in plone.app.locales/i18n.
It will simplify a lot my buildout. Yeah, currently I use a the
plone.recipe.command recipe to patch the original po from
plone.app.locales. And I have to do again the patch if the original po
file have changed to much.

So really, thanks for this recipe Maurits!

--
Vincent Fretin


On Mon, Jun 8, 2009 at 10:40 PM, Maurits van
Rees<[hidden email]> wrote:

> Hi,
>
> I created a buildout recipe for overriding translations:
> http://pypi.python.org/pypi/collective.recipe.i18noverrides
>
> It creates an i18n directory within one or more zope 2 instances in
> your buildout.  It copies some .po files to those directories.  The
> translations in those .po files will override any other translations.
> This only works for overriding i18n directories, not for locales.
>
> See that pypi page for details, but if your buildout.cfg has two zope
> instances (two zeo clients most likely) the configuration can be
> something like this:
>
> [buildout]
> parts = instance1 instance2 i18noverrides
> ...
>
> [i18noverrides]
> recipe = collective.recipe.i18noverrides
> source = ${buildout:directory}/translations
> destinations =
>    ${instance1:location}
>    ${instance2:location}
>
> Create a translations directory in your buildout and put some po files
> in it.  Run bin/buildout and the recipe will create an i18n directory
> in each of the instances and copy those po files there.  Restart the
> instances and those translations will be used.
>
> --
> Maurits van Rees | http://maurits.vanrees.org/
>            Work | http://zestsoftware.nl/
> "This is your day, don't let them take it away." [Barlow Girl]
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Plone-i18n mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-i18n
>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Plone-i18n mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Hanno Schlichting-4

Re: Recipe for overriding translations

Reply Threaded More More options
Print post
Permalink
The i18n folder in an instance home is a feature of PlacelessTranslationService.

If you want to achieve the same for locales folders, you need to make
sure your package which includes the priority translations is loaded
first via zcml.

So something like:

[instance]
recipe = ...
zcml = my.package Plone

Having multiple translation files for the same domain only works in
Plone 3.3, though. Before the first file that is found for a domain
will be the only one taken into account. Since Plone 3.3 multiple
files can extend each other, but the first message found for a msgid
will take precedence.

Hanno

On Tue, Jun 9, 2009 at 2:06 PM, Vincent Fretin<[hidden email]> wrote:

> Hi,
>
> Really nice! Thanks!
>
> I didn't aware you could add an i18n directory in a zope instance and
> those po files have priority to the one in plone.app.locales/i18n.
> It will simplify a lot my buildout. Yeah, currently I use a the
> plone.recipe.command recipe to patch the original po from
> plone.app.locales. And I have to do again the patch if the original po
> file have changed to much.
>
> So really, thanks for this recipe Maurits!
>
> --
> Vincent Fretin
>
>
> On Mon, Jun 8, 2009 at 10:40 PM, Maurits van
> Rees<[hidden email]> wrote:
>> Hi,
>>
>> I created a buildout recipe for overriding translations:
>> http://pypi.python.org/pypi/collective.recipe.i18noverrides
>>
>> It creates an i18n directory within one or more zope 2 instances in
>> your buildout.  It copies some .po files to those directories.  The
>> translations in those .po files will override any other translations.
>> This only works for overriding i18n directories, not for locales.
>>
>> See that pypi page for details, but if your buildout.cfg has two zope
>> instances (two zeo clients most likely) the configuration can be
>> something like this:
>>
>> [buildout]
>> parts = instance1 instance2 i18noverrides
>> ...
>>
>> [i18noverrides]
>> recipe = collective.recipe.i18noverrides
>> source = ${buildout:directory}/translations
>> destinations =
>>    ${instance1:location}
>>    ${instance2:location}
>>
>> Create a translations directory in your buildout and put some po files
>> in it.  Run bin/buildout and the recipe will create an i18n directory
>> in each of the instances and copy those po files there.  Restart the
>> instances and those translations will be used.
>>
>> --
>> Maurits van Rees | http://maurits.vanrees.org/
>>            Work | http://zestsoftware.nl/
>> "This is your day, don't let them take it away." [Barlow Girl]
>>
>>
>> ------------------------------------------------------------------------------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables unlimited
>> royalty-free distribution of the report engine for externally facing
>> server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> Plone-i18n mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/plone-i18n
>>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Plone-i18n mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-i18n
>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Plone-i18n mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-i18n