Posted By:
Stephen_Ostermiller
Posted On:
Saturday, March 20, 2004 06:36 AM
For a standalone java application, the locale should be specified by the operating system and the default locale should reflect this.
I suspect that you are asking about a web server. For a web server, the desired locale is sent by the user in the header of the page. You read the header to figure this out. The header is "accept-lang".
You can then use that language in your response by getting the resource bundle for the requested locale and using that resource bundle to construct the responese:
ResourceBundle.getBundle(
"com.mycompany.myapplication.mybundle",
new Locale(language)
);