Why don't you look up on resource bundles instead?

Stephen Riek wrote:

Sorry, I'm not making myself clear here. My JSPs do exactly as you suggest so that I have one JSP serving up French and English pages, depending on the language that the user selected on my site.
Here is the problem explained very simply. I have a sitemap as follows:
/en
--> /Products
--> Toys/index.jsp
--> Decoration/index.jsp
/fr
--> /Products
--> /Toys/index.jsp
--> /Decoration/index.jsp

As you can see, this is braindead. If I wish the functionality of the English section of the site to be the same as that of the French part of the site, then any change
to a JSP in the 'en' part must be repeated within the 'fr' site. This is not scalable and is tedious.
Instead, it would be much better if I had one site structure which served up the
whole site.

/Products
--> /Toys/index.jsp
--> /Decoration/index.jsp

Any changes to functionality only have to be made in one place and both the
french viewers and english viewers will experience the same user experience, just in different languages. (I use the properties files as you suggest to serve up different languages).

The problem however is "how does /Products/Toys/index.jsp" know whether
the user is viewing in English or French ? The easy way would be to have the
user select a language on entering the site and then store the language preference in a cookie which I check before serving up pages. However, users may access the site from a search engine or from direct URLs due to
promotions. I would like a request for /en/Products/Toys/index.jsp to be sent to /Products/Toys/index.jsp but with a 'lang' parameter set to 'en'. Likewise for the french part of the site.
Surely somebody has had to encounter this sort of problem in dealing with
pan-European sites ?

Stephen.



Triptpal Singh Lamba <[EMAIL PROTECTED]> wrote:One way you can do this is using property files.

Prop_ file name _ language code.properties

So for say abc.jsp , you have abc_en.properties and abc_fr.properties.

At comple time the JSP calls a class you write at server which gives say String languageCode = ObjectName.getLaguageCode(param 1 ,param 2); %>

Then all JSP elements are picked from there.
Thanks
Tript Singh





---------------------------------
With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs




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

Reply via email to