From 989ac08f34651712833b5446de9b30de0de3ec6f Mon Sep 17 00:00:00 2001 From: Kedar Joshi Date: Sat, 9 Feb 2019 00:39:05 +0530 Subject: [PATCH 1/2] Document internationalization support See gh-15881 --- .../main/asciidoc/spring-boot-features.adoc | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 83a3013396d..55dbde72de7 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -8387,6 +8387,32 @@ Boot's core features will be honoured by the presence of the core starter. +[[boot-features-internationalization]] +== Internationalization +Spring Boot supports localized messages so that your application can cater to users +of different language preferences. By default, Spring Boot looks for `messages.properties` +or its language and locale specific equivalent in applications context path +e.g. `messages_en_US.properties` for US English and so on. + +You can set `spring.messages.basename` property to configure custom locations for +these files. `spring.messages` namespace provides additional options to be set according +to application requirements as shown below - + +[source,properties,indent=0] +---- + spring.messages.basename = config.i18n.messages + spring.messages.fallback-to-system-locale = false + spring.messages.encoding = utf-8 + spring.messages.cache-duration = 30m + spring.messages.always-use-message-format = false + spring.messages.use-code-as-default-message = true +---- + +TIP: `spring.messages.basename` supports comma-separated list of locations (essentially +a fully-qualified classpath location) for configuring multiple message sources. + + + [[boot-features-kotlin]] == Kotlin support https://kotlinlang.org[Kotlin] is a statically-typed language targeting the JVM (and other From 4469c46b0a1d874898e9ce7b397945a335b13914 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 12 Feb 2019 13:31:38 +0100 Subject: [PATCH 2/2] Polish "Document internationalization support" Closes gh-15881 --- .../main/asciidoc/spring-boot-features.adoc | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 55dbde72de7..ef174809541 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -2005,6 +2005,35 @@ However, properties can be added to the `Environment` by using the relaxed rules +[[boot-features-internationalization]] +== Internationalization +Spring Boot supports localized messages so that your application can cater to users +of different language preferences. By default, Spring Boot looks for the presence of +a `messages` resource bundle at the root of the classpath. + +NOTE: The auto-configuration applies when the default properties file for the configured +resource bundle is available (i.e. `messages.properties` by default). If your resource +bundle contains only language-specific properties files, you are required to add the +default. + +The basename of the resource bundle as well as several other attributes can be configured +using the `spring.messages` namespace, as shown in the following example: + +[source,properties,indent=0] +---- + spring.messages.basename=messages,config.i18n.messages + spring.messages.fallback-to-system-locale=false +---- + +TIP: `spring.messages.basename` supports comma-separated list of locations, either a +package qualifier or a resource resolved from the classpath root. + +See {sc-spring-boot-autoconfigure}/context/MessageSourceProperties.{sc-ext}[ +`MessageSourceProperties`] for more supported options. + + + + [[boot-features-json]] == JSON Spring Boot provides integration with three JSON mapping libraries: @@ -8387,32 +8416,6 @@ Boot's core features will be honoured by the presence of the core starter. -[[boot-features-internationalization]] -== Internationalization -Spring Boot supports localized messages so that your application can cater to users -of different language preferences. By default, Spring Boot looks for `messages.properties` -or its language and locale specific equivalent in applications context path -e.g. `messages_en_US.properties` for US English and so on. - -You can set `spring.messages.basename` property to configure custom locations for -these files. `spring.messages` namespace provides additional options to be set according -to application requirements as shown below - - -[source,properties,indent=0] ----- - spring.messages.basename = config.i18n.messages - spring.messages.fallback-to-system-locale = false - spring.messages.encoding = utf-8 - spring.messages.cache-duration = 30m - spring.messages.always-use-message-format = false - spring.messages.use-code-as-default-message = true ----- - -TIP: `spring.messages.basename` supports comma-separated list of locations (essentially -a fully-qualified classpath location) for configuring multiple message sources. - - - [[boot-features-kotlin]] == Kotlin support https://kotlinlang.org[Kotlin] is a statically-typed language targeting the JVM (and other