dcsimg
How I18n works ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   rajeev_ranjan
Posted On:   Thursday, February 19, 2004 04:46 AM

Hi,


I am new to this concept,and want to know how I18n works.


My doubt is -


1) How to find out the country by incoming Locale reuqest?


2) After finding out the country how to change the default
Locale(English) to some other Locale?







Thanks,

Rajeev

Re: How I18n works ?

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)
);
About | Sitemap | Contact