You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by leo mj <le...@yahoo.com> on 2006/09/12 13:14:55 UTC

how to dynamically internationalize login page

hi all,

 I think some fellow member has asked the same question.But I didn't find any reply for the old thread.

So i have a scenario

I have a login page with 

  1.Username
  2.Password
  3.Language

Based on the language selected I have to reload the page.

I have used internationalization techniques like ApplicationResources_de for german.But this is a scenario where the language to be displayed is preconfigured using <message-resources> in struts-config.xml.

But dynamic selection of language,i feel can be done only if <message-resource parameter="ApplicationResources"> is modified using Action class.

I have done the modification using SAX parser and FileWriter.But I need a more neat way to do so.Is it possible???

Regards,
Leo




 		
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out. 

Re: how to dynamically internationalize login page

Posted by Laurie Harper <la...@holoweb.net>.
leo mj wrote:
> hi all,
> 
>  I think some fellow member has asked the same question.But I didn't find any reply for the old thread.
> 
> So i have a scenario
> 
> I have a login page with 
> 
>   1.Username
>   2.Password
>   3.Language
> 
> Based on the language selected I have to reload the page.
> 
> I have used internationalization techniques like ApplicationResources_de for german.But this is a scenario where the language to be displayed is preconfigured using <message-resources> in struts-config.xml.
> 
> But dynamic selection of language,i feel can be done only if <message-resource parameter="ApplicationResources"> is modified using Action class.
> 
> I have done the modification using SAX parser and FileWriter.But I need a more neat way to do so.Is it possible???

Err, I'm not sure I understand what you want to do. Why would you need 
to modify struts-config.xml? Provided you set the locale for the 
session, the correct properties file is used automatically for each 
subsequent request.

Modifying the struts-config.xml would change the default resources for 
all users of the application -- one user selecting a different language 
would change the language for every subsequent request for every user!

Perhaps you can explain what you're trying to achieve; maybe we can 
suggest a different approach for doing so.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to dynamically internationalize login page

Posted by Manfred Wolff <wo...@manfred-wolff.de>.
leo.

Please don't do so. In Struts you can do the language switching with the
locale Action. For this you have to provide several resources in the
java resourcebundle manner:

- provide a file for your message-ressource e.g. resources.properties
- provide a file for each language and name it
  resources_en.properties for english
  resources_de.properties for german
  resources_fr.properties for france etc.
- struts itsself fetches the right file. You have to do nothing else.

Download http://struts-ge-packt.de/download/code.zip for examples. Here
you can see how to deal with the most of the actions that are provided
with struts.

Manfred

Struts goes mobile: http://strutsme.org


leo mj wrote:
> hi all,
>
>  I think some fellow member has asked the same question.But I didn't find any reply for the old thread.
>
> So i have a scenario
>
> I have a login page with 
>
>   1.Username
>   2.Password
>   3.Language
>
> Based on the language selected I have to reload the page.
>
> I have used internationalization techniques like ApplicationResources_de for german.But this is a scenario where the language to be displayed is preconfigured using <message-resources> in struts-config.xml.
>
> But dynamic selection of language,i feel can be done only if <message-resource parameter="ApplicationResources"> is modified using Action class.
>
> I have done the modification using SAX parser and FileWriter.But I need a more neat way to do so.Is it possible???
>
> Regards,
> Leo
>
>
>
>
>  		
> ---------------------------------
> Stay in the know. Pulse on the new Yahoo.com.  Check it out. 
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org