The more I read up on this the more confused I become. My web application consists of a single servlet and a few .jsp files. When a user logs on his credentials are checked against a database which contains a reference to his prefered language. There is no guarantee that all users will have the same language. Lets says for example my user base is Dutch but when I logon I want to get English menus. I can retrieve and store the prefered language as a string in a session variable.
I don't see how a single resource bundle can help me as it wants to know the locale, which could very well be differnet for each session.
Should I be creating a resource bundle for each possible language I support and then put some conditional logic in a routine which looks for the users preferred language and then calls the appropriate resource bundle to get the translation ?
If I do it that way then I will end up with some code I need to change whenever I add a new language?
I understand that much, but when you access those via a resource bundle you specify the language that you want it to work with. However each call may be for a different user and different language. Does this mean I have to create a new instance of resourcebundle for each user ?
Not necessarily per-user, but per locale, sure. The details of that may be handled by the JDK, though--I've only *very* rarely had to deal with resource bundles directly--I almost always only care about localized text, which is almost always handled by whatever framework I happen to be using.