You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nathaniel Grove <nd...@virginia.edu> on 2011/08/11 15:18:48 UTC

Location of I18N catalogs

I am new to using the Cocoon I18N feature and have only worked off the 
example given in samples/i18n. The way I have it set up is that the 
catalogs are in their own /translations/ folder at the top level of the 
project. The location is then set in the map:transformer element for i18n:

<catalogues default="messages">
<catalogue id="messages" name="messages" location="translations"/>
</catalogues>

I was wondering if it is possible to get the i18n catalogs from a 
location outside of Cocoon, such as a database via a PHP script that 
formats it into the proper XML. I tried setting the location to a cocoon 
relative pipeline "cocoon:/..." that read in an outside XML file but 
this didn't work. Is it possible to do something like this?

Thanks,

Than G.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Location of I18N catalogs

Posted by Andy Stevens <in...@googlemail.com>.
Hi,

Apologi
On 11 Aug 2011 22:33, "Nathaniel Grove" <nd...@virginia.edu> wrote:
> Yes, I'm using Cocoon 2.1.11 and I've gotten the basic I18N mechanism to
> work, but I'm confused how to go about getting the translations from
> outside of cocoon. I tried putting a URL in the location attribute as
> well as a Cocoon relative pipeline call, but neither worked. Do you have
> a code snippet you could share that shows how you did it?
>
> Thanks,
>
> Than
>
> On 8/11/2011 9:40 AM, Andy Stevens wrote:
>>
>> What version of cocoon?
>> It's certainly possible, as I've done it myself in the past, although
>> I think that was with version 2.1.something. Can't remember if it was
>> configured on the components setup or the transformer tag in the
>> pipeline, though.
>> One thing to beware of is the catalog is only read once and cached, so
>> if you're generating the catalog xml from a database that is updated
>> you may need to restart the app subsequently. That or adapt the code
>> to allow it to be refreshed periodically.
>>
>> Andy.
>> --
>>
>> On 11 Aug 2011 14:19, "Nathaniel Grove" <ndg8f@virginia.edu
>> <ma...@virginia.edu>> wrote:
>> > I am new to using the Cocoon I18N feature and have only worked off the
>> > example given in samples/i18n. The way I have it set up is that the
>> > catalogs are in their own /translations/ folder at the top level of the
>> > project. The location is then set in the map:transformer element for
>> i18n:
>> >
>> > <catalogues default="messages">
>> > <catalogue id="messages" name="messages" location="translations"/>
>> > </catalogues>
>> >
>> > I was wondering if it is possible to get the i18n catalogs from a
>> > location outside of Cocoon, such as a database via a PHP script that
>> > formats it into the proper XML. I tried setting the location to a
>> cocoon
>> > relative pipeline "cocoon:/..." that read in an outside XML file but
>> > this didn't work. Is it possible to do something like this?
>> >
>> > Thanks,
>> >
>> > Than G.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> <ma...@cocoon.apache.org>
>> > For additional commands, e-mail: users-help@cocoon.apache.org
>> <ma...@cocoon.apache.org>
>> >
>
> --
> Nathaniel Grove
> Research Associate & Technical Director
> Tibetan & Himalayan Library
> གངས་ལྗོངས་གློག་རྡུལ་དཔེ་མཛོད་ཁང་།
> http://www.thlib.org

Re: Location of I18N catalogs

Posted by Andy Stevens <in...@googlemail.com>.
Hi,

Apologies for any typos (and the previous incomplete message) - I'm sending
this on my phone in the middle of a forest :-)

I believe the relevant code was

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:transformers>
<map:transformer name="i18n"
src="org.apache.cocoon.transformation.I18nTransformer">
<catalogues>
<catalogue id="messages" name="msgs" location="cocoon:/translations" />
... (various closing tags)
<map:pipelines>
<map:pipeline>
<map:act type="session" /> (can't remember why this was present, or if it's
actually needed)
<map:match pattern="translations/msgs*.xml">
... stuff to generate catalogue entries for each language. In this case
there was a default generator reading a file (msgs.xml, msgs_en.xml,
msgs_de.xml, etc.) with the stored procedure call to fetch the tokens &
strings for each language, followed by a sql transformer, an xslt
transformer to convert to the catalogue xml format, and an xml serialiser.

Hope this helps,

Andy.
On 11 Aug 2011 22:33, "Nathaniel Grove" <nd...@virginia.edu> wrote:

Re: Location of I18N catalogs

Posted by Nathaniel Grove <nd...@virginia.edu>.
Yes, I'm using Cocoon 2.1.11 and I've gotten the basic I18N mechanism to 
work, but I'm confused how to go about getting the translations from 
outside of cocoon. I tried putting a URL in the location attribute as 
well as a Cocoon relative pipeline call, but neither worked. Do you have 
a code snippet you could share that shows how you did it?

Thanks,

Than

On 8/11/2011 9:40 AM, Andy Stevens wrote:
>
> What version of cocoon?
> It's certainly possible, as I've done it myself in the past, although 
> I think that was with version 2.1.something. Can't remember if it was 
> configured on the components setup or the transformer tag in the 
> pipeline, though.
> One thing to beware of is the catalog is only read once and cached, so 
> if you're generating the catalog xml from a database that is updated 
> you may need to restart the app subsequently. That or adapt the code 
> to allow it to be refreshed periodically.
>
> Andy.
> -- 
>
> On 11 Aug 2011 14:19, "Nathaniel Grove" <ndg8f@virginia.edu 
> <ma...@virginia.edu>> wrote:
> > I am new to using the Cocoon I18N feature and have only worked off the
> > example given in samples/i18n. The way I have it set up is that the
> > catalogs are in their own /translations/ folder at the top level of the
> > project. The location is then set in the map:transformer element for 
> i18n:
> >
> > <catalogues default="messages">
> > <catalogue id="messages" name="messages" location="translations"/>
> > </catalogues>
> >
> > I was wondering if it is possible to get the i18n catalogs from a
> > location outside of Cocoon, such as a database via a PHP script that
> > formats it into the proper XML. I tried setting the location to a 
> cocoon
> > relative pipeline "cocoon:/..." that read in an outside XML file but
> > this didn't work. Is it possible to do something like this?
> >
> > Thanks,
> >
> > Than G.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> <ma...@cocoon.apache.org>
> > For additional commands, e-mail: users-help@cocoon.apache.org 
> <ma...@cocoon.apache.org>
> >

-- 
Nathaniel Grove
Research Associate & Technical Director
Tibetan & Himalayan Library
གངས་ལྗོངས་གློག་རྡུལ་དཔེ་མཛོད་ཁང་།
http://www.thlib.org

Re: Location of I18N catalogs

Posted by Andy Stevens <in...@googlemail.com>.
What version of cocoon?
It's certainly possible, as I've done it myself in the past, although I
think that was with version 2.1.something. Can't remember if it was
configured on the components setup or the transformer tag in the pipeline,
though.
One thing to beware of is the catalog is only read once and cached, so if
you're generating the catalog xml from a database that is updated you may
need to restart the app subsequently. That or adapt the code to allow it to
be refreshed periodically.

Andy.
-- 
 On 11 Aug 2011 14:19, "Nathaniel Grove" <nd...@virginia.edu> wrote:
> I am new to using the Cocoon I18N feature and have only worked off the
> example given in samples/i18n. The way I have it set up is that the
> catalogs are in their own /translations/ folder at the top level of the
> project. The location is then set in the map:transformer element for i18n:
>
> <catalogues default="messages">
> <catalogue id="messages" name="messages" location="translations"/>
> </catalogues>
>
> I was wondering if it is possible to get the i18n catalogs from a
> location outside of Cocoon, such as a database via a PHP script that
> formats it into the proper XML. I tried setting the location to a cocoon
> relative pipeline "cocoon:/..." that read in an outside XML file but
> this didn't work. Is it possible to do something like this?
>
> Thanks,
>
> Than G.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>