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 / January 2006

Tip: Looking for answers? Try searching our database.

Internationalization help needed

Thread view: 
Chanchal - 05 Jan 2006 07:05 GMT
hi all,

a swing application i'm developing need support for english and
spanish. there are about 80 screens. i have created the resource
bundles for both languages and wrote code for screen components to load
strings based on the current locale.

now i need to change the locale by clicking on a button.

ie i have a "Spanish" button, clicking on which will display all screen
component text
on all screens in spanish.

how that can be done. please advice

Chanchal
Daniel - 05 Jan 2006 10:37 GMT
Hello,
I have only written one application wich was internationalized. I used
a combobox but the ideas and lessons can be applied however you change
the locale.

I quickly discoered that it was much preferrable to restart the
application with a new language than doing it while running.

In your case I would do it like this:
set the locale with settings from the Preferences node. With the
default to your desired default.
(something like this I think:
Preferences prefs= Preferences.userNodeForPakage(this.getClass);
Locale.setDefaultLocale(new
Locale(prefs.get("language","EN"),prefs.get("country","us"));

and then as a result of the button being pressed you put the new
result
for say the spanish button you can
prefs.put("language","ES");
prefs.put("country","ES");
and then you pop up a box asking the user to restart. And then when
the user restarts it is in spanish.

I found this desireable since texts have such different length in
different lanugages, so it will undoubtly mess up your layouts. I
first tried to solve it with .validate(); but it does not seem to work
very well in some cases. So I decided to go for the restart option,
since the program remembers the setting anyway the user do it once and
then don't have to wory about it.

regards
Daniel

>hi all,
>
[quoted text clipped - 12 lines]
>
>Chanchal


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.