spring-boot - spring-boot 和 thymeleaf 实现中的国际化
问题描述
我正在尝试在 spring-boot 和 thymeleaf 项目中实现国际化,但没有得到预期的结果。 这是当前结果
在下面提供了我的代码和属性文件内容。我的属性文件路径是:src/main/resources
感谢您对此的指导。谢谢你。
HTML 代码:
<body>
<h1 th:text="#{index.title}">Library</h1>
<a th:href="@{/books.html}" href="#" th:text="#{index.books.link}">List of books</a>
</body>
messages_zh_CN.properties
main.title=Spring Boot Recipes - 图书馆
index.title=图书馆
index.books.link=图书列表
books.list.title=可用图书
books.list.table.title=标题
books.list.table.author=作者
books.list.table.isbn=ISBN
消息属性
main.title=Spring Boot Recipes - Library
index.title=Library
index.books.link=List of books
books.list.title=Available Books
books.list.table.title=Title
books.list.table.author=Author
books.list.table.isbn=ISBN
解决方案
推荐阅读
- javascript - SOAP API 调用 Javascript 期间的 Async/Await 问题
- npm - 运行 D:\fyp sumreen\marketplace\truffle-config.js 时出错!你忘了`npm install`你的项目吗?
- asp.net-core - 代表来自 SPA 的用户从 ASP.Net Core API 调用 Graph API
- angular - 当尝试添加确认邮件功能组时得到错误预期1-2个参数但得到3.ts(2554)?
- concurrency - 如何证明并发对象是可线性化的?
- python - 这是 Keras Sequential 模型学习吗?
- css - SCSS - nth-child(2) 影响所有后代
- spring-boot - 如何在springboot中使用RestTemplate将参数作为post传递给端点?
- javascript - 如果单击提交按钮时输入字段中未写入特定数字,如何发出警报
- javascript - 按顺序将动态创建的文本框值存储在 javascript 数组中