Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3069 > unrolled thread

Internationalization

Started by"Mark" <mark@THRWHITE.remove-dii-this>
First post2011-04-27 15:42 +0000
Last post2011-04-27 15:42 +0000
Articles 6 — 4 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Internationalization "Mark" <mark@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
    Re: Internationalization "bcd" <bcd@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
      Re: Internationalization "Mark" <mark@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
    Re: Internationalization "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
    Re: Internationalization "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
    Re: Internationalization "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000

#3069 — Internationalization

From"Mark" <mark@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectInternationalization
Message-ID<fnd01l$qjn$1@news.nems.noaa.gov>
  To: comp.lang.java.gui
I was informed today that my Java program might be used in several other 
countries, including China, Romania, and some Spanish-speaking countries 
in South America.

This mostly impacts the GUI where I have menu items, tool-tips, and 
dialog messages -- all in English, currently.

I haven't a clue what I should do to make my GUI internationalized.  I 
am seeking guidance on this...

I read the article at: 
http://java.sun.com/developer/technicalArticles/J2SE/locale/ but it 
didn't explain how I would most wisely go about making my drop-down text 
menu available in several different languages.

Say, to make the "File" menu and the "Edit" menu use different words 
depending on the Locale setting, would I have to create a lengthy 
if{}-else{} block to test for each Locale supported and return a 
translated String for each word?  If so, in my case with a lot of 
text/words, this would be extremely cumbersome and the code would 
probably triple in size.  It might be less tedious if I were to maintain 
multiple versions of the software (in each language).  Am I missing 
something?

Mark

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#3070

From"bcd" <bcd@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
Message-ID<fnd4n6$ifl$1@kuling.itea.ntnu.no>
In reply to#3069
  To: comp.lang.java.gui
In article <fnd01l$qjn$1@news.nems.noaa.gov>,
Mark  <Mark.Fenbers@noaa.gov> wrote:
>
>Say, to make the "File" menu and the "Edit" menu use different words 
>depending on the Locale setting, would I have to create a lengthy 
>if{}-else{} block to test for each Locale supported and return a 
>translated String for each word?

No, you use resource bundles and possibly the MessageFormat class for
this.

See
http://java.sun.com/j2se/1.5.0/docs/api/java/util/ResourceBundle.html
and
http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html

This way, your code may change from something like
button.setText("Apply");
to
button.setText(bundle.getString("button.apply"));

And you will have a Strings.properties file that would contain,
amongst other things,

button.apply = Apply

Then you might have one Strings_es_ES.properties file with Spanish
strings, etc.

Cheers,
	Bent D
-- 
Bent Dalager - bcd@pvv.org - http://www.pvv.org/~bcd
                                    powered by emacs

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3071

From"Mark" <mark@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
Message-ID<479A291C.3090907@noaa.gov>
In reply to#3070
  To: Bent C Dalager
> 
> No, you use resource bundles and possibly the MessageFormat class for
> this.
> 
> See
> http://java.sun.com/j2se/1.5.0/docs/api/java/util/ResourceBundle.html
> and
> http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html
> 
> This way, your code may change from something like
> button.setText("Apply");
> to
> button.setText(bundle.getString("button.apply"));
> 
> And you will have a Strings.properties file that would contain,
> amongst other things,
> 
> button.apply = Apply
> 
> Then you might have one Strings_es_ES.properties file with Spanish
> strings, etc.
> 
>

Awesome!  Exactly what I was looking for!  TY!

Mark

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3072

From"tar" <tar@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
Message-ID<ymihch1y8i8.fsf@blackcat.isi.edu>
In reply to#3069
  To: comp.lang.java.gui
Mark <Mark.Fenbers@noaa.gov> writes:

> I was informed today that my Java program might be used in several other
> countries, including China, Romania, and some Spanish-speaking countries
> in South America.
>
> I haven't a clue what I should do to make my GUI internationalized.  I
> am seeking guidance on this...

You should also look at what support is available for
internationalization in your particular IDE.  For example, NetBeans has
tool support for internationalization.  I haven't tried them, but that
may certainly help you in automatically setting up the proper
infrastructure for the internationalization of the text.

> Say, to make the "File" menu and the "Edit" menu use different words
> depending on the Locale setting, would I have to create a lengthy
> if{}-else{} block to test for each Locale supported and return a
> translated String for each word?  If so, in my case with a lot of
> text/words, this would be extremely cumbersome and the code would
> probably triple in size.  It might be less tedious if I were to maintain
> multiple versions of the software (in each language).  Am I missing
> something?

You use properties files as Bent Dalager suggested.  It also makes it a
LOT easier to add additional languages, since only the property files
need to be handled by the translator, and not the entire code base.

This also helps in development, since it makes it simpler to change the
wording on buttons, prompts and message strings in response to user
feedback.

-- 
Thomas A. Russ,  USC/Information Sciences Institute

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3086

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
Message-ID<hmunp3t04ileb557q14c4a7965b2c644qa@4ax.com>
In reply to#3069
  To: comp.lang.java.gui
On Fri, 25 Jan 2008 10:42:40 -0500, Mark <Mark.Fenbers@noaa.gov>
wrote, quoted or indirectly quoted someone who said :

>
>I haven't a clue what I should do to make my GUI internationalized.  I 
>am seeking guidance on this...

see http://mindprod.com/jgloss/localisation.html
-- 
Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3087

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
Message-ID<qpunp3t20uv1jge10ki1h7rkn8a6i5tu22@4ax.com>
In reply to#3069
  To: comp.lang.java.gui
On Fri, 25 Jan 2008 10:42:40 -0500, Mark <Mark.Fenbers@noaa.gov>
wrote, quoted or indirectly quoted someone who said :

>I was informed today that my Java program might be used in several other 
>countries, including China, Romania, and some Spanish-speaking countries 
>in South America.

see http://mindprod.com/jgloss/resourcebundle.html
-- 
Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web