本文章主要分为两个部分:
- freemarker的国际化相关配置
- Spring Boot的国际化相关配置
freemarker国际化配置
页面模板
使用.ftl文件作为静态化模板,这里不多做解释,这里主要说明国际化所需配置
<!-- 1.国际化添加导入 -->
<#import "/spring.ftl" as spring/>
<#include "/admin/utils/ui.ftl"/>
<@layout>
<div class="table-responsive">
<table id="dataGrid" class="table table-striped table-bordered">
<thead>
<tr>
<th width="80">#</th>
<!-- 2.使用freemarker的标签引入国际化信息,code为Bundle文件中配置的key -->
<th><@spring.message code='user.username'/></th