@Override
    public boolean preHandle(final HttpServletRequest request,
                             @Nonnull final HttpServletResponse response,
                             @Nonnull final Object handler) {
        val requestUrl = request.getRequestURL().toString();
        if (casProperties.getObject().getLocale().isForceDefaultLocale()) {
            val locale = Locale.forLanguageTag(casProperties.getObject().getLocale().getDefaultValue());
            configureLocale(request, response, locale);
            return true;
        }
        val service = argumentExtractor.getObject().extractService(request);
        if (service != null) {
            val registeredService = servicesManager.getObject().findServiceBy(service);
            if (registeredService instanceof final WebBasedRegisteredService webRegisteredService
                && StringUtils.isNotBlank(webRegisteredService.getLocale())) {
                val locale = Locale.forLanguageTag(SpringExpressionLanguageValueResolver.getInstance()
                    .resolve(webRegisteredService.getLocale()));
                configureLocale(request, response, locale);
            }
        }

        var newLocale = request.getParameter(getParamName());
        if (newLocale != null) {
            newLocale = newLocale.replace('_', '-');
            val locale = Locale.forLanguageTag(newLocale);
            configureLocale(request, response, locale);
        }

        if (request.getLocale() != null && isLocaleConfigured(request)) {
            val match = supportedFlows.stream().anyMatch(flowId -> requestUrl.contains('/' + flowId));
            if (match) {
                val locale = RequestContextUtils.getLocale(request);
                configureLocale(request, response, locale);
            }
        }
        return true;
    }
Configure locale.

@param request  the request
@param response the response
@param locale   the locale
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/CasLocaleChangeInterceptor.java