You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by abhishek jain <ab...@gmail.com> on 2010/03/04 06:49:53 UTC

Locale and custom variables

Hi friends,

I have a few variables who have diff values depending on the locale /
country.
I do want to use a message-resources for storing the values of those
varaibles,
I do not know how to get these variables in my Action (I want them in action
and not jsp),
Can any one help,
I have tried System.out.println(getResources(request,"id2")); after setting
a locale and it do not work.

Pl. help,
--
Thanks and kind Regards,
Abhishek jain

Re: Locale and custom variables

Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
Em 04-03-2010 14:15, abhishek jain escreveu:
> On Thu, Mar 4, 2010 at 7:30 PM, Alex Rodriguez Lopez<alopez@flordeutopia.pt
>> wrote:
>
>> Em 04-03-2010 05:49, abhishek jain escreveu:
>>
>> Hi friends,
>>>
>>> I have a few variables who have diff values depending on the locale /
>>> country.
>>> I do want to use a message-resources for storing the values of those
>>> varaibles,
>>> I do not know how to get these variables in my Action (I want them in
>>> action
>>> and not jsp),
>>> Can any one help,
>>> I have tried System.out.println(getResources(request,"id2")); after
>>> setting
>>> a locale and it do not work.
>>>
>>> Pl. help,
>>> --
>>> Thanks and kind Regards,
>>> Abhishek jain
>>>
>>>
>> Hi Abhishek,
>>
>> if your Action extends ActionSupport, you can use one of the getText()
>> methods to do preciselly this, check
>> http://struts.apache.org/2.1.8.1/struts2-core/apidocs/com/opensymphony/xwork2/ActionSupport.html.
>>
>> We use it this way around here and it works fine (the resource properties
>> files being in the same package).
>>
>> Regards,
>>
>> Alex
>
>
> Dear Alex,
> Thanks will check that
> PS: Will it work for Struts 1.2 as well?

sorry I didn't get that you where using struts 1
struts 1 actions don't extend the same kind of class, you where already 
doing right with getResources, I think it should work

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


Re: Locale and custom variables

Posted by abhishek jain <ab...@gmail.com>.
On Thu, Mar 4, 2010 at 7:30 PM, Alex Rodriguez Lopez <alopez@flordeutopia.pt
> wrote:

> Em 04-03-2010 05:49, abhishek jain escreveu:
>
> Hi friends,
>>
>> I have a few variables who have diff values depending on the locale /
>> country.
>> I do want to use a message-resources for storing the values of those
>> varaibles,
>> I do not know how to get these variables in my Action (I want them in
>> action
>> and not jsp),
>> Can any one help,
>> I have tried System.out.println(getResources(request,"id2")); after
>> setting
>> a locale and it do not work.
>>
>> Pl. help,
>> --
>> Thanks and kind Regards,
>> Abhishek jain
>>
>>
> Hi Abhishek,
>
> if your Action extends ActionSupport, you can use one of the getText()
> methods to do preciselly this, check
> http://struts.apache.org/2.1.8.1/struts2-core/apidocs/com/opensymphony/xwork2/ActionSupport.html.
>
> We use it this way around here and it works fine (the resource properties
> files being in the same package).
>
> Regards,
>
> Alex


Dear Alex,
Thanks will check that
PS: Will it work for Struts 1.2 as well?
-- 
Thanks and kind Regards,
Abhishek jain

Re: Locale and custom variables

Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
Em 04-03-2010 05:49, abhishek jain escreveu:
> Hi friends,
>
> I have a few variables who have diff values depending on the locale /
> country.
> I do want to use a message-resources for storing the values of those
> varaibles,
> I do not know how to get these variables in my Action (I want them in action
> and not jsp),
> Can any one help,
> I have tried System.out.println(getResources(request,"id2")); after setting
> a locale and it do not work.
>
> Pl. help,
> --
> Thanks and kind Regards,
> Abhishek jain
>

Hi Abhishek,

if your Action extends ActionSupport, you can use one of the getText() 
methods to do preciselly this, check 
http://struts.apache.org/2.1.8.1/struts2-core/apidocs/com/opensymphony/xwork2/ActionSupport.html 
.

We use it this way around here and it works fine (the resource 
properties files being in the same package).

Regards,

Alex

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


RE: Locale and custom variables

Posted by adam pinder <ap...@hotmail.co.uk>.
 
i think you can name the resource bundle files appropriately for the locale and put them in the same package as the action classes.
 
look at the I18n Interceptor

adam

----------------------------------------
> Date: Thu, 4 Mar 2010 11:19:53 +0530
> Subject: Locale and custom variables
> From: abhishek.netjain@gmail.com
> To: user@struts.apache.org
>
> Hi friends,
>
> I have a few variables who have diff values depending on the locale /
> country.
> I do want to use a message-resources for storing the values of those
> varaibles,
> I do not know how to get these variables in my Action (I want them in action
> and not jsp),
> Can any one help,
> I have tried System.out.println(getResources(request,"id2")); after setting
> a locale and it do not work.
>
> Pl. help,
> --
> Thanks and kind Regards,
> Abhishek jain 		 	   		  
_________________________________________________________________
Tell us your greatest, weirdest and funniest Hotmail stories
http://clk.atdmt.com/UKM/go/195013117/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org