The method now checks this locale against the locales which are available for the user, and eventually picks up a new one if the preferences locale is avaiable in ACls. Without this, the user could have an unaccessible PIM. This is why it now returns a full Locale object.

There were very few calls to this method in the code, and they were all corrected. We could add a shortcut method getUserLocaleCode if deemed necessary.