From e5990dba81a4d5e043c467f88d68943293226bea Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:31:42 +0100 Subject: [PATCH] Update Beans.java --- .../java/stirling/software/SPDF/config/Beans.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/config/Beans.java b/src/main/java/stirling/software/SPDF/config/Beans.java index e6b17a90..7a963ba4 100644 --- a/src/main/java/stirling/software/SPDF/config/Beans.java +++ b/src/main/java/stirling/software/SPDF/config/Beans.java @@ -39,10 +39,17 @@ public class Beans implements WebMvcConfigurer { Locale tempLocale = Locale.forLanguageTag(appLocaleEnv); String tempLanguageTag = tempLocale.toLanguageTag(); - if (appLocaleEnv.equalsIgnoreCase(tempLanguageTag)) { + if (appLocaleEnv.equalsIgnoreCase(tempLanguageTag)) { defaultLocale = tempLocale; } else { - System.err.println("Invalid APP_LOCALE environment variable value. Falling back to default Locale.UK."); + tempLocale = Locale.forLanguageTag(appLocaleEnv.replace("_","-")); + tempLanguageTag = tempLocale.toLanguageTag(); + + if (appLocaleEnv.equalsIgnoreCase(tempLanguageTag)) { + defaultLocale = tempLocale; + } else { + System.err.println("Invalid APP_LOCALE environment variable value. Falling back to default Locale.UK."); + } } }