File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Internationalizing non-English scripts

 
Fissehaye Kahsay
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I want to localize the GUI parts of some software which my colleagues and I developed. What I exactly want is that all the messages of the GUI should be displayed in a language called Amharic (The national language of Ethiopia) which uses non-English Scripts called Geez.
I have produced a resource bundle named MessageBundle that holds the locale specific .properties file.

Here is a very simple code, I wrote for testing(I used the Net Beans IDE. It has all the necessary things for adding .properties files)

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package i18nsample;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
/**
*
* @author Fish
*/
public class I18NSample extends Applet {

/**
* @param args the command line arguments
*/
String language = "am";//am is the language code for Amharic
String country = "ET"; // ET is the country code for Ethiopia
Locale currentLocale= new Locale(language,country);
ResourceBundle messages= ResourceBundle.getBundle("MessageBundle",currentLocale);
Button b0 = new Button(messages.getString("greetings"));//greetings is a key
Button b1 = new Button(messages.getString("farewell")); // farewell is a key
Button b2 = new Button(messages.getString("inquiry")); // inquiry is a key
public void init(){
add(b0);
add(b1);
add(b2);

}
public static void main(String[] args) {
// TODO code application logic here
I18NSample x = new I18NSample();
Frame aFrame = new Frame("Internationalization");
aFrame.addWindowListener(
new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
aFrame.add(x,BorderLayout.CENTER);
aFrame.setSize(300,200);
x.init();
aFrame.setVisible(true);
}

}
and here is the .properties file saved under the file name MessageBundle_am_ET.properties(where "am" is the first two lower case letters for "amharic" and "ET" is the first two upper case letters for Ethiopia).

greetings = \u12A3\u134D\u1295
farewell = \u120D\u1240\u1245
inquiry = \u1328\u122D\u1235
The values of the keys are the unicode representations for specific Geez (the script name) characters.
So far so good
But when I run the program, the output(displayed buttons) was simply the unicode representations, not the Geez Characters themselves. (By the way I'm using "characters" and "scripts" interchangeably)
Can you help where the problem is?
I have attached the output of my program
I really appreciate your help
Many thanks for your time


 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Use Code Tags. You can use the edit button to add them to your post.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there and welcome to Javaranch!

Sounds like you've hit across the old character encoding problem. I highly recommend you read this in order to help you out.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic