Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2006

Tip: Looking for answers? Try searching our database.

i18n in swing, trouble

Thread view: 
Schlum - 12 Jun 2006 06:14 GMT
Hi,

I am building my first Gui with Swing, and in the same time I need to
use the i18n to make it work in Japanese and English.

I use Eclipse and its great Visual Editor to save time, all my files are
utf8 encoded. And, I am under WinXp...

My trouble is the following :
-> If I make a jMenu with some japanese hardcoded text, it appears fine
in my application.
-> If I use a ResourceBundle to get the text, I have garbage. I use the
following line: myMenu.setText(myBundleResource.getString("myTest"));
The .properties files for the japanese is also in Utf8

Do you have any idea why the text in the .properties file is not passed
correctly ? Any help would be really appreciated.

Best Regards,
Schlum
Thomas Weidenfeller - 12 Jun 2006 08:33 GMT
> I am building my first Gui with Swing, and in the same time I need to
> use the i18n to make it work in Japanese and English.

Do not multipost.

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Schlum - 12 Jun 2006 08:59 GMT
>> I am building my first Gui with Swing, and in the same time I need to
>> use the i18n to make it work in Japanese and English.
>
> Do not multipost.

I do, but I post also your answer to help those who may be in the same
situation :)

For the record:

"The .properties needs to be in ASCII/Latin-1 with any non ASCII/Latin-1
char encoded with the \u notation, not in utf8

This is difficult to write by hand, so use native2ascii to convert your
text. I would recommend to add the call to native2ascii to your build
system. "
Richard Wheeldon - 14 Jun 2006 08:14 GMT
> "The .properties needs to be in ASCII/Latin-1 with any non ASCII/Latin-1
> char encoded with the \u notation, not in utf8

There's also a quick hack for utf8 support in properties files:
http://www.thoughtsabout.net/blog/archives/000044.html

Richard


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.