Getting OS language in java

后端 未结 3 1242
-上瘾入骨i
-上瘾入骨i 2021-01-05 09:45

I\'m running into a kind of problem here.

I\'m French and working on an English version of Windows XP. Therefore, I set the regional options to French, but still hav

3条回答
  •  太阳男子
    2021-01-05 10:24

    I tried a few things thanks to your suggestions, and here is my observation :

    • If you are using Java 6, and not Java 7, you are f***ed.
    • If you are using Java 7, you should do as BalusC tells : change the setting in Region and Language Settings. After that, Locale.getDefault() will by default return the display language, meaning English if you set it to English. To make sure of it, you can create you locale by calling Locale.getDefault(Locale.Category.DISPLAY)

提交回复
热议问题