Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JComponent.setDefaultLocale doesn't work  RSS feed

Korol Bloom
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My application includes internationalization support for several languages. At startup, I read the system property "user.language" to get the user's default language. That works fine.
I also have a button, where one can change the language. Changing language means, another bundle is loaded. That also works fine.
For several dialogs I use JOptionPane.showInputDialog() and other methods from the same class. The words at the buttons (like "ok", "cancel") should be displayed according to the user's language choice. But they are not, that is my problem.
I tried JComponent.setDefaultLocale(locale) and that works fine for eg Locale.JAPANESE or Locale.FRENCH. But if I change to LOCALE.ENGLISH or .US or .UK, I still get the buttons shown in my default locale, which is GERMAN. Why that?
I also tried System.setProperty("user.language", "en"), but this makes no difference. Anybody knows this phenomenon? Or have an idea for a workaround?
, korol
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!