Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
西魏
cms_sys
Commits
1a86f88b
Commit
1a86f88b
authored
Sep 18, 2020
by
sgjj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加国际化
parent
d4b7b2b8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
406 additions
and
0 deletions
+406
-0
I18NConfig.java
src/main/java/net/mingsoft/config/I18NConfig.java
+31
-0
application.yml
src/main/resources/application.yml
+3
-0
local.ftl
src/main/webapp/WEB-INF/manager/include/local.ftl
+40
-0
en_US.js
src/main/webapp/static/locale/lang/base/en_US.js
+26
-0
zh_CN.js
src/main/webapp/static/locale/lang/base/zh_CN.js
+26
-0
en_US.js
...n/webapp/static/plugins/element-ui/2.13.0/locale/en_US.js
+140
-0
zh_CN.js
...n/webapp/static/plugins/element-ui/2.13.0/locale/zh_CN.js
+140
-0
No files found.
src/main/java/net/mingsoft/config/I18NConfig.java
0 → 100644
View file @
1a86f88b
package
net
.
mingsoft
.
config
;
import
com.jagregory.shiro.freemarker.ShiroTags
;
import
freemarker.template.TemplateException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.PostConstruct
;
import
java.io.IOException
;
/**
* 读取国际化配置,传递给freemker
*/
@Configuration
public
class
I18NConfig
{
@Autowired
protected
freemarker
.
template
.
Configuration
configuration
;
@Value
(
"${ms.local.default:zh_CN}"
)
private
String
defaultLocal
;
@Value
(
"${ms.local.messages:zh_CN,en_US}"
)
private
String
messages
;
@PostConstruct
public
void
init
()
throws
IOException
,
TemplateException
{
configuration
.
setSharedVariable
(
"localDefault"
,
defaultLocal
);
configuration
.
setSharedVariable
(
"localMessages"
,
messages
.
split
(
","
));
}
}
src/main/resources/application.yml
View file @
1a86f88b
...
...
@@ -13,6 +13,9 @@ logging:
path
:
log
#会在项目的根目录下生成log目录,里面会生成对应的日期目录,日期目录下面生成日志压缩包备份文件,默认按每10M分割一个日志文件,例如:log/2020-01/app-2020-01-03-18.1.log.gz(表示2020年1月3号下午六点的第一个备份),也可以根据实际情况写绝对路径,例如:d:/log
ms
:
local
:
default
:
zh_CN
#默认语言
messages
:
zh_CN,en_US
#全部语言
# scheme: https #解决使用代理服务器代理应用时标签解析域名依旧为http的问题
swagger
:
enable
:
true
#启用swagger文档,生产的时候务必关掉
...
...
src/main/webapp/WEB-INF/manager/include/local.ftl
0 → 100644
View file @
1a86f88b
<#list localMessages as item>
<script src="${base}/static/locale/lang/${modeldir}/${item}.js"></script>
</#list>
<script>
(function(window) {
var defaultLocal = '${localDefault}' //默认语言
var localeMessage = [] //添加语言
<#list localMessages as item>
localeMessage.push('${item}')
</#list>
window.indexlocale = {
language:defaultLocal
}
//获取后台index的语言
if(parent!=null&&parent.indexVue!=undefined&&parent.indexVue.locale!=undefined){
window.indexlocale = parent.indexVue.locale
}
window.i18n = new VueI18n({
locale: window.indexlocale.language, // 设置地区
fallbackLocale: defaultLocal,
})
//加载语言
localeMessage.forEach(function (value) {
if(window[value]!=undefined){
var message = window[value]
if(window['base_'+value]!=undefined){
message = Object.assign({},message,window['base_'+value])
}
i18n.setLocaleMessage(value,message)
}
})
var localElement = i18n.getLocaleMessage(i18n.locale)
if(Object.keys(localElement).indexOf("el")!=-1){
ELEMENT.locale(localElement)
}
})(window);
</script>
\ No newline at end of file
src/main/webapp/static/locale/lang/base/en_US.js
0 → 100644
View file @
1a86f88b
var
base_en_US
=
{
base
:{
operate
:{
save
:
'save'
,
back
:
'back'
,
edit
:
'edit'
,
back
:
'back'
,
cancel
:
'cancel'
,
del
:
'del'
,
rest
:
'rest'
,
search
:
'search'
,
filter
:
'filter'
,
action
:
'action'
,
confirm
:
'confirm'
},
message
:{
success
:
'success'
,
tip
:
'tip'
,
confirmdel
:
'This operation will permanently delete the selection. Do you want to continue'
,
empty
:
'empty'
,
exist
:
'exist'
,
fail
:
'fail'
,
}
}
}
Object
.
assign
(
base_en_US
,
ELEMENT
.
lang
.
en
)
src/main/webapp/static/locale/lang/base/zh_CN.js
0 → 100644
View file @
1a86f88b
var
base_zh_CN
=
{
base
:{
operate
:{
add
:
'新增'
,
save
:
'保存'
,
edit
:
'编辑'
,
back
:
'返回'
,
cancel
:
'取消'
,
del
:
'删除'
,
rest
:
'重置'
,
search
:
'查询'
,
filter
:
'塞选'
,
action
:
'操作'
,
confirm
:
'确定'
},
message
:{
success
:
'成功'
,
tip
:
'提示'
,
confirmdel
:
'此操作将永久删除所选内容, 是否继续'
,
empty
:
'暂无数据'
,
exist
:
'已存在'
,
fail
:
'失败'
,
}
}
}
Object
.
assign
(
base_zh_CN
,
ELEMENT
.
lang
.
zhCN
)
src/main/webapp/static/plugins/element-ui/2.13.0/locale/en_US.js
0 → 100644
View file @
1a86f88b
(
function
(
global
,
factory
)
{
if
(
typeof
define
===
"function"
&&
define
.
amd
)
{
define
(
'element/locale/en'
,
[
'module'
,
'exports'
],
factory
);
}
else
if
(
typeof
exports
!==
"undefined"
)
{
factory
(
module
,
exports
);
}
else
{
var
mod
=
{
exports
:
{}
};
factory
(
mod
,
mod
.
exports
);
global
.
ELEMENT
.
lang
=
global
.
ELEMENT
.
lang
||
{};
global
.
ELEMENT
.
lang
.
en
=
mod
.
exports
;
}
})(
this
,
function
(
module
,
exports
)
{
'use strict'
;
exports
.
__esModule
=
true
;
exports
.
default
=
{
el
:
{
colorpicker
:
{
confirm
:
'OK'
,
clear
:
'Clear'
},
datepicker
:
{
now
:
'Now'
,
today
:
'Today'
,
cancel
:
'Cancel'
,
clear
:
'Clear'
,
confirm
:
'OK'
,
selectDate
:
'Select date'
,
selectTime
:
'Select time'
,
startDate
:
'Start Date'
,
startTime
:
'Start Time'
,
endDate
:
'End Date'
,
endTime
:
'End Time'
,
prevYear
:
'Previous Year'
,
nextYear
:
'Next Year'
,
prevMonth
:
'Previous Month'
,
nextMonth
:
'Next Month'
,
year
:
''
,
month1
:
'January'
,
month2
:
'February'
,
month3
:
'March'
,
month4
:
'April'
,
month5
:
'May'
,
month6
:
'June'
,
month7
:
'July'
,
month8
:
'August'
,
month9
:
'September'
,
month10
:
'October'
,
month11
:
'November'
,
month12
:
'December'
,
week
:
'week'
,
weeks
:
{
sun
:
'Sun'
,
mon
:
'Mon'
,
tue
:
'Tue'
,
wed
:
'Wed'
,
thu
:
'Thu'
,
fri
:
'Fri'
,
sat
:
'Sat'
},
months
:
{
jan
:
'Jan'
,
feb
:
'Feb'
,
mar
:
'Mar'
,
apr
:
'Apr'
,
may
:
'May'
,
jun
:
'Jun'
,
jul
:
'Jul'
,
aug
:
'Aug'
,
sep
:
'Sep'
,
oct
:
'Oct'
,
nov
:
'Nov'
,
dec
:
'Dec'
}
},
select
:
{
loading
:
'Loading'
,
noMatch
:
'No matching data'
,
noData
:
'No data'
,
placeholder
:
'Select'
},
cascader
:
{
noMatch
:
'No matching data'
,
loading
:
'Loading'
,
placeholder
:
'Select'
,
noData
:
'No data'
},
pagination
:
{
goto
:
'Go to'
,
pagesize
:
'/page'
,
total
:
'Total {total}'
,
pageClassifier
:
''
},
messagebox
:
{
title
:
'Message'
,
confirm
:
'OK'
,
cancel
:
'Cancel'
,
error
:
'Illegal input'
},
upload
:
{
deleteTip
:
'press delete to remove'
,
delete
:
'Delete'
,
preview
:
'Preview'
,
continue
:
'Continue'
},
table
:
{
emptyText
:
'No Data'
,
confirmFilter
:
'Confirm'
,
resetFilter
:
'Reset'
,
clearFilter
:
'All'
,
sumText
:
'Sum'
},
tree
:
{
emptyText
:
'No Data'
},
transfer
:
{
noMatch
:
'No matching data'
,
noData
:
'No data'
,
titles
:
[
'List 1'
,
'List 2'
],
// to be translated
filterPlaceholder
:
'Enter keyword'
,
// to be translated
noCheckedFormat
:
'{total} items'
,
// to be translated
hasCheckedFormat
:
'{checked}/{total} checked'
// to be translated
},
image
:
{
error
:
'FAILED'
},
pageHeader
:
{
title
:
'Back'
// to be translated
},
popconfirm
:
{
confirmButtonText
:
'Yes'
,
cancelButtonText
:
'No'
}
}
};
module
.
exports
=
exports
[
'default'
];
});
\ No newline at end of file
src/main/webapp/static/plugins/element-ui/2.13.0/locale/zh_CN.js
0 → 100644
View file @
1a86f88b
(
function
(
global
,
factory
)
{
if
(
typeof
define
===
"function"
&&
define
.
amd
)
{
define
(
'element/locale/zh-CN'
,
[
'module'
,
'exports'
],
factory
);
}
else
if
(
typeof
exports
!==
"undefined"
)
{
factory
(
module
,
exports
);
}
else
{
var
mod
=
{
exports
:
{}
};
factory
(
mod
,
mod
.
exports
);
global
.
ELEMENT
.
lang
=
global
.
ELEMENT
.
lang
||
{};
global
.
ELEMENT
.
lang
.
zhCN
=
mod
.
exports
;
}
})(
this
,
function
(
module
,
exports
)
{
'use strict'
;
exports
.
__esModule
=
true
;
exports
.
default
=
{
el
:
{
colorpicker
:
{
confirm
:
'确定'
,
clear
:
'清空'
},
datepicker
:
{
now
:
'此刻'
,
today
:
'今天'
,
cancel
:
'取消'
,
clear
:
'清空'
,
confirm
:
'确定'
,
selectDate
:
'选择日期'
,
selectTime
:
'选择时间'
,
startDate
:
'开始日期'
,
startTime
:
'开始时间'
,
endDate
:
'结束日期'
,
endTime
:
'结束时间'
,
prevYear
:
'前一年'
,
nextYear
:
'后一年'
,
prevMonth
:
'上个月'
,
nextMonth
:
'下个月'
,
year
:
'年'
,
month1
:
'1 月'
,
month2
:
'2 月'
,
month3
:
'3 月'
,
month4
:
'4 月'
,
month5
:
'5 月'
,
month6
:
'6 月'
,
month7
:
'7 月'
,
month8
:
'8 月'
,
month9
:
'9 月'
,
month10
:
'10 月'
,
month11
:
'11 月'
,
month12
:
'12 月'
,
// week: '周次',
weeks
:
{
sun
:
'日'
,
mon
:
'一'
,
tue
:
'二'
,
wed
:
'三'
,
thu
:
'四'
,
fri
:
'五'
,
sat
:
'六'
},
months
:
{
jan
:
'一月'
,
feb
:
'二月'
,
mar
:
'三月'
,
apr
:
'四月'
,
may
:
'五月'
,
jun
:
'六月'
,
jul
:
'七月'
,
aug
:
'八月'
,
sep
:
'九月'
,
oct
:
'十月'
,
nov
:
'十一月'
,
dec
:
'十二月'
}
},
select
:
{
loading
:
'加载中'
,
noMatch
:
'无匹配数据'
,
noData
:
'无数据'
,
placeholder
:
'请选择'
},
cascader
:
{
noMatch
:
'无匹配数据'
,
loading
:
'加载中'
,
placeholder
:
'请选择'
,
noData
:
'暂无数据'
},
pagination
:
{
goto
:
'前往'
,
pagesize
:
'条/页'
,
total
:
'共 {total} 条'
,
pageClassifier
:
'页'
},
messagebox
:
{
title
:
'提示'
,
confirm
:
'确定'
,
cancel
:
'取消'
,
error
:
'输入的数据不合法!'
},
upload
:
{
deleteTip
:
'按 delete 键可删除'
,
delete
:
'删除'
,
preview
:
'查看图片'
,
continue
:
'继续上传'
},
table
:
{
emptyText
:
'暂无数据'
,
confirmFilter
:
'筛选'
,
resetFilter
:
'重置'
,
clearFilter
:
'全部'
,
sumText
:
'合计'
},
tree
:
{
emptyText
:
'暂无数据'
},
transfer
:
{
noMatch
:
'无匹配数据'
,
noData
:
'无数据'
,
titles
:
[
'列表 1'
,
'列表 2'
],
filterPlaceholder
:
'请输入搜索内容'
,
noCheckedFormat
:
'共 {total} 项'
,
hasCheckedFormat
:
'已选 {checked}/{total} 项'
},
image
:
{
error
:
'加载失败'
},
pageHeader
:
{
title
:
'返回'
},
popconfirm
:
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
}
}
};
module
.
exports
=
exports
[
'default'
];
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment