diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/LocaleProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/LocaleProcessor.java index ef44b09da972c..ba3062e7ae52e 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/LocaleProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/LocaleProcessor.java @@ -116,7 +116,7 @@ public boolean getAsBoolean() { */ @Deprecated public static String nativeImageUserLanguage(NativeConfig nativeConfig, LocalesBuildTimeConfig localesBuildTimeConfig) { - String language = LocalesBuildTimeConfig.DEFAULT_LANGUAGE; + String language = System.getProperty("user.language", "en"); if (localesBuildTimeConfig.defaultLocale.isPresent()) { language = localesBuildTimeConfig.defaultLocale.get().getLanguage(); } @@ -140,7 +140,7 @@ public static String nativeImageUserLanguage(NativeConfig nativeConfig, LocalesB */ @Deprecated public static String nativeImageUserCountry(NativeConfig nativeConfig, LocalesBuildTimeConfig localesBuildTimeConfig) { - String country = LocalesBuildTimeConfig.DEFAULT_COUNTRY; + String country = System.getProperty("user.country", ""); if (localesBuildTimeConfig.defaultLocale.isPresent()) { country = localesBuildTimeConfig.defaultLocale.get().getCountry(); } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java index bd1c13c911eb0..057d5d3ee9c02 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java @@ -93,6 +93,7 @@ public void write(String s, byte[] bytes) { overallCatch.invokeStaticMethod(BUILD_TIME_INITIALIZATION, overallCatch.marshalAsArray(String.class, overallCatch.load(""))); // empty string means initialize everything + // Set the user.language and user.country system properties to the default locale // The deprecated option takes precedence for users who are already using it. if (nativeConfig.userLanguage().isPresent()) { overallCatch.invokeStaticMethod(REGISTER_RUNTIME_SYSTEM_PROPERTIES, diff --git a/core/runtime/src/main/java/io/quarkus/runtime/LocalesBuildTimeConfig.java b/core/runtime/src/main/java/io/quarkus/runtime/LocalesBuildTimeConfig.java index e3d1bfc077544..fc8f25524c339 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/LocalesBuildTimeConfig.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/LocalesBuildTimeConfig.java @@ -51,6 +51,7 @@ public class LocalesBuildTimeConfig { * Defaults to the JVM's default locale if not set. Starting with GraalVM for JDK 24, it defaults to {@code en-US} * for native executables. */ - @ConfigItem(defaultValue = DEFAULT_LANGUAGE + "-" + DEFAULT_COUNTRY, defaultValueDocumentation = "Build system locale") + @ConfigItem(defaultValueDocumentation = "Defaults to the JVM's default locale if not set. " + + "Starting with GraalVM for JDK 24, it defaults to en-US for native executables.") public Optional defaultLocale; }