public function switchToUILocale($reset = false)
    {
        if ($reset === true) {
            // Reset the locale
            $this->i18nService->getConfiguration()->setCurrentLocale($this->rememberedContentLocale);
        } else {
            $this->rememberedContentLocale = $this->i18nService->getConfiguration()->getCurrentLocale();
            $userLocalePreference = ($this->userService->getCurrentUser() ? $this->userService->getCurrentUser()->getPreferences()->getInterfaceLanguage() : null);
            $defaultLocale = $this->i18nService->getConfiguration()->getDefaultLocale();
            $userLocale = $userLocalePreference ? new Locale($userLocalePreference) : $defaultLocale;
            $this->i18nService->getConfiguration()->setCurrentLocale($userLocale);
        }
    }
public function switchToUILocale($reset = false)
    {
        if ($reset === true) {
            // Reset the locale
            $this->i18nService->getConfiguration()->setCurrentLocale($this->rememberedContentLocale);
        } else {
            $this->rememberedContentLocale = $this->i18nService->getConfiguration()->getCurrentLocale();
            $userLocalePreference = ($this->userService->getCurrentUser() ? $this->userService->getCurrentUser()->getPreferences()->getInterfaceLanguage() : null);
            $defaultLocale = $this->i18nService->getConfiguration()->getDefaultLocale();
            $userLocale = $userLocalePreference ? new Locale($userLocalePreference) : $defaultLocale;
            $this->i18nService->getConfiguration()->setCurrentLocale($userLocale);
        }
    }
public function switchToUILocale ( $ reset = false ) { if ( $ reset === true ) { // Reset the locale $ this -> i18nService -> getConfiguration ( ) -> setCurrentLocale ( $ this -> rememberedContentLocale ) ; } else { $ this -> rememberedContentLocale = $ this -> i18nService -> getConfiguration ( ) -> getCurrentLocale ( ) ; $ userLocalePreference = ( $ this -> userService -> getCurrentUser ( ) ? $ this -> userService -> getCurrentUser ( ) -> getPreferences ( ) -> getInterfaceLanguage ( ) : null ) ; $ defaultLocale = $ this -> i18nService -> getConfiguration ( ) -> getDefaultLocale ( ) ; $ userLocale = $ userLocalePreference ? new Locale ( $ userLocalePreference ) : $ defaultLocale ; $ this -> i18nService -> getConfiguration ( ) -> setCurrentLocale ( $ userLocale ) ; } }
For serialization, we need to respect the UI locale, rather than the content locale

@param boolean $reset Reset to remebered locale
For serialization we need to respect the UI locale rather than the content locale