File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Internationalizing non-English scripts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Internationalizing non-English scripts" Watch "Internationalizing non-English scripts" New topic
Author

Internationalizing non-English scripts

Fissehaye Kahsay
Greenhorn

Joined: May 26, 2009
Posts: 9
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

Joined: Oct 27, 2005
Posts: 19543
    
  16

Please Use Code Tags. You can use the edit button to add them to your post.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

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.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Internationalizing non-English scripts
 
Similar Threads
Internationalization
Internationalization
Internationalization Problem
ResourceBundle.getBundle
Internationalization