简体   繁体   中英

Changing the language of the web application in java

Can any one tell me how to change the language of the web application in java without using properties file.

For instance If the browser's language is in french then the web application text has to change into french.

The standard way is to use the Accept-Language header . For instance:

Accept-Language:en-US,en;q=0.8,fr-FR;q=0.6,fr;

Usually you build your application on top of a Framework (eg Spring) and/or a technology (eg JSF) which takes care of this problem for you and gives you the correct Locale of the user.

Based on the Locale , you retrieve the correct version of a given message. Typically, you will have multiple properties file (one for each language). This will be also managed by the framework or the technologie you are using.

Actually, you definitively have to tell us more about your application if you want a precise answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM