Internationalization
Spring Boot 支持本地化消息,以便你的应用程序可以满足不同语言偏好用户的需求。默认情况下,Spring Boot 在类路径的根目录处查找 messages
资源绑定的存在。
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.
自动配置在配置的资源绑定的默认属性文件可用时(默认情况下为 |
The auto-configuration applies when the default properties file for the configured resource bundle is available ( |
资源绑定的基本名称以及其他几个属性都可以使用 spring.messages
命名空间进行配置,如下例所示:
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:
spring: messages: basename: "messages,config.i18n.messages" fallback-to-system-locale: false
|
|
如需了解其他受支持的选项,请参见 {code-spring-boot-autoconfigure-src}/context/MessageSourceProperties.java[@16]。
See {code-spring-boot-autoconfigure-src}/context/MessageSourceProperties.java[MessageSourceProperties
] for more supported options.