Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andrew,
On 5/7/2009 3:35 PM, Andrew Davidson wrote:
My main website is in
English. I want to have a landing page in Spanish that describes my website
and invites the user to click through the English version of the web site.
Any idea how I set this up using Tomcat? The bulk of our web site is static
html pages.
Some one sent me a link about how to do this using the Apache web server so
that it check the Accept-Language of the http header
Another way of doing this is to use resource bundles. It's uglier in
some ways, but better in other ways.
Create a captions.properties file for spanish:
Date=Term for Date in Spanish
and a captions_en.properties
Date=Date
Place the file in your WEB-INF/classes directory.
Now, add this code to your page:
Locale lc=request.getLocale();
ResourceBundle rb=ResourceBundle.getBundle("captions",lc);
Now, on your JSP page instead of
Date <INPUT TYPE=TEXT VALUE="05/27/2009">
you have
<%=rb.getString("Date")%> <INPUT TYPE=TEXT VALUE="05/27/2009">
The good part of this is that you end up with only one set of JSP pages.
The bad side is that you have to code your layout so it can deal with
variable size captions. Spanish captions are going to be some 20% longer
on average than English.
Additionally, if you're using images with text, you'll have to put
handling in.
--
George Sexton
MH Software, Inc.
Voice: +1 303 438 9585
URL: http://www.mhsoftware.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org