Internal Server Error
what the voices in my head tell me to write
Wednesday, March 25, 2009
I am working on a large site currently. One of the design requirements is that the site is easily localized as versions of it will be in use in various countries.
JSP/Java is very good at doing that sort of thing but its very important to plan carefully. Every single piece of text needs to be configurable. J2EE does this by using resource bundles. Everything is a key/value pair in a .properties file and <fmt:message> tags insert the text into the jsp. Then when a user comes to the site and their browser is set to a different locale the J2EE wizardry grabs the text from the right .properties file and the user sees the language they want.
That's the theory. And to be fair it works quite well. The trick is to plan in the localization from the start. You can't bolt it on at the end. You cant use an <input type="image"> tag to have a pretty looking button as that would mean the text would be in an image file and not localizable. So instead wrap a <button> tag with a <div> tag. The <button> tag displays the text in a nice localized way and the <div> has a pretty background image with no text.
Of course it can all come crashing down around your ears. For reasons best known to themselves the German language wont use one syllable when half a dozen will do. So your button will have the right text but it will overflow the background image. There is no real way around this though. The only thing to do is test, test and test again.
Permanent link and Comments posted by Rob Cornelius @ Wednesday, March 25, 2009