rendon
rendon

Reputation: 2363

How to set current locale in Intellij IDEA when using GUI designer?

I am developing an application in Java with internationalization support with IntelliJ IDEA 12. So far I have been coding all by hand, but today I started using the GUI designer to accelerate the work. I use this lines to setup the application language:

currentLocale = new Locale("es", "MX");
messages = ResourceBundle.getBundle("Messages", currentLocale);

But now I can't find how to specify the currentLocale in the GUI designer. The code generator tries to load the language for the application, but it doesn't specify the locale:

this.$$$loadButtonText$$$(buttonOK, ResourceBundle.getBundle("Messages").getString("General.ok"));

Somebody know how to solve this?

Upvotes: 2

Views: 3377

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 401995

You can't specify it in the GUI Designer, locale should be specified in your application code, like this:

Locale.setDefault(new Locale(...));

Forms created with the UI designer will always use the default locale, to make the language configurable in your app you will need to write the code that will change the default locale depending on the user preference.

Upvotes: 4

Related Questions