cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Piroumian" <kpiroum...@apache.org>
Subject Re: Set locale with an action
Date Mon, 13 May 2002 15:31:26 GMT
From: "Spectron International, Inc." <spectron@coqui.net>

> Ok, I think that there is a problem with the action I made. Is there a way
> to view what the action returned in the Map object? If I understand
> correctly what is returned in tha map can be used in the sitemap like you
> mentioned:

See Cocoon logs. Search for 'sitemap parameters'. At least TreeProcessor
logs current available sitemap params for every request.

>
> <map:transform type="i18n">
>     <map:parameter name="locale" value="{../locale}"/>
> </map:transform>
>
> Whatever is between { } was returned by the action, right?

It can be also a matched wildcard (e.g.: /*/page.xml , for request like
/en/page.xml you'll have {1} param in sitemap).

>
> This is my sitemap:
>
> <map:match pattern="MainMenu">

<!-- Here was the problem -->
   <map:act type="get-my-locale">
    <!-- Params returned from action are available only inside of it -->

>   <map:generate type="file" src="MainMenu2.xml"/>
>   <map:transform type="i18n">
>     <map:parameter name="locale" value="{../locale}"/>
>   </map:transform>
>   <map:transform src="html/MainMenu2.xsl"/>
>   <map:serialize/>

    </map:act>

> </map:match>
>
> I tried {../locale} and it gives me an exception, tried {locale} and it
> works but does no translation. I think my action is not returning
anything.

Do you return a Map containing a 'locale = value' pair in it?

> So is there a way to see what my action is returning?

If you wrote that action then you should know it simply by looking at the
source code ;)

Hope this helps.

--
  Konstantin

>
> ----- Original Message -----
> From: "Konstantin Piroumian" <kpiroumian@apache.org>
> To: <cocoon-users@xml.apache.org>
> Sent: Monday, May 13, 2002 4:57 AM
> Subject: Re: Set locale with an action
>
>
> > From: "Spectron International, Inc." <spectron@coqui.net>
> >
> > > I want to be able to set the locale-attribure for the request in an
> > action.
> > > I have an action that reads the locale from a database and I use the
> > > following to set the locale:
> > >
> > > Request request=ObjectModelHelper.getRequest(objectModel);
> > > request.setAttribute('locale-attribute',locale);
> >
> > Why don't you use this in your sitemap:
> >
> > <map:transform type="i18n">
> >     <map:parameter name="locale" value="{../locale}"/>
> > </map:transform>
> > ?
> >
> > This is the proposed way of setting locale using a custom action. See
> > /samples/i18n/ sitemap to get the idea.
> >
> > Btw, you should set 'locale' and not the 'locale-attribute' for
> > LocaleAction.
> >
> > --
> > Konstantin
> >
> > >
> > > I have tried, 'locale-attribute', 'language-attribute' but it doesn't
> > work.
> > > This is what I get in the log (the first 2 messages are from my
action,
> so
> > > is reading the locale from the database ok):
> > >
> > > DEBUG (2002-05-07) 14:08.33:283
> > > [sitemap.action.get-locale](/cocoon/msim/MainMenu2)
> > > SocketListener-1/MyAction: Using datasource [msim].
> > > DEBUG (2002-05-07) 14:08.33:300
> > > [sitemap.action.get-locale](/cocoon/msim/MainMenu2)
> > > SocketListener-1/MyAction: Using locale-attribute [es]
> > > DEBUG (2002-05-07) 14:08.33:308
> > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu2)
> > > SocketListener-1/I18nTransformer: I18nTransformer: catalog
> > > location:translations
> > > DEBUG (2002-05-07) 14:08.33:311
> > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu2)
> > > SocketListener-1/I18nTransformer: I18nTransformer: catalog
> > > directory:file:/opt/jetty/webapps/cocoon/msim/translations/
> > > DEBUG (2002-05-07) 14:08.33:312
> > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu2)
> > > SocketListener-1/XMLResourceBundleFactory: XMLResourceBundleFactory
> > > configured with: cacheAtStartup = false, directory =
> > > 'file:/opt/jetty/webapps/cocoon/msim/translations/'
> > > DEBUG (2002-05-07) 14:08.33:313
> > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu2)
> > > SocketListener-1/I18nTransformer: I18nTransformer: configured
> > > DEBUG (2002-05-07) 14:08.33:315
> > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu2)
> > > SocketListener-1/I18nTransformer: I18nTransformer: using locale en_US
> > > DEBUG (2002-05-07) 14:08.33:316
> > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu2)
> > > SocketListener-1/XMLResourceBundleFactory: _getBundle: messages,
locale
> > > en_US
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Please check that your question has not already been answered in the
> > > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > >
> > > To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> > > For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> > >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> > For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> >
> >
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Mime
View raw message