--- a/src/main/kotlin/de/uapcore/lightpit/AbstractServlet.kt Mon Aug 02 17:04:17 2021 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/AbstractServlet.kt Tue Aug 03 12:22:10 2021 +0200 @@ -104,6 +104,7 @@ val reqLocale = req.locale val sessionLocale = if (availableLanguages.contains(reqLocale)) reqLocale else availableLanguages.first() session.setAttribute(Constants.SESSION_ATTR_LANGUAGE, sessionLocale) + resp.locale = sessionLocale logger().debug( "Setting language for new session {}: {}", session.id, sessionLocale.displayLanguage ) @@ -176,7 +177,7 @@ protected fun availableLanguages(): List<Locale> { val langTags = servletContext.getInitParameter(Constants.CTX_ATTR_LANGUAGES)?.split(",")?.map(String::trim) ?: emptyList() val locales = langTags.map(Locale::forLanguageTag).filter { it.language.isNotEmpty() } - return if (locales.isEmpty()) listOf(Locale.ENGLISH) else locales + return locales.ifEmpty { listOf(Locale.ENGLISH) } } }