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]



Reply via email to