Loading...

Wednesday, June 10, 2009

Force specific locale when working with NetBeans

To my surprise some messages in the NetBeans 6.7 Release Candidate 2 IDE are translated into Dutch. But I want to use the US English locale, because I am used to the English terms.

We can force NetBeans into using a specific locale. First we must open netbeans.conf in the NETBEANS_INSTALL_DIR/etc directory. Then we look for the key netbeans_default_options. We add the following to the options to force NetBeans into using the US English locale:

-J-Duser.language=en -J-Duser.country=US

One of the blog commenters suggests an even easier method to force a specific locale: use the IDE startup parameter --locale. So if we start NetBeans with the following startup parameter we use the US English locale:

$ netbeans --locale en:US

4 comments:

Anonymous said...

Yup that's what it will do if you run the Dutch version of your OS ;)

Anonymous said...

I use "--locale en" that's easier and works too. Regards, Valle

mrhaki said...

--locale en is indeed even easier. I add this to the post as well.

H.-Dirk Schmitt said...

If you are working on shell level it may be a good idee to change the locale for the whole "develop & build" toolset.

For example you can use this snippet:
configure_locale ()
{
local profile=${1};
if test -z "${profile}"; then
if c42_UserAccount; then
profile="DE";
else
profile="EN";
fi;
fi;
case ${profile} in
DE)
LC_ALL="de_DE.UTF-8";
LANG="de_DE.UTF-8";
LANGUAGE="de_DE:de:en_GB:en"
;;
EN)
LC_ALL="en_US.UTF-8";
LANG="en_US.UTF-8";
LANGUAGE="en_US:en"
;;
*)
_message "ALERT" "${FUNCNAME}: unknown profile '${profile}'"
;;
esac;
LC_PAPER="de_DE.UTF-8";
LESSCHARSET="utf-8";
MM_CHARSET="utf-8";
_message "locale settings" "${LANG}";
export LC_ALL LANG LANGUAGE LC_PAPER LESSCHARSET MM_CHARSET
}

Post a Comment