You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oleg V Alexeev <go...@penza.net> on 2001/06/09 10:22:06 UTC

Re[2]: Can you do this with internationalisation.

Hello Valery,

Saturday, June 09, 2001, 11:42:43 AM, you wrote:

VK>      Hello 

VK> My boss wants to have each  web page with link of language choose.

VK> Now each page have 2 link : french and english.I define link as 
VK> <a href="<%= request.getContextPath() %>?locale=en_CA" ><bean:message key="language.english"/><a>
VK> and
VK> <a href="<%= request.getContextPath() %>?locale=fr_CA" ><bean:message key="language.french"/><a>

1. create action to perform language switch - LanguageAction
2. create global forward mapping in struts-config for this action -

   <forward   name="language.en" path="/langauge.do?locale=en_CA"/>
   <forward   name="language.fr" path="/langauge.do?locale=fr_CA"/>

   and action mappings itself
   
    <action    path="/language"
               type="some.package.LanguageForm"
               name="languageForm">
    </action>

3. create form to catch locale strings from request LanguageForm
   and register it in struts-config -

    <form-bean      name="languageForm"
                    type="some.pachage.LanguageForm"/>

4. place to the jsp such links as -

 <html:link forward="language.en"><bean:message key="language.english"/></html:link>
 <html:link forward="language.fr"><bean:message key="language.french"/></html:link>

VK> But I have problem with populate form .
VK> For example :
VK>    For modify category page I create Action EditCategoryAction.
VK> This action populate localizable list "parent_category"  from Oracle.And forward to category.jsp .
VK> All ok.
VK> When I click on french or english link message replace new localized messages .But list still old,becouse 
VK> editCategoryAction not call again.

VK>   Problem:
VK> I want populate localized list  from action .But when I click on change language link 
VK> Action not called again.
VK> (Of course I can populate localizable list in jsp page .But in this case many logic exist on jsp page)

VK>   If anyone have this problem or know other solution help me.

-- 
Best regards,
 Oleg                            mailto:gonza@penza.net



Re[4]: Can you do this with internationalisation.

Posted by Oleg V Alexeev <go...@penza.net>.
Hello Valery,

Saturday, June 09, 2001, 1:56:53 PM, you wrote:

VK>       Thank you for your response.
VK> I try do your solution with
VK> only litle change  (I'm beginer in struts .May be I understand you)
VK>     <action    path="/language"
VK>                type="some.package.LanguageAction"
VK> <!--type="some.package.LanguageForm" -->
VK>                name="languageForm">
VK>     </action>
VK> It's work.

VK> But how I can know in LanguageAction url of page where I click choose
VK> language.
VK> I need this ,becouse  I want forward to page when I click choose language.


VK> When I click choose language in Category.jsp I want forward to
VK> CategoryEditAction becouse CategoryEditAction
VK> populate Category.jsp localized values from db

Place, for example, forward name to the request scope and display it
hidden value in jsp page. Every action can do it with standart way -
scan ActionMappings find itself and place action path to the request
under some name. By this name you can identify source action.

P.S. This is not standart way - I only suggest you my idea to
implement it.

-- 
Best regards,
 Oleg                            mailto:gonza@penza.net



Re: Re[2]: Can you do this with internationalisation.

Posted by Valery Kocubinsky <ko...@yahoo.com>.
      Thank you for your response.
I try do your solution with
only litle change  (I'm beginer in struts .May be I understand you)
    <action    path="/language"
               type="some.package.LanguageAction"
<!--type="some.package.LanguageForm" -->
               name="languageForm">
    </action>
It's work.

But how I can know in LanguageAction url of page where I click choose
language.
I need this ,becouse  I want forward to page when I click choose language.


When I click choose language in Category.jsp I want forward to
CategoryEditAction becouse CategoryEditAction
populate Category.jsp localized values from db







----- Original Message -----
From: "Oleg V Alexeev" <go...@penza.net>
To: "Valery Kocubinsky" <st...@jakarta.apache.org>
Sent: Saturday, June 09, 2001 11:22 AM
Subject: Re[2]: Can you do this with internationalisation.


> Hello Valery,
>
> Saturday, June 09, 2001, 11:42:43 AM, you wrote:
>
> VK>      Hello
>
> VK> My boss wants to have each  web page with link of language choose.
>
> VK> Now each page have 2 link : french and english.I define link as
> VK> <a href="<%= request.getContextPath() %>?locale=en_CA" ><bean:message
key="language.english"/><a>
> VK> and
> VK> <a href="<%= request.getContextPath() %>?locale=fr_CA" ><bean:message
key="language.french"/><a>
>
> 1. create action to perform language switch - LanguageAction
> 2. create global forward mapping in struts-config for this action -
>
>    <forward   name="language.en" path="/langauge.do?locale=en_CA"/>
>    <forward   name="language.fr" path="/langauge.do?locale=fr_CA"/>
>
>    and action mappings itself
>
>     <action    path="/language"
>                type="some.package.LanguageForm"
>                name="languageForm">
>     </action>
>
> 3. create form to catch locale strings from request LanguageForm
>    and register it in struts-config -
>
>     <form-bean      name="languageForm"
>                     type="some.pachage.LanguageForm"/>
>
> 4. place to the jsp such links as -
>
>  <html:link forward="language.en"><bean:message
key="language.english"/></html:link>
>  <html:link forward="language.fr"><bean:message
key="language.french"/></html:link>
>
> VK> But I have problem with populate form .
> VK> For example :
> VK>    For modify category page I create Action EditCategoryAction.
> VK> This action populate localizable list "parent_category"  from
Oracle.And forward to category.jsp .
> VK> All ok.
> VK> When I click on french or english link message replace new localized
messages .But list still old,becouse
> VK> editCategoryAction not call again.
>
> VK>   Problem:
> VK> I want populate localized list  from action .But when I click on
change language link
> VK> Action not called again.
> VK> (Of course I can populate localizable list in jsp page .But in this
case many logic exist on jsp page)
>
> VK>   If anyone have this problem or know other solution help me.
>
> --
> Best regards,
>  Oleg                            mailto:gonza@penza.net
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com