• Post Reply Bookmark Topic Watch Topic
  • New Topic

locale in Unix  RSS feed

 
Paul Wetzel
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How/where does the jvm get its info to set the default locale in Unix? How should I set the default local in unix? When calling ther method that returns the local all that is coming back is "en" which means that when we display currency all we see is ¤.
thanks and I hope I haven't been to ambiguous
paul
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In UNIX the JVM gets the default locale from your current environment. Your box will have a default value set up, but you can change it in your environment. To find out what your current locale setting is, type:

To find out what different options you have available within NLS (Native Language Support) you should find some subdirectories in /usr/lib/nls/msg that relate to the different locales. To set your locale, you would set the environment variable 'LANG'. For example, the following will set the locale to France (example should run in the POSIX/korn/bourne shell):

To test that the locale is now France, type the 'locale' command again. After setting your 'LANG' environment variable try compiling and running the following java noddy program:

NLS implementations vary slightly between different vendor implementations; this is an example of using NLS under HP-UX 11. It should be similar with Solaris (I'll try it on a Solaris box later), and I haven't tested it with Linux (again, later).
If anyone knows differences in the way the locale is set between other different UNIX variants (eg. IRIX, Digital), please do post your findings.
Thanks
George
[This message has been edited by George Brown (edited October 20, 2000).]
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just checked, for Solaris 7 the different language msg subdirectories are in /usr/lib/locale and the Linux Mandrake distribution puts them in /usr/share/locale.
For both, the 'locale' binary is in /usr/bin.
Apart from those differences, they deal with locale in the same way (using 'LANG').
[This message has been edited by George Brown (edited October 21, 2000).]
 
Paul Wetzel
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks this info has been most helpful!
paul
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!