0

I am testing language settings with an application running on Java 8. Specifically I am interested in locale settings.

Currently a test for Spanish is required. Since I use Windows 10 I did the following:

  • Under Control Panel > Region I set all settings to Spanish, including the system configuration, without checking the box to use UTF-8 encode for compatibility
  • In Win10 settings I set the UI language to Spanish and signed out, then signed back, so that my Win10 UI is now in Spanish.
  • The region in those same settings is also set to Spanish
  • The keyboard layout, that can be selected in the task bar, is also set to ESP.
  • After doing all that I also restarted my system.

Everything that I was able to find via non-registry system configuration is now set to Spanish. Yet the Java call Locale.getDefault().getLanguage() reliably continues to deliver en.

Where does it get that from? Do I have to read system properties to retrieve the information, that my system runs in fact in Spanish? What is Locale.getDefault() even for then?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Koenigsberg
  • 1,726
  • 1
  • 10
  • 22
  • Have you checked the origin of the default locale described in the answer to https://stackoverflow.com/questions/8809098/how-do-i-set-the-default-locale-for-my-jvm ? – Smutje Apr 29 '19 at 09:03
  • `Locale::setDefault` may be? – Eugene Apr 29 '19 at 09:04
  • I already checked `setLocale`, but there is no such call in the application. W.r.t. to @Smutje: I am aware of those properties, however with regard to the JVM - is its locale setting done only once or when first running it after booting? If the latter, then this should have been resolved by reboot I suppose. – Koenigsberg Apr 29 '19 at 09:06
  • `Locale spanish = new Locale("es", "ES"); Locale.setDefault(spanish);` – corroborator Apr 29 '19 at 09:11
  • 1
    I do not want to set a default locale, I want to read the system locale and to find out what exactly `Locale.getDefault()` returns me. – Koenigsberg Apr 29 '19 at 09:14

0 Answers0