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 / General / March 2007

Tip: Looking for answers? Try searching our database.

creating a multilanguage application question

Thread view: 
felipone - 05 Mar 2007 12:24 GMT
I'm writing a simple JFrame application and I want my GUI to be in 2
language versions. GUI consists of some JButtons, JMenu, JToolTip etc.

Is there a neat way (container, class build in java) assigned for
switching language versions or should do it on my own - if yes what is
the right way to do it (I fought about using setText()).

Cheers,
  felipone

Sorry 4 mistakes in my English if there where any
sivasu.india@gmail.com - 05 Mar 2007 13:09 GMT
> I'm writing a simple JFrame application and I want my GUI to be in 2
> language versions. GUI consists of some JButtons, JMenu, JToolTip etc.
[quoted text clipped - 7 lines]
>
> Sorry 4 mistakes in my English if there where any

Hi,
 One way to achieve this is whatever is the text content put it
separately in a file,like msg.properties.
Suppose u want for English
put the msg.properties inside a folder en.
for chinese under the folder zh_CN.
So in that file you maintain key and value
eg.

CLASS_NAME=class name<value is locale based>

so in you code you should use only the key like CLASS_NAME,but you can
use api's available to replace the key with the value based on
locale,it will fetch from that particular folder and it will show.

Locale class in java also suppports this.
felipone - 05 Mar 2007 14:00 GMT
Thanks for response

> Hi,
>   One way to achieve this is whatever is the text content put it
> separately in a file,like msg.properties.

How do I bind msg.properties file to my project, this is an j2se app

> so in you code you should use only the key like CLASS_NAME,but you can
> use api's available to replace the key with the value based on
> locale,it will fetch from that particular folder and it will show.
>
> Locale class in java also suppports this.

So I understand I have to create my classes that extend gui classes, and
put my class names into the file.

Cheers,
    felipone
Simon - 06 Mar 2007 08:49 GMT
felipone schrieb:
> I'm writing a simple JFrame application and I want my GUI to be in 2
> language versions. GUI consists of some JButtons, JMenu, JToolTip etc.
[quoted text clipped - 7 lines]
>
> Sorry 4 mistakes in my English if there where any

This is the internationalisation tutorial:

 http://java.sun.com/docs/books/tutorial/i18n/index.html

Basically, what you do is:
 - write one file with key value pairs for every language
 - load the appropriate one based on the current locale into a ResourceBundle
 - use the keys to retrieve the messages

Cheers,
Simon
felipone - 06 Mar 2007 12:12 GMT
> This is the internationalisation tutorial:
>
>   http://java.sun.com/docs/books/tutorial/i18n/index.html

Thanks that helps a lot, I embarrassed I haven't found this tutorial
myself. Well,

 Thanks again,
    felipone


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



©2009 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.