在springboot中与Thymeleaf进行整合时,进行国际化的支持。
配置好Thymeleaf依赖后,在resources目录中创建文件夹:
然后在springboot的配置文件中配置属性项:
spring.messages.basename=i18n/home
然后在各个properties文件中写入内容:
home.welcome= 欢迎来到我的首页
最后在HTML页面中:
<a th:text="#{home.welcome}">hello</a>
在springboot中与Thymeleaf进行整合时,进行国际化的支持。
配置好Thymeleaf依赖后,在resources目录中创建文件夹:
然后在springboot的配置文件中配置属性项:
spring.messages.basename=i18n/home
然后在各个properties文件中写入内容:
home.welcome= 欢迎来到我的首页
最后在HTML页面中:
<a th:text="#{home.welcome}">hello</a>