Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in displaying Asian languages in Internationalization

 
clyde melly
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a small application to display web page in different languages like french,german etc but with asian languages it's giving problem while making property files(i.e not able to save the property files).So plz tell how to overcome this problem and is there any editor which will directly translate the variables in property files.My code is as following.



package sfa;
//import for ResourceBundle class;
import java.util.*;
import sfa.*;
public class InternalizationBean
{

public static Internalization getMessageForView(Internalization oInternalization)
{
//Internalization oInternalization=new Internalization();
String language=oInternalization.getMyLanguage();
String country=oInternalization.getMyCountry();

String sMess1="";
String sMess2="";
String sMess3="";

Locale currentLocale;
ResourceBundle messages;

try
{
currentLocale=new Locale(language,country);
messages=ResourceBundle.getBundle("sfa.MessageBundle",currentLocale);

sMess1=messages.getString("greetings");
sMess2=messages.getString("inquiry");
sMess3=messages.getString("farewell");


oInternalization.setMess1(sMess1);
oInternalization.setMess2(sMess2);
oInternalization.setMess3(sMess3);

}
catch (Exception e)
{
System.out.println(e);
}

return oInternalization;
}
}
 
Jim Hicks
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with storing the data in a file may be your file system setup. If your computer file system is setup to only store 8 bit chars, then saving 16 bit chars in a file will result in unreadable data. Java chars are 16 bit but by default, they are converted to your computer's file systems char set which is usually 8 bit for western systems. In version 4 of Java, they made handling of charsets easier.

I would recommend you goto:

http://java.sun.com/developer/technicalArticles/Intl/index.html

Also when you write the html out, you need to make sure you set the html charset to something like "UTF-8". Setting it to ISO-8859-1 will limit you to 8 bits.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic