setLocale method

void setLocale(
  1. ForceRequest request,
  2. Intl locale
)
override

Set the current locale to the given one. @param request the request to be used for locale modification @param locale the new locale, or null to clear the locale @throws UnsupportedOperationException if the LocaleResolver implementation does not support dynamic changing of the theme

Implementation

void setLocale(ForceRequest request, Intl locale) {
  if (locale != null) {
    cookieManager.addCookie(request.request.response, locale.toString());
  } else {
        // Set request attribute to fallback locale and remove cookie.
    cookieManager.removeCookie(request.request.response);
  }
}