I have a java application with multi-language support. When I change the language (in a preferences dialog), the language of the entire application changes, including the language of Swing components like JFileChooser
. That is working perfect for English, Spanish and French. But when I choose Dutch, the language of Swing components (JFileChooser
, confirm dialogs, etc.) changes to English.
Below is the code that changes the language to Dutch. Remark: for the other languages I use the same code (except for the "NL"
string, of course) and it works fine.
Locale locale = new Locale("nl");
Locale.setDefault(locale);
JComponent.setDefaultLocale(locale);
I also tried creating the locale using new Locale("nl", "BE");
and new Locale("nl", "NL");
but none of them worked. Is there a problem with the Dutch locale? Or am I doing something wrong here?
As stated here Dutch is not supported for User Interface Translations:
User Interface Translation Java SE Runtime Environment The user interface elements provided by the Java SE Runtime Environment 6, include Swing dialogs, messages written by the runtime environment to the standard output and standard error streams, as well as messages produced by the tools provided with the JRE. These user interface elements are localized into the following languages:
Language Locale ID
Chinese (Simplified) zh_CN
Chinese (Traditional) zh_TW
English en
French fr
German de
Italian it
Japanese ja
Korean ko
Portuguese (Brazilian) pt_BR
Spanish es
Swedish sv
Some years to late... But you can also create a wrapper class like this
public class DutchLocale {
static public final Locale NL = new Locale("nl", "NL");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With