java left logo
java middle logo
java right logo
 

Home arrow Java SE Tips
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 3899
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
Multi-Lingual Features in Java Application E-mail
User Rating: / 38
PoorBest 

This tip will show how to add multi-lingual feature in Graphical User Interface (GUI) of any java application. To run any GUI of java application in multiple language java.util.ResourceBundle is used.

First make different property files for the different language. Name of all property files should be same with additional language suffix. For exp. fr for French, de for German etc. For example-

  • Label.properties file for the English
  • Label_fr.properties file for the French

Now use the following code to read the property file according to the Locale.

package myProject;

import java.util.Locale;
import java.util.ResourceBundle;

public class TextReader {

  public static void main(String[] args) {

    ResourceBundle resourceBundle = ResourceBundle.getBundle(
      "myProject.label", Locale.FRENCH);

    String name = resourceBundle.getString("NAME");
    String password=resourceBundle.getString("PASSWORD");

    System.out.println(name);
    System.out.println(password);
    
  }

}

 Related Tips

 
< Prev   Next >
 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.