• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in displaying Asian languages in Internationalization

 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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;
}
}
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Could you hold this puppy for a sec? I need to adjust this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic