> 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
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