mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
Change default language to en-US and add US language (#6621)
This commit is contained in:
@@ -37,8 +37,8 @@ public class LocaleConfiguration implements WebMvcConfigurer {
|
||||
public LocaleResolver localeResolver() {
|
||||
SessionLocaleResolver slr = new SessionLocaleResolver();
|
||||
String appLocaleEnv = applicationProperties.getSystem().getDefaultLocale();
|
||||
Locale defaultLocale = // Fallback to UK locale if environment variable is not set
|
||||
Locale.UK;
|
||||
Locale defaultLocale = // Fallback to US locale if environment variable is not set
|
||||
Locale.US;
|
||||
if (appLocaleEnv != null && !appLocaleEnv.isEmpty()) {
|
||||
Locale tempLocale = Locale.forLanguageTag(appLocaleEnv);
|
||||
String tempLanguageTag = tempLocale.toLanguageTag();
|
||||
@@ -51,7 +51,7 @@ public class LocaleConfiguration implements WebMvcConfigurer {
|
||||
defaultLocale = tempLocale;
|
||||
} else {
|
||||
System.err.println(
|
||||
"Invalid SYSTEM_DEFAULTLOCALE environment variable value. Falling back to default en-GB.");
|
||||
"Invalid SYSTEM_DEFAULTLOCALE environment variable value. Falling back to default en-US.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class AdditionalLanguageJsController {
|
||||
}
|
||||
}
|
||||
// Fallback
|
||||
return "en_GB";
|
||||
return "en_US";
|
||||
}
|
||||
""");
|
||||
writer.flush();
|
||||
|
||||
@@ -167,7 +167,7 @@ legal:
|
||||
impressum: "" # URL to the impressum of your application (e.g. https://example.com/impressum). Empty string to disable or filename to load from local file in static folder
|
||||
|
||||
system:
|
||||
defaultLocale: en-US # set the default language (e.g. 'de-DE', 'fr-FR', etc)
|
||||
defaultLocale: "" # force a default language for new users (e.g. 'en-US', 'de-DE'). Empty string auto-detects from the browser, falling back to en-US
|
||||
googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow
|
||||
enableAlphaFunctionality: false # set to enable functionality which might need more testing before it fully goes live (this feature might make no changes)
|
||||
showUpdate: false # see when a new update is available
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@ class AdditionalLanguageJsControllerTest {
|
||||
LanguageService lang = mock(LanguageService.class);
|
||||
// LinkedHashSet for deterministic order in the array
|
||||
when(lang.getSupportedLanguages())
|
||||
.thenReturn(new LinkedHashSet<>(List.of("de_DE", "en_GB")));
|
||||
.thenReturn(new LinkedHashSet<>(List.of("de_DE", "en_US")));
|
||||
|
||||
MockMvc mvc =
|
||||
MockMvcBuilders.standaloneSetup(new AdditionalLanguageJsController(lang)).build();
|
||||
@@ -36,9 +36,9 @@ class AdditionalLanguageJsControllerTest {
|
||||
.string(
|
||||
containsString(
|
||||
"const supportedLanguages ="
|
||||
+ " [\"de_DE\",\"en_GB\"];")))
|
||||
+ " [\"de_DE\",\"en_US\"];")))
|
||||
.andExpect(content().string(containsString("function getDetailedLanguageCode()")))
|
||||
.andExpect(content().string(containsString("return \"en_GB\";")));
|
||||
.andExpect(content().string(containsString("return \"en_US\";")));
|
||||
|
||||
verify(lang, times(1)).getSupportedLanguages();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user