Академический Документы
Профессиональный Документы
Культура Документы
(I18N)
Definition
the arguments passed to the getBundle method identify the properties file to
be accessed.
First argument(MessageBundle) refers to properties file:
MessageBundle.properties
MessageBundle_fr_FR.properties
Second argument currentLocale specifies which of the messagebundle file is chosen.
4. Fetch the text from Resource Bundle
The properties file contain key-value pairs.
Value consists of the translated text
Key for fetching the translated text from the resource bundle with getString method
string msg1=messages.getString(greetings);
greetings is the key which consist of translated text and will be fetched using
getString method (key must be present in properties file)
5. Execute by passing language & country
as a parameter in argument
After compiling while executing pass the language and country as parameter in the
command line argument
ie after javac i18n.java
java i18n fr FR
this will execute french properties file and output will be displayed in french language