knowing the language of the system
hi,
i'm from belgium and we are making an app that will be used in the whole country. For those who don't know this, we have 3 languages, dutch, french, german. For the moment the user can change the language in the program and it works fine. But now i should want to make the login screen also internationalized, and here's my problem. I used the Locale.getDefault() and i always gets en, US. I have read something about setting the users language while starting java, but i don't want to do this. What i want is to know from the system (windows...) in what language the user uses his menus and so. As you know you can set that in the configuration screen of windows with country's or something. Then i could create the new locale with that info so it is already i18ned. I know it 's not so platformindepent, but the program will only run on windows.
Can anybody help me,
Thx in advance
Tom
[928 byte] By [
soulgoda] at [2007-10-1 6:07:46]

Java should be taking the initial default locale from the host OS. -- check the locale of the Windows session from the control panel [see: Control Panel -> Regional Options -> General tab -> "Your locale (location)"].
If it is not, then you have a problem! (Maybe other settings are being used to override the system locale for menus etc?).
For example, this system (Win2K) the Windows session is 'English (United Kingdom)'; Java's default locale gives the same.
According to Java 5's supported locales list, locales "nl_BE" and "fr_BE" are provided (untested), but there is no implicit support for "de_BE" (it should just default to "de").
htx for the answer, i thought that it should be that way, but when i debug the app (i put a Locale when i start the program) and i use Locale.getDefault() and i put a watch on it , it gives me en, US. It is strange, ....
Something setting the default locale somewhere?
Have you tried a really simple test class? For example:
public class TestLocale
{
public static void main (String[] args)
{
System.out.println (java.util.Locale.getDefault ().getDisplayName ());
}
}
That should return the host session locale. If this gives what you expect, then something else in your app is setting the locale. Grep through all the source for 'setDefault' maybe...