views:

36

answers:

2

English properties file can be read bt when i click on french link it couldnt read.Can u tell me the stepwise process to do this.I hav images which need to be in french when i click in french..

A: 
  1. Do you have code? I am pretty sure you do, post some please.
  2. Does an exeception occur? Give us the stacktrace then.
  3. What do properties files have to do with images? Do you have paths in there?
  4. ...
Willi
A: 

Java uses the ResourceBundle class to support internationalization. ResourceBundle can load it's content from property files on the classpath. To provide property files for all the languages/countries you want, you need multiple property files, each named in this format baseName_languageCode_countryCode.properties

All properties files must have the same baseName. languageCode is to specify a language, and is 2 lower-case characters. countryCode is to specify the country, and is 2 upper-case characters. You can make sure you're using the correct codes by checking out values used in the Locale class. To supply a properties file for French (the language) and France (the country) it would be baseName_fr_FR.properties.

Spring uses the MessageSource interface to provide access to messages. ResourceBundleMessageSource and subclasses provides an internationalizable MessageSource.

When configuring your ResourceBundleMessageSource in Spring, you'll need to supply the baseName, and place the property files somewhere on the classpath. Spring figures out the users current locale from their browser and uses it to load the correct properties file.

Nate