Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Ruth, Brice
Adam Hardy wrote:

On 10/17/2003 09:56 PM Ruth, Brice wrote:

Greetings, all.

I'm looking for some guidance on how best to go about a requirement I 
have from our marketing as far as URL naming goes. We're developing 
an international (localized) site and we have a requirement that the 
URLs look something like this:

domain/us/whatever
domain/fr/whatever
domain/de/whatever
etc.
Now, I have a pretty decent grasp on how I'm going to use the 
localization features of Tiles and Struts to localize the site, but 
how best do I go about fulfilling the requirement outlined above?


Hi Brice,
first thing you've got to decide is whether you are going to select 
that locale based on their browser settings, or whether you are going 
to show them the default locale first and let them click on their 
chosen flag.

You also don't say if you have all your localized text in resources 
files, or whether you also have large amounts of text in static files, 
one language per file.

I tried to remember whether you can use wild cards in your action 
mapping paths in struts-config.xml, but I can't get my brain in gear 
right now.

So if you can, map your actions like so /*/*/whatever.do but if not, 
then you might have to repeat the whole mapping for each locale.

Fortunately the servlet mapping to the struts action servlet 
definitely takes wildcard characters, so *.do will match all your 
locale URLs.

Have fun,
Adam
On the first point, our site will have a global landing page that will 
present the user with flags to choose their locale. So with that point 
of entry, I'm set - I can have the flags link to an action that sets the 
selected locale in the user's session and sets a cookie, possibly, so 
that they don't have to go through that again when they return.

As for how the site is localized, some of that I'm still determining, 
but for the most part, I'm going to take advantage of resource files as 
well as localized tile definitions, to the greatest extent possible. 
There will be areas of the site that aren't shared between countries, 
however, that will likely be served from static files, or dynamic files 
that are only localized to a particular language.

I think I kind of understand the solution proposed with the wildcards .. 
but one of the things I'm fuzzy on is how to handle the situation of 
deep-links - if someone links to http://domain/us/index.jsp - then 
somehow, the locale needs to be initted to 'en_US', right? - without 
relying on there being a cookie present from a previous visit, of 
course. If I split out the mappings for each locale, can I set the 
default locale for that mapping in struts-config.xml or is this 
something that's done in web.xml/server.xml?

Thanks for the response on this - the best way of going about this 
hasn't quite crystallized yet, but I think I'm getting close.

Thanks again.
Brice
--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Adam Hardy


On 10/20/2003 04:47 PM Ruth, Brice wrote:
Adam Hardy wrote:
On 10/17/2003 09:56 PM Ruth, Brice wrote:
I'm looking for some guidance on how best to go about a requirement I 
have from our marketing as far as URL naming goes. We're developing 
an international (localized) site and we have a requirement that the 
URLs look something like this:

domain/us/whatever
domain/fr/whatever
domain/de/whatever
etc.
first thing you've got to decide is whether you are going to select 
that locale based on their browser settings, or whether you are going 
to show them the default locale first and let them click on their 
chosen flag.

On the first point, our site will have a global landing page that will 
present the user with flags to choose their locale. So with that point 
of entry, I'm set - I can have the flags link to an action that sets the 
selected locale in the user's session and sets a cookie, possibly, so 
that they don't have to go through that again when they return.

As for how the site is localized, some of that I'm still determining, 
but for the most part, I'm going to take advantage of resource files as 
well as localized tile definitions, to the greatest extent possible. 
There will be areas of the site that aren't shared between countries, 
however, that will likely be served from static files, or dynamic files 
that are only localized to a particular language.

I think I kind of understand the solution proposed with the wildcards .. 
but one of the things I'm fuzzy on is how to handle the situation of 
deep-links - if someone links to http://domain/us/index.jsp - then 
somehow, the locale needs to be initted to 'en_US', right? - without 
relying on there being a cookie present from a previous visit, of 
course. If I split out the mappings for each locale, can I set the 
default locale for that mapping in struts-config.xml or is this 
something that's done in web.xml/server.xml?
If that's a real .jsp file then that has to be a real us directory in 
your website. If that's the case, you can set the locale via a tag in 
the JSP. Alternatively you could use a filter. Have you thought of 
character encoding? If you have to set the request character encoding, 
then you may as well take care of the locale at the same time. A popular 
method is to use a filter called SetCharacterEncodingFilter which is 
easy to find the source code for on google or the tomcat website somewhere.

I was talking about virtual directories that are just mappings which the 
action servlet looks at. If you aren't going to use a filter, you could 
set the locale in the action instead, by checking the mapping path for 
the locale code.

HTH
Adam
--
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Ruth, Brice
Adam Hardy wrote:

On 10/20/2003 04:47 PM Ruth, Brice wrote:

Adam Hardy wrote:

On 10/17/2003 09:56 PM Ruth, Brice wrote:

I'm looking for some guidance on how best to go about a requirement 
I have from our marketing as far as URL naming goes. We're 
developing an international (localized) site and we have a 
requirement that the URLs look something like this:

domain/us/whatever
domain/fr/whatever
domain/de/whatever
etc.
first thing you've got to decide is whether you are going to select 
that locale based on their browser settings, or whether you are 
going to show them the default locale first and let them click on 
their chosen flag.


On the first point, our site will have a global landing page that 
will present the user with flags to choose their locale. So with that 
point of entry, I'm set - I can have the flags link to an action that 
sets the selected locale in the user's session and sets a cookie, 
possibly, so that they don't have to go through that again when they 
return.

As for how the site is localized, some of that I'm still determining, 
but for the most part, I'm going to take advantage of resource files 
as well as localized tile definitions, to the greatest extent 
possible. There will be areas of the site that aren't shared between 
countries, however, that will likely be served from static files, or 
dynamic files that are only localized to a particular language.

I think I kind of understand the solution proposed with the wildcards 
.. but one of the things I'm fuzzy on is how to handle the situation 
of deep-links - if someone links to http://domain/us/index.jsp - then 
somehow, the locale needs to be initted to 'en_US', right? - without 
relying on there being a cookie present from a previous visit, of 
course. If I split out the mappings for each locale, can I set the 
default locale for that mapping in struts-config.xml or is this 
something that's done in web.xml/server.xml?


If that's a real .jsp file then that has to be a real us directory in 
your website. If that's the case, you can set the locale via a tag in 
the JSP. Alternatively you could use a filter. Have you thought of 
character encoding? If you have to set the request character encoding, 
then you may as well take care of the locale at the same time. A 
popular method is to use a filter called SetCharacterEncodingFilter 
which is easy to find the source code for on google or the tomcat 
website somewhere.

I was talking about virtual directories that are just mappings which 
the action servlet looks at. If you aren't going to use a filter, you 
could set the locale in the action instead, by checking the mapping 
path for the locale code.

HTH
Adam
OK, I have to admit I'm a bit confused now :). I would like to be able 
to use a virtual directory structure, where /us/, /de/, /fr/, etc. just 
trigger something in Struts to set the locale appropriately, so that 
when /index.jsp is accessed under a particular virtual directory, its 
localized properly. Is this possible? As for character encoding, I 
hadn't really given it much thought and I'm not too familiar with 
filters, either ... is that a Struts feature or a JSP/Tomcat feature?

Thanks!

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Craig R. McClanahan
Ruth, Brice wrote:

[snip]
On the first point, our site will have a global landing page that will 
present the user with flags to choose their locale.
This is semi-offtopic, but might be of interest.

When I worked on a large scale multi-lingual app in Europe a few years 
ago, my intent was to do exactly this (but with a tweak -- the landing 
page language was determined by the browser's default language 
setting).  However, I was informed by more than a few Europeans that 
using flags for language choice was not being culturally sensitive -- if 
I'm a French-speaking person living in Belgium or Switzerland, it's 
going to irritate me greatly to have to click the flag of France -- and 
it's not a 1:1 relationship for any multilingual country (as these two, 
among others, are).

Craig



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Ruth, Brice
Craig R. McClanahan wrote:

Ruth, Brice wrote:

[snip]
On the first point, our site will have a global landing page that 
will present the user with flags to choose their locale.


This is semi-offtopic, but might be of interest.

When I worked on a large scale multi-lingual app in Europe a few years 
ago, my intent was to do exactly this (but with a tweak -- the landing 
page language was determined by the browser's default language 
setting).  However, I was informed by more than a few Europeans that 
using flags for language choice was not being culturally sensitive -- 
if I'm a French-speaking person living in Belgium or Switzerland, it's 
going to irritate me greatly to have to click the flag of France -- 
and it's not a 1:1 relationship for any multilingual country (as these 
two, among others, are).

Craig
Craig,

Thanks - I'll pass this on to our marketing folks. One note, though - 
our site will not only be localized for language, but will also be 
sensitive to the actual products our company offers in those markets. 
So, if we market products in Belgium and France, and they aren't the 
same, then we'll have two flags - one for Belgium, one for France - 
though that obviously creates a problem with countries that have more 
than one language, like Belgium and Switzerland, for instance.

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread ian_d_stewart


Switzerland is a very good example of this.  There are four different
languages spoken there (French, German, Italian, and a local language whose
name escapes me) and the prevelant language varies from kanton to kanton.

Even here in the US, there is an increasing number of communities where
Spanish is as prevalent as English.


Ian

Ian D. Stewart
Open Systems Engineer II
Enterprise Midrange - Bank One Infrastructure  Operations
[EMAIL PROTECTED]
(614) 244-2564




Craig R. McClanahan [EMAIL PROTECTED] on 10/20/2003 12:34:05 PM

Please respond to Struts Users Mailing List
  [EMAIL PROTECTED]

To:   Struts Users Mailing List [EMAIL PROTECTED]
cc:

Subject:  Re: Localization with Struts/Tiles and URLs



Ruth, Brice wrote:

 [snip]
 On the first point, our site will have a global landing page that will
 present the user with flags to choose their locale.

This is semi-offtopic, but might be of interest.

When I worked on a large scale multi-lingual app in Europe a few years
ago, my intent was to do exactly this (but with a tweak -- the landing
page language was determined by the browser's default language
setting).  However, I was informed by more than a few Europeans that
using flags for language choice was not being culturally sensitive -- if
I'm a French-speaking person living in Belgium or Switzerland, it's
going to irritate me greatly to have to click the flag of France -- and
it's not a 1:1 relationship for any multilingual country (as these two,
among others, are).

Craig



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]









This transmission may contain information that is privileged, confidential and/or 
exempt from disclosure under applicable law. If you are not the intended recipient, 
you are hereby notified that any disclosure, copying, distribution, or use of the 
information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. 
If you received this transmission in error, please immediately contact the sender and 
destroy the material in its entirety, whether in electronic or hard copy format. Thank 
you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Adam Hardy


On 10/20/2003 05:57 PM Ruth, Brice wrote:
Adam Hardy wrote:
If that's a real .jsp file then that has to be a real us directory in 
your website. If that's the case, you can set the locale via a tag in 
the JSP. Alternatively you could use a filter. Have you thought of 
character encoding? If you have to set the request character encoding, 
then you may as well take care of the locale at the same time. A 
popular method is to use a filter called SetCharacterEncodingFilter 
which is easy to find the source code for on google or the tomcat 
website somewhere.

I was talking about virtual directories that are just mappings which 
the action servlet looks at. If you aren't going to use a filter, you 
could set the locale in the action instead, by checking the mapping 
path for the locale code.

HTH
Adam
OK, I have to admit I'm a bit confused now :). I would like to be able 
to use a virtual directory structure, where /us/, /de/, /fr/, etc. just 
trigger something in Struts to set the locale appropriately, so that 
when /index.jsp is accessed under a particular virtual directory, its 
localized properly. Is this possible? As for character encoding, I 
hadn't really given it much thought and I'm not too familiar with 
filters, either ... is that a Struts feature or a JSP/Tomcat feature?

Thanks!

You would access /us/index.do, where *.do is the servlet mapping to 
struts in the web.xml, and /us/index is the struts action mapping to 
index.jsp. The real path of the index.jsp is hidden from public view by 
struts.

I doesn't have to be *.do - you can set up web.xml to map any pattern to 
struts - for instance /us/index.schmindex would be *.schmindex

Filters are not struts - they're in the J2EE servlet spec. You set them 
up in web.xml as well. They're a lead pipe cinch. They act on a mapping 
which the request must match for them to take effect, but most of the 
time in this sort of situation, the mapping is just /* for everything.

Tomcat processes the filters on the request before passing it to struts.

Adam

--
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Ruth, Brice
Adam Hardy wrote:

On 10/20/2003 05:57 PM Ruth, Brice wrote:

Adam Hardy wrote:

If that's a real .jsp file then that has to be a real us directory 
in your website. If that's the case, you can set the locale via a 
tag in the JSP. Alternatively you could use a filter. Have you 
thought of character encoding? If you have to set the request 
character encoding, then you may as well take care of the locale at 
the same time. A popular method is to use a filter called 
SetCharacterEncodingFilter which is easy to find the source code for 
on google or the tomcat website somewhere.

I was talking about virtual directories that are just mappings which 
the action servlet looks at. If you aren't going to use a filter, 
you could set the locale in the action instead, by checking the 
mapping path for the locale code.

HTH
Adam
OK, I have to admit I'm a bit confused now :). I would like to be 
able to use a virtual directory structure, where /us/, /de/, /fr/, 
etc. just trigger something in Struts to set the locale 
appropriately, so that when /index.jsp is accessed under a particular 
virtual directory, its localized properly. Is this possible? As for 
character encoding, I hadn't really given it much thought and I'm not 
too familiar with filters, either ... is that a Struts feature or a 
JSP/Tomcat feature?

Thanks!

You would access /us/index.do, where *.do is the servlet mapping to 
struts in the web.xml, and /us/index is the struts action mapping to 
index.jsp. The real path of the index.jsp is hidden from public view 
by struts.

I doesn't have to be *.do - you can set up web.xml to map any pattern 
to struts - for instance /us/index.schmindex would be *.schmindex

Filters are not struts - they're in the J2EE servlet spec. You set 
them up in web.xml as well. They're a lead pipe cinch. They act on a 
mapping which the request must match for them to take effect, but most 
of the time in this sort of situation, the mapping is just /* for 
everything.

Tomcat processes the filters on the request before passing it to struts.

Adam

OK, so I understand hiding the .jsp from the world with Struts, that's 
cool by me - I can handle that. So in that context, the virtual paths 
makes sense. As for the filters, would I set up a filter for say /us, 
/de, /fr - and then have Tomcat add the correct locale to the session 
before the request is passed on to Struts? Is that the use of filters in 
this situation?

Brice

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Localization with Struts/Tiles and URLs

2003-10-20 Thread Rajat Pandit
Hello,
A little off the topic though, but it this has always intrigued me about
building a multilingual website. I mean using the resources bundle u
could provide a translations from the labels but in case of building a
CMS (content management system) how would one enter the content in the
native language in which the site is translated?

I believe the solution that I have come up with is to save the same
content in different languages. But I am sure there would be a better
solution out there somewhere. I am new to struts development (and java
on the whole!) so pardon my ignorance!!.

rp

-Original Message-
From: Ruth, Brice [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 20, 2003 9:41 AM
To: Struts Users Mailing List
Subject: Re: Localization with Struts/Tiles and URLs


Craig R. McClanahan wrote:

 Ruth, Brice wrote:

 [snip]
 On the first point, our site will have a global landing page that 
 will present the user with flags to choose their locale.


 This is semi-offtopic, but might be of interest.

 When I worked on a large scale multi-lingual app in Europe a few years

 ago, my intent was to do exactly this (but with a tweak -- the landing

 page language was determined by the browser's default language 
 setting).  However, I was informed by more than a few Europeans that 
 using flags for language choice was not being culturally sensitive -- 
 if I'm a French-speaking person living in Belgium or Switzerland, it's

 going to irritate me greatly to have to click the flag of France -- 
 and it's not a 1:1 relationship for any multilingual country (as these

 two, among others, are).

 Craig

Craig,

Thanks - I'll pass this on to our marketing folks. One note, though - 
our site will not only be localized for language, but will also be 
sensitive to the actual products our company offers in those markets. 
So, if we market products in Belgium and France, and they aren't the 
same, then we'll have two flags - one for Belgium, one for France - 
though that obviously creates a problem with countries that have more 
than one language, like Belgium and Switzerland, for instance.

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Ruth, Brice
Our product content is going to be localized to the countries that the 
products are available in, and for that, we've built a database that 
holds this content and an interface to manage it - when adding a new 
translation, the user selects what language they're entering the 
translation for, and this is stored in the database - the keys used in 
the database to define the language are the same two by two codes used 
for locales (so en_US, fr_FR, etc.) so when pulling product data from 
the database into a JavaBean for the product (pseudo object-relational), 
the Bean has a collection of all the languages that this product is 
available in - this then can be rendered appropriately on the page in 
the user's locale.

Rajat Pandit wrote:

Hello,
A little off the topic though, but it this has always intrigued me about
building a multilingual website. I mean using the resources bundle u
could provide a translations from the labels but in case of building a
CMS (content management system) how would one enter the content in the
native language in which the site is translated?
I believe the solution that I have come up with is to save the same
content in different languages. But I am sure there would be a better
solution out there somewhere. I am new to struts development (and java
on the whole!) so pardon my ignorance!!.
rp

-Original Message-
From: Ruth, Brice [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 20, 2003 9:41 AM
To: Struts Users Mailing List
Subject: Re: Localization with Struts/Tiles and URLs

Craig R. McClanahan wrote:

 

Ruth, Brice wrote:

   

[snip]
On the first point, our site will have a global landing page that 
will present the user with flags to choose their locale.
 

This is semi-offtopic, but might be of interest.

When I worked on a large scale multi-lingual app in Europe a few years
   

 

ago, my intent was to do exactly this (but with a tweak -- the landing
   

 

page language was determined by the browser's default language 
setting).  However, I was informed by more than a few Europeans that 
using flags for language choice was not being culturally sensitive -- 
if I'm a French-speaking person living in Belgium or Switzerland, it's
   

 

going to irritate me greatly to have to click the flag of France -- 
and it's not a 1:1 relationship for any multilingual country (as these
   

 

two, among others, are).

Craig
   

Craig,

Thanks - I'll pass this on to our marketing folks. One note, though - 
our site will not only be localized for language, but will also be 
sensitive to the actual products our company offers in those markets. 
So, if we market products in Belgium and France, and they aren't the 
same, then we'll have two flags - one for Belgium, one for France - 
though that obviously creates a problem with countries that have more 
than one language, like Belgium and Switzerland, for instance.

 

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Adam Hardy


On 10/20/2003 07:41 PM Ruth, Brice wrote:
Adam Hardy wrote:

On 10/20/2003 05:57 PM Ruth, Brice wrote:

Adam Hardy wrote:

If that's a real .jsp file then that has to be a real us directory 
in your website. If that's the case, you can set the locale via a 
tag in the JSP. Alternatively you could use a filter. Have you 
thought of character encoding? If you have to set the request 
character encoding, then you may as well take care of the locale at 
the same time. A popular method is to use a filter called 
SetCharacterEncodingFilter which is easy to find the source code for 
on google or the tomcat website somewhere.

I was talking about virtual directories that are just mappings which 
the action servlet looks at. If you aren't going to use a filter, 
you could set the locale in the action instead, by checking the 
mapping path for the locale code.

HTH
Adam
OK, I have to admit I'm a bit confused now :). I would like to be 
able to use a virtual directory structure, where /us/, /de/, /fr/, 
etc. just trigger something in Struts to set the locale 
appropriately, so that when /index.jsp is accessed under a particular 
virtual directory, its localized properly. Is this possible? As for 
character encoding, I hadn't really given it much thought and I'm not 
too familiar with filters, either ... is that a Struts feature or a 
JSP/Tomcat feature?

Thanks!

You would access /us/index.do, where *.do is the servlet mapping to 
struts in the web.xml, and /us/index is the struts action mapping to 
index.jsp. The real path of the index.jsp is hidden from public view 
by struts.

I doesn't have to be *.do - you can set up web.xml to map any pattern 
to struts - for instance /us/index.schmindex would be *.schmindex

Filters are not struts - they're in the J2EE servlet spec. You set 
them up in web.xml as well. They're a lead pipe cinch. They act on a 
mapping which the request must match for them to take effect, but most 
of the time in this sort of situation, the mapping is just /* for 
everything.

Tomcat processes the filters on the request before passing it to struts.

Adam

OK, so I understand hiding the .jsp from the world with Struts, that's 
cool by me - I can handle that. So in that context, the virtual paths 
makes sense. As for the filters, would I set up a filter for say /us, 
/de, /fr - and then have Tomcat add the correct locale to the session 
before the request is passed on to Struts? Is that the use of filters in 
this situation?

Brice

it seems to me that the best use of the filter would be just to have one 
which sees all the traffic, and then it can extract the locale code from 
the request URL, check that it's one you deal with :) and then saves the 
info to the user's session.

Adam

--
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Ruth, Brice
Adam Hardy wrote:

On 10/20/2003 07:41 PM Ruth, Brice wrote:

Adam Hardy wrote:

On 10/20/2003 05:57 PM Ruth, Brice wrote:

Adam Hardy wrote:

If that's a real .jsp file then that has to be a real us directory 
in your website. If that's the case, you can set the locale via a 
tag in the JSP. Alternatively you could use a filter. Have you 
thought of character encoding? If you have to set the request 
character encoding, then you may as well take care of the locale 
at the same time. A popular method is to use a filter called 
SetCharacterEncodingFilter which is easy to find the source code 
for on google or the tomcat website somewhere.

I was talking about virtual directories that are just mappings 
which the action servlet looks at. If you aren't going to use a 
filter, you could set the locale in the action instead, by 
checking the mapping path for the locale code.

HTH
Adam
OK, I have to admit I'm a bit confused now :). I would like to be 
able to use a virtual directory structure, where /us/, /de/, /fr/, 
etc. just trigger something in Struts to set the locale 
appropriately, so that when /index.jsp is accessed under a 
particular virtual directory, its localized properly. Is this 
possible? As for character encoding, I hadn't really given it much 
thought and I'm not too familiar with filters, either ... is that a 
Struts feature or a JSP/Tomcat feature?

Thanks!

You would access /us/index.do, where *.do is the servlet mapping to 
struts in the web.xml, and /us/index is the struts action mapping to 
index.jsp. The real path of the index.jsp is hidden from public view 
by struts.

I doesn't have to be *.do - you can set up web.xml to map any 
pattern to struts - for instance /us/index.schmindex would be 
*.schmindex

Filters are not struts - they're in the J2EE servlet spec. You set 
them up in web.xml as well. They're a lead pipe cinch. They act on a 
mapping which the request must match for them to take effect, but 
most of the time in this sort of situation, the mapping is just /* 
for everything.

Tomcat processes the filters on the request before passing it to 
struts.

Adam

OK, so I understand hiding the .jsp from the world with Struts, 
that's cool by me - I can handle that. So in that context, the 
virtual paths makes sense. As for the filters, would I set up a 
filter for say /us, /de, /fr - and then have Tomcat add the correct 
locale to the session before the request is passed on to Struts? Is 
that the use of filters in this situation?

Brice

it seems to me that the best use of the filter would be just to have 
one which sees all the traffic, and then it can extract the locale 
code from the request URL, check that it's one you deal with :) and 
then saves the info to the user's session.

Adam

Cool, that's actually the route I'm taking now - just to test it out. 
Thanks a ton! :) I think between the various approaches, I have a plan now!

Brice

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Adam Hardy


On 10/20/2003 10:33 PM Ruth, Brice wrote:
Adam Hardy wrote:

On 10/20/2003 07:41 PM Ruth, Brice wrote:

Adam Hardy wrote:

On 10/20/2003 05:57 PM Ruth, Brice wrote:

Adam Hardy wrote:

If that's a real .jsp file then that has to be a real us directory 
in your website. If that's the case, you can set the locale via a 
tag in the JSP. Alternatively you could use a filter. Have you 
thought of character encoding? If you have to set the request 
character encoding, then you may as well take care of the locale 
at the same time. A popular method is to use a filter called 
SetCharacterEncodingFilter which is easy to find the source code 
for on google or the tomcat website somewhere.

I was talking about virtual directories that are just mappings 
which the action servlet looks at. If you aren't going to use a 
filter, you could set the locale in the action instead, by 
checking the mapping path for the locale code.

HTH
Adam
OK, I have to admit I'm a bit confused now :). I would like to be 
able to use a virtual directory structure, where /us/, /de/, /fr/, 
etc. just trigger something in Struts to set the locale 
appropriately, so that when /index.jsp is accessed under a 
particular virtual directory, its localized properly. Is this 
possible? As for character encoding, I hadn't really given it much 
thought and I'm not too familiar with filters, either ... is that a 
Struts feature or a JSP/Tomcat feature?

Thanks!

You would access /us/index.do, where *.do is the servlet mapping to 
struts in the web.xml, and /us/index is the struts action mapping to 
index.jsp. The real path of the index.jsp is hidden from public view 
by struts.

I doesn't have to be *.do - you can set up web.xml to map any 
pattern to struts - for instance /us/index.schmindex would be 
*.schmindex

Filters are not struts - they're in the J2EE servlet spec. You set 
them up in web.xml as well. They're a lead pipe cinch. They act on a 
mapping which the request must match for them to take effect, but 
most of the time in this sort of situation, the mapping is just /* 
for everything.

Tomcat processes the filters on the request before passing it to 
struts.

Adam

OK, so I understand hiding the .jsp from the world with Struts, 
that's cool by me - I can handle that. So in that context, the 
virtual paths makes sense. As for the filters, would I set up a 
filter for say /us, /de, /fr - and then have Tomcat add the correct 
locale to the session before the request is passed on to Struts? Is 
that the use of filters in this situation?

Brice

it seems to me that the best use of the filter would be just to have 
one which sees all the traffic, and then it can extract the locale 
code from the request URL, check that it's one you deal with :) and 
then saves the info to the user's session.

Adam

Cool, that's actually the route I'm taking now - just to test it out. 
Thanks a ton! :) I think between the various approaches, I have a plan now!

Brice

Great. Hope it works out.

--
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-20 Thread Ruth, Brice
Adam Hardy wrote:

On 10/20/2003 10:33 PM Ruth, Brice wrote:

Adam Hardy wrote:

On 10/20/2003 07:41 PM Ruth, Brice wrote:

Adam Hardy wrote:

On 10/20/2003 05:57 PM Ruth, Brice wrote:

Adam Hardy wrote:

If that's a real .jsp file then that has to be a real us 
directory in your website. If that's the case, you can set the 
locale via a tag in the JSP. Alternatively you could use a 
filter. Have you thought of character encoding? If you have to 
set the request character encoding, then you may as well take 
care of the locale at the same time. A popular method is to use 
a filter called SetCharacterEncodingFilter which is easy to find 
the source code for on google or the tomcat website somewhere.

I was talking about virtual directories that are just mappings 
which the action servlet looks at. If you aren't going to use a 
filter, you could set the locale in the action instead, by 
checking the mapping path for the locale code.

HTH
Adam
OK, I have to admit I'm a bit confused now :). I would like to be 
able to use a virtual directory structure, where /us/, /de/, 
/fr/, etc. just trigger something in Struts to set the locale 
appropriately, so that when /index.jsp is accessed under a 
particular virtual directory, its localized properly. Is this 
possible? As for character encoding, I hadn't really given it 
much thought and I'm not too familiar with filters, either ... is 
that a Struts feature or a JSP/Tomcat feature?

Thanks!

You would access /us/index.do, where *.do is the servlet mapping 
to struts in the web.xml, and /us/index is the struts action 
mapping to index.jsp. The real path of the index.jsp is hidden 
from public view by struts.

I doesn't have to be *.do - you can set up web.xml to map any 
pattern to struts - for instance /us/index.schmindex would be 
*.schmindex

Filters are not struts - they're in the J2EE servlet spec. You set 
them up in web.xml as well. They're a lead pipe cinch. They act on 
a mapping which the request must match for them to take effect, 
but most of the time in this sort of situation, the mapping is 
just /* for everything.

Tomcat processes the filters on the request before passing it to 
struts.

Adam

OK, so I understand hiding the .jsp from the world with Struts, 
that's cool by me - I can handle that. So in that context, the 
virtual paths makes sense. As for the filters, would I set up a 
filter for say /us, /de, /fr - and then have Tomcat add the correct 
locale to the session before the request is passed on to Struts? Is 
that the use of filters in this situation?

Brice

it seems to me that the best use of the filter would be just to have 
one which sees all the traffic, and then it can extract the locale 
code from the request URL, check that it's one you deal with :) and 
then saves the info to the user's session.

Adam

Cool, that's actually the route I'm taking now - just to test it out. 
Thanks a ton! :) I think between the various approaches, I have a 
plan now!

Brice

Great. Hope it works out.

Hehe, you'll be the first to know if it doesn't :)

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Localization with Struts/Tiles and URLs

2003-10-18 Thread Adam Hardy
On 10/17/2003 09:56 PM Ruth, Brice wrote:
Greetings, all.

I'm looking for some guidance on how best to go about a requirement I 
have from our marketing as far as URL naming goes. We're developing an 
international (localized) site and we have a requirement that the URLs 
look something like this:

domain/us/whatever
domain/fr/whatever
domain/de/whatever
etc.
Now, I have a pretty decent grasp on how I'm going to use the 
localization features of Tiles and Struts to localize the site, but how 
best do I go about fulfilling the requirement outlined above?
Hi Brice,
first thing you've got to decide is whether you are going to select that 
locale based on their browser settings, or whether you are going to show 
them the default locale first and let them click on their chosen flag.

You also don't say if you have all your localized text in resources 
files, or whether you also have large amounts of text in static files, 
one language per file.

I tried to remember whether you can use wild cards in your action 
mapping paths in struts-config.xml, but I can't get my brain in gear 
right now.

So if you can, map your actions like so /*/*/whatever.do but if not, 
then you might have to repeat the whole mapping for each locale.

Fortunately the servlet mapping to the struts action servlet definitely 
takes wildcard characters, so *.do will match all your locale URLs.

Have fun,
Adam
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]