If I download the latest snapshot (2002-05-14) will this be HEAD branch you mention?
----- Original Message ----- From: "Konstantin Piroumian" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, May 14, 2002 7:01 AM Subject: Re: Set locale with an action > From: "Spectron International, Inc." <[EMAIL PROTECTED]> > > Still not working. Now I changed my sitemap to this like you told me: > > I guess you are using 2.0.3 branch. i18n transformer was changed only in the > HEAD branch, because the new behavior is backward incompatible (the old one > uses LocaleAction implicitly). You can either get the HEAD version of the > transformer (but it can change in future) or you can try to add a 'locale' > named request (or a session, if you wish) attribute instead of returning it > in a Map in your action. You can also remove <map:parameter name="locale" > .../> from the i18n transformer, it is not needed in that case. > > 2.0.3 is meant to be only a bug-fix branch, that's why new functionality is > not added to it, but I'll discuss it in cocoon-dev. > > Regards, > Konstantin > > > > > <map:match pattern="MainMenu"> > > <map:act type="get-my-locale"> > > <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> > > > > The act function in my action looks like this: > > > > public Map act(Redirector redirector,SourceResolver resolver,Map > > objModel,String source,Parameters par) throws java.lang.Exception { > > // get locale from database save in variable lang > > // removed to save space > > Request request=ObjectModelHelper.getRequest(objModel); > > log("Using locale ["+lang+"]"); > > // set pipeline attribute > > Map map=new HashMap(); > > map.put("locale",lang); > > return(map); > > } > > > > The locale read from the database is ok because it shows up in the log. > But > > the i18n transformer ignores it. What am I doing wrong? Here is what I get > > in the log: > > > > Current Sitemap Parameters: > > PARAM: '1' VALUE: 'MainMenu' > > PARAM: '0' VALUE: 'msim/MainMenu' > > DEBUG (2002-05-13) 15:36.28:379 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: Default catalogue name > is > > messages > > DEBUG (2002-05-13) 15:36.28:410 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: Default catalogue > > location is translations > > DEBUG (2002-05-13) 15:36.28:411 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: Default untranslated > text > > is 'null' > > DEBUG (2002-05-13) 15:36.28:412 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: won't cache messages > > during startup, by default > > DEBUG (2002-05-13) 15:36.28:420 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: Default catalogue name > is > > messages > > DEBUG (2002-05-13) 15:36.28:421 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: Default catalogue > > location is translations > > DEBUG (2002-05-13) 15:36.28:422 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: Default untranslated > text > > is 'null' > > DEBUG (2002-05-13) 15:36.28:424 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: won't cache messages > > during startup, by default > > DEBUG (2002-05-13) 15:36.29:801 > > [sitemap.action.get-locale](/cocoon/msim/MainMenu) > > SocketListener-0/TestAction: Using datasource [msim]. > > DEBUG (2002-05-13) 15:36.30:061 > > [sitemap.action.get-locale](/cocoon/msim/MainMenu) > > SocketListener-0/TestAction: Using locale [es] > > DEBUG (2002-05-13) 15:36.30:382 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: catalog > > location:translations > > DEBUG (2002-05-13) 15:36.30:386 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: catalog > > directory:file:/opt/jetty/webapps/cocoon/msim/translations/ > > DEBUG (2002-05-13) 15:36.30:389 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/XMLResourceBundleFactory: XMLResourceBundleFactory > > configured with: cacheAtStartup = false, directory = > > 'file:/opt/jetty/webapps/cocoon/msim/translations/' > > DEBUG (2002-05-13) 15:36.30:390 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: configured > > DEBUG (2002-05-13) 15:36.30:459 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/I18nTransformer: I18nTransformer: using locale en_US > > DEBUG (2002-05-13) 15:36.30:461 > > [sitemap.transformer.i18n](/cocoon/msim/MainMenu) > > SocketListener-0/XMLResourceBundleFactory: _getBundle: messages, locale > > en_US > > > > ----- Original Message ----- > > From: "Konstantin Piroumian" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, May 13, 2002 11:31 AM > > Subject: Re: Set locale with an action > > > > > > > From: "Spectron International, Inc." <[EMAIL PROTECTED]> > > > > > > > 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 > > > > > > --------------------------------------------------------------------- > > 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: <[EMAIL PROTECTED]> > > For additional commands, e-mail: <[EMAIL PROTECTED]> > > > > --------------------------------------------------------------------- > 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: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > > --------------------------------------------------------------------- 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: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>