Re: help with multilingual JSP sites pls. using a Filter to rewrite the URL ?
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 - Original Message - From: Stephen Riek [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Sunday, November 24, 2002 6:42 PM Subject: help with multilingual JSP sites pls. using a Filter to rewrite the URL ? I'd like for a request to webapp/en/Folder/File to be sent to webapp/Folder/File but with a parameter 'lang' set to 'en'. Likewise, a request to webapp/fr/Folder/File to be sent to webapp/Folder/File but with a parameter 'lang' set to 'fr'. Is this possible with Filters? If not, is there any way to accomplish this within Tomcat so that it works for any number of directories and subdirectories. The reason I want to do this is to avoid copying/pasting an entire sitemap to support a second language - I know that some people create a site in English then copy/paste the directory tree into another directory (eg. '/fr', '/de/', '/cn/') to support a second language but this is not scalable and difficult to maintain. How do you circumvent doing such things ? Other mechanisms I've looked at are Apache rewrite rules but they're very complicated and I'd also like to make this work independent of Apache, and preferably for all servlet engines. Stephen. - 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]
Re: help with multilingual JSP sites pls. using a Filter to rewrite the URL ?
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
RE: help with multilingual JSP sites pls. using a Filter to rewrite the URL ?
use request.gePathInfo() to get the path. Then parse the string and use RequestDispatcher.forward(/products/Toys/index.jsp?myparam=+langString). The forward() will not be subject to further filter processing. Charlie -Original Message- From: Stephen Riek [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 11:27 AM To: Tomcat Users List Subject: Re: help with multilingual JSP sites pls. using a Filter to rewrite the URL ? 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]
RE: help with multilingual JSP sites pls. using a Filter to rewrite the URL ?
The browser can tell you the language that the system is setup for: Accept-Language: en-us, en;q=0.50 This is from my Mozilla setup All modern browsers will return an Accept Language string Another question related to this, Are you telling me that all your jsp pages have the actual content stored in several properties files? I wonder what that would look like Ron -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
help with multilingual JSP sites pls. using a Filter to rewrite the URL ?
I'd like for a request to webapp/en/Folder/File to be sent to webapp/Folder/File but with a parameter 'lang' set to 'en'. Likewise, a request to webapp/fr/Folder/File to be sent to webapp/Folder/File but with a parameter 'lang' set to 'fr'. Is this possible with Filters? If not, is there any way to accomplish this within Tomcat so that it works for any number of directories and subdirectories. The reason I want to do this is to avoid copying/pasting an entire sitemap to support a second language - I know that some people create a site in English then copy/paste the directory tree into another directory (eg. '/fr', '/de/', '/cn/') to support a second language but this is not scalable and difficult to maintain. How do you circumvent doing such things ? Other mechanisms I've looked at are Apache rewrite rules but they're very complicated and I'd also like to make this work independent of Apache, and preferably for all servlet engines. Stephen. - With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs