* @param request
* @param localeString
*/
public void updateUserLocale(HttpServletRequest request, String localeString) {
IUserInstance ui = userInstanceManager.getUserInstance(request);
IUserPreferencesManager upm = ui.getPreferencesManager();
final IUserProfile userProfile = upm.getUserProfile();
LocaleManager localeManager = userProfile.getLocaleManager();
if (localeString != null) {
// build a new Locale[] array from the specified locale
Locale userLocale = parseLocale(localeString);
Locale[] locales = new Locale[] { userLocale };
// set this locale in the session
localeManager.setSessionLocales(locales);
// if the current user is logged in, also update the persisted
// user locale
final IPerson person = ui.getPerson();
if (!person.isGuest()) {
try {
localeManager.persistUserLocales(new Locale[] { userLocale });
localeStore.updateUserLocales(person, new Locale[] { userLocale });