Quantcast

PreffixMapper for language

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

PreffixMapper for language

JOSE L MARTINEZ-AVIAL
Hello,
  I have a requisite to provide multilanguage in my app using a preffix in the action. So the URLs would be

http://myserver/mypackage/myaction (for the default language)

http://myserver/en/mypackage/myaction (for english)




Sent via BlackBerry from T-Mobile

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: PreffixMapper for language

JOSE L MARTINEZ-AVIAL
Sorry, It went through too early


Sent via BlackBerry from T-Mobile

-----Original Message-----
From: [hidden email]
Date: Mon, 9 Jul 2012 18:56:43
To: Struts Users Mailing List<[hidden email]>
Reply-To: [hidden email]
Subject: PreffixMapper for language

Hello,
  I have a requisite to provide multilanguage in my app using a preffix in the action. So the URLs would be

http://myserver/mypackage/myaction (for the default language)

http://myserver/en/mypackage/myaction (for english)




Sent via BlackBerry from T-Mobile

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: PreffixMapper for language

JOSE L MARTINEZ-AVIAL
Last try:
Hello,
  I have a requisite to provide multilanguage in my app using a preffix in
the action. So the URLs would be

http://myserver/mypackage/myaction (for the default language)

http://myserver/en/mypackage/myaction (for english)

http://myserver/pt/mypackage/myaction<http://myserver/en/mypackage/myaction>(for
portuguese)

The actions will not change, so I was thinking of using the PreffixMapper
(slightly modified to pass the language as a parameter for a interceptor
that will take care of the Locale). Has somebody done something like this?
Is there a better approach?

Thanks.

JL


2012/7/9 <[hidden email]>

> Sorry, It went through too early
>
>
> Sent via BlackBerry from T-Mobile
>
> -----Original Message-----
> From: [hidden email]
> Date: Mon, 9 Jul 2012 18:56:43
> To: Struts Users Mailing List<[hidden email]>
> Reply-To: [hidden email]
> Subject: PreffixMapper for language
>
> Hello,
>   I have a requisite to provide multilanguage in my app using a preffix in
> the action. So the URLs would be
>
> http://myserver/mypackage/myaction (for the default language)
>
> http://myserver/en/mypackage/myaction (for english)
>
>
>
>
> Sent via BlackBerry from T-Mobile
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: PreffixMapper for language

Takanori Hayashi
Hello Josel Martinez-Avial,

To make mutilanguage application in Struts,
you can use property files
   like  MessageResources_en.propeties, MessageResources_pt.properties
for portuguese. The property files are placed under src
directory and classes directory after compiled.

Configuration file is struts-config.xml like
  <message-resources parameter="MessageResources" />

The example of MessgeResources_en.properties is
  sendMessage.heading=Sending a message
MessageResources_pt.properties would be
sendMessage.heading=(portuguese of Sending a message)

The example of a JSP file contents is
   <bean:message key="sendMessage.message"/>


Regards,
Takanori Hayashi


(2012/07/10 4:27), JOSE L MARTINEZ-AVIAL wrote:

> Last try:
> Hello,
>    I have a requisite to provide multilanguage in my app using a preffix in
> the action. So the URLs would be
>
> http://myserver/mypackage/myaction (for the default language)
>
> http://myserver/en/mypackage/myaction (for english)
>
> http://myserver/pt/mypackage/myaction<http://myserver/en/mypackage/myaction>(for
> portuguese)
>
> The actions will not change, so I was thinking of using the PreffixMapper
> (slightly modified to pass the language as a parameter for a interceptor
> that will take care of the Locale). Has somebody done something like this?
> Is there a better approach?
>
> Thanks.
>
> JL
>
>
> 2012/7/9 <[hidden email]>
>
>> Sorry, It went through too early
>>
>>
>> Sent via BlackBerry from T-Mobile
>>
>> -----Original Message-----
>> From: [hidden email]
>> Date: Mon, 9 Jul 2012 18:56:43
>> To: Struts Users Mailing List<[hidden email]>
>> Reply-To: [hidden email]
>> Subject: PreffixMapper for language
>>
>> Hello,
>>    I have a requisite to provide multilanguage in my app using a preffix in
>> the action. So the URLs would be
>>
>> http://myserver/mypackage/myaction (for the default language)
>>
>> http://myserver/en/mypackage/myaction (for english)
>>
>>
>>
>>
>> Sent via BlackBerry from T-Mobile
>>





---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: PreffixMapper for language

JOSE L MARTINEZ-AVIAL
Hi Takanori Hayashi,
  Yes, I know I can do that. The problem is that the requisite is to
receive the language through the URL. I want to retrieve the locale, put it
into the ActionContext, remove the locale from the URL, and then send the
request to the ActionMapper, so the mapping won't depend on the
language(because I removed it from the URL). That's the tricky part.

JL



2012/7/9 Takanori Hayashi <[hidden email]>

> Hello Josel Martinez-Avial,
>
> To make mutilanguage application in Struts,
> you can use property files
>   like  MessageResources_en.propeties, MessageResources_pt.properties for
> portuguese. The property files are placed under src
> directory and classes directory after compiled.
>
> Configuration file is struts-config.xml like
>  <message-resources parameter="MessageResources" />
>
> The example of MessgeResources_en.properties is
>  sendMessage.heading=Sending a message
> MessageResources_pt.properties would be
> sendMessage.heading=(**portuguese of Sending a message)
>
> The example of a JSP file contents is
>   <bean:message key="sendMessage.message"/>
>
>
> Regards,
> Takanori Hayashi
>
>
>
> (2012/07/10 4:27), JOSE L MARTINEZ-AVIAL wrote:
>
>> Last try:
>> Hello,
>>    I have a requisite to provide multilanguage in my app using a preffix
>> in
>> the action. So the URLs would be
>>
>> http://myserver/mypackage/**myaction <http://myserver/mypackage/myaction>(for the default language)
>>
>> http://myserver/en/mypackage/**myaction<http://myserver/en/mypackage/myaction>(for english)
>>
>> http://myserver/pt/mypackage/**myaction<http://myserver/pt/mypackage/myaction>
>> <http://myserver/en/**mypackage/myaction<http://myserver/en/mypackage/myaction>
>> >(for
>>
>> portuguese)
>>
>> The actions will not change, so I was thinking of using the PreffixMapper
>> (slightly modified to pass the language as a parameter for a interceptor
>> that will take care of the Locale). Has somebody done something like this?
>> Is there a better approach?
>>
>> Thanks.
>>
>> JL
>>
>>
>> 2012/7/9 <[hidden email]>
>>
>>  Sorry, It went through too early
>>>
>>>
>>> Sent via BlackBerry from T-Mobile
>>>
>>> -----Original Message-----
>>> From: [hidden email]
>>> Date: Mon, 9 Jul 2012 18:56:43
>>> To: Struts Users Mailing List<[hidden email]>
>>> Reply-To: [hidden email]
>>> Subject: PreffixMapper for language
>>>
>>> Hello,
>>>    I have a requisite to provide multilanguage in my app using a preffix
>>> in
>>> the action. So the URLs would be
>>>
>>> http://myserver/mypackage/**myaction<http://myserver/mypackage/myaction>(for the default language)
>>>
>>> http://myserver/en/mypackage/**myaction<http://myserver/en/mypackage/myaction>(for english)
>>>
>>>
>>>
>>>
>>> Sent via BlackBerry from T-Mobile
>>>
>>>
>
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: user-unsubscribe@struts.**apache.org<[hidden email]>
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: PreffixMapper for language

J. Garcia
In reply to this post by JOSE L MARTINEZ-AVIAL
Does not sound bad. Just try it.
Another option worth trying-out is urlrewrite: http://tuckey.org/urlrewrite/
With urlrewrite filter, you could set locale and forward to
/mypackage/myaction.

Saludos,
J.

On Mon, Jul 9, 2012 at 9:27 PM, JOSE L MARTINEZ-AVIAL <[hidden email]>wrote:

> Last try:
> Hello,
>   I have a requisite to provide multilanguage in my app using a preffix in
> the action. So the URLs would be
>
> http://myserver/mypackage/myaction (for the default language)
>
> http://myserver/en/mypackage/myaction (for english)
>
> http://myserver/pt/mypackage/myaction<
> http://myserver/en/mypackage/myaction>(for
> portuguese)
>
> The actions will not change, so I was thinking of using the PreffixMapper
> (slightly modified to pass the language as a parameter for a interceptor
> that will take care of the Locale). Has somebody done something like this?
> Is there a better approach?
>
> Thanks.
>
> JL
>
>
> 2012/7/9 <[hidden email]>
>
> > Sorry, It went through too early
> >
> >
> > Sent via BlackBerry from T-Mobile
> >
> > -----Original Message-----
> > From: [hidden email]
> > Date: Mon, 9 Jul 2012 18:56:43
> > To: Struts Users Mailing List<[hidden email]>
> > Reply-To: [hidden email]
> > Subject: PreffixMapper for language
> >
> > Hello,
> >   I have a requisite to provide multilanguage in my app using a preffix
> in
> > the action. So the URLs would be
> >
> > http://myserver/mypackage/myaction (for the default language)
> >
> > http://myserver/en/mypackage/myaction (for english)
> >
> >
> >
> >
> > Sent via BlackBerry from T-Mobile
> >
>
Loading...