By using the code snippet below the local language text when given as input generates the corresponding unicode for the local text.This unicode values can be directly given in the property file and the corresponding localised text is displayed in the application when it is retrieved from the property file.
import java.awt.Font; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.util.Vector; public class Converter implements ActionListener, ItemListener, WindowListener { /** * @param args */ JFrame jf; JTextArea ta, ta1; JButton convert, clear; JRadioButton rad1, rad2; JLabel text; ButtonGroup radgroup = new ButtonGroup(); String state = ""; JComboBox fonts; String fonttype = ""; public Converter() { jf = new JFrame(); ta = new JTextArea(20, 20); ta1 = new JTextArea(20, 20); rad1 = new JRadioButton( "String to Unicode(select the radiobutton for conversion)"); convert = new JButton("convert"); Font font = new Font("Arial Unicode MS", Font.BOLD, 20); Font font1 = new Font("Arial Unicode MS", Font.BOLD, 20); text = new JLabel("Select the font that supports the language"); ta.setFont(font); ta.setSize(20, 20); ta1.setSize(20, 20); ta1.setEditable(false); ta1.setFont(font1); convert.setSize(10, 10); jf.setLayout(new GridLayout(7, 1)); Container cont = jf.getContentPane(); cont.add(ta); radgroup.add(rad1); cont.add(rad1); cont.add(ta1); cont.add(convert); convert.addActionListener(this); rad1.addItemListener(this); jf.addWindowListener(this); GraphicsEnvironment gEnv = GraphicsEnvironment .getLocalGraphicsEnvironment(); String envfonts[] = gEnv.getAvailableFontFamilyNames(); Vector vector = new Vector(); for (int i = 1; i < envfonts.length; i++) { vector.addElement(envfonts[i]); } fonts = new JComboBox(vector); jf.add(text); jf.add(fonts); fonts.addItemListener(this); clear = new JButton("Clear Results"); clear.addActionListener(this); jf.add(clear); jf.setVisible(true); jf.setSize(300, 300); jf.setResizable(false); } public static void main(String[] args) { // TODO Auto-generated method stub Converter c = new Converter(); } public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub char stop = 'a'; char alpha[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '"', ':', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '_', '+', '=', '{', '}', '[', ']', '/', ',', '.', '?', '<', '>', ';', '`', '~', '\\', '\'', '\"' }; if (e.getSource() == convert && state.equals("sttouni")) { System.out.println("pressed convert"); String unicode = null; String content = ta.getText().trim(); System.out.println(content); char arr[] = content.toCharArray(); int count = 0; System.out.println(arr.length); for (int m = 0, n = arr.length; m < n; m++) { String msg = ""; StringBuffer sb = new StringBuffer(msg); for (char c : alpha) { if (c == arr[m]) { stop = c; count++; break; } } if (count == 0) { String hex = Integer.toHexString(arr[m]); hex = hex.toUpperCase(); String zero = ""; if (hex.length() < 4) { for (int len = hex.length(); len < 4; len++) zero = zero + "0"; } zero = zero + hex; msg = msg + "\\u"; msg = msg + zero; System.out.println(msg); } else { System.out.println("in the array bcoz of " + stop); msg = msg + arr[m]; } ta1.setText(ta1.getText() + msg); } } if (e.getSource() == clear) { ta.setText(""); ta1.setText(""); } } public void itemStateChanged(ItemEvent e) { // TODO Auto-generated method stub if (e.getSource() == rad1) { if (e.getStateChange() == 1) state = "sttouni"; System.out.println("statechanged" + e.getStateChange()); } if (e.getSource() == fonts) { fonttype = e.getItem().toString(); Font fontnew = new Font(fonttype, Font.BOLD, 20); ta.setFont(fontnew); System.out.println(fonttype); } } public void windowClosing(WindowEvent e) { // TODO Auto-generated method stub System.exit(1); jf.dispose(); } public void windowOpened(WindowEvent e) { // TODO Auto-generated method stub } public void windowClosed(WindowEvent e) { // TODO Auto-generated method stub } public void windowIconified(WindowEvent e) { // TODO Auto-generated method stub } public void windowDeiconified(WindowEvent e) { // TODO Auto-generated method stub } public void windowActivated(WindowEvent e) { // TODO Auto-generated method stub } public void windowDeactivated(WindowEvent e) { // TODO Auto-generated method stub } }