Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
2fb1185c
Commit
2fb1185c
authored
Sep 22, 2020
by
sgjj
Browse files
国际化
parent
5a360c5a
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/config/I18NConfig.java
deleted
100644 → 0
View file @
5a360c5a
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.local-messages:zh_CN,en_US}"
)
private
String
localMessages
;
@PostConstruct
public
void
init
()
throws
IOException
,
TemplateException
{
configuration
.
setSharedVariable
(
"localDefault"
,
defaultLocal
);
configuration
.
setSharedVariable
(
"localMessages"
,
localMessages
.
split
(
","
));
}
}
src/main/resources/application.yml
View file @
2fb1185c
...
...
@@ -15,7 +15,7 @@ logging:
ms
:
local
:
default
:
zh_CN
#默认语言
local-
mess
age
s
:
zh_CN,en_US
#全部语言
local-
langu
age
:
zh_CN,en_US
#全部语言
# scheme: https #解决使用代理服务器代理应用时标签解析域名依旧为http的问题
swagger
:
enable
:
true
#启用swagger文档,生产的时候务必关掉
...
...
src/main/webapp/WEB-INF/manager/cms/category/index.ftl
View file @
2fb1185c
...
...
@@ -34,8 +34,7 @@
<el-table-column label="编号" width="120" prop="id">
<template slot='header'>编号
<el-popover placement="top-start" title="提示" trigger="hover" >
<a href="http://doc.ms.mingsoft.net/plugs-cms/biao-qian/nei-rong-biao-qian-ms-field.html" target="_blank">
{
ms
:
field
.typeid
/
}
</a>
<a href="http://doc.ms.mingsoft.net/plugs-cms/biao-qian/lan-mu-lie-biao-ms-channel.html" target="_blank">[field.typeid/]</a>
<a href="http://doc.mingsoft.net/plugs-cms/biao-qian/lan-mu-lie-biao-ms-channel.html" target="_blank">$
{
'$'
}{
field
.id
}
</a>
<i class="el-icon-question" slot="reference"></i>
</el-popover>
</template>
...
...
@@ -48,7 +47,7 @@
</el-table-column>
<el-table-column label="链接地址" align="left" prop="categoryPath" show-overflow-tooltip>
<template slot-scope="scope">
<span style="cursor: pointer" class="copyBtn" :data-clipboard-text="'
{
ms
:
global
.url
/
}
'+scope.row.categoryPath+'/index.html'" @click="copyUrl">
{{
"{ms:global.url/}"
+
scope
.row.categoryPath
+
"/index.html"
}}
</span>
<span style="cursor: pointer" class="copyBtn" :data-clipboard-text="'
$
{
'$'
}{
global
.url
}
'+scope.row.categoryPath+'/index.html'" @click="copyUrl">
{{
"{ms:global.url/}"
+
scope
.row.categoryPath
+
"/index.html"
}}
</span>
</template>
</el-table-column>
<el-table-column label="列表地址" align="left" prop="categoryListUrl" show-overflow-tooltip>
...
...
src/main/webapp/WEB-INF/manager/cms/content/main.ftl
View file @
2fb1185c
...
...
@@ -63,8 +63,7 @@
<el-table-column label="编号" width="70" prop="id">
<template slot='header'>编号
<el-popover placement="top-start" title="提示" trigger="hover" >
<a href="http://doc.ms.mingsoft.net/plugs-cms/biao-qian/nei-rong-biao-qian-ms-field.html" target="_blank">
{
ms
:
field
.id
/
}
</a>
<a href="http://doc.ms.mingsoft.net/plugs-cms/biao-qian/wen-zhang-lie-biao-ms-arclist.html" target="_blank">[field.id/]</a>
<a href="http://doc.mingsoft.net/plugs-cms/biao-qian/wen-zhang-lie-biao-ms-arclist.html" target="_blank">$
{
'$'
}{
field
.id
}
</a>
<i class="el-icon-question" slot="reference"></i>
</el-popover>
</template>
...
...
@@ -80,8 +79,7 @@
<el-table-column label="点击量" width="90" align="right" prop="contentHit">
<template slot='header'>点击量
<el-popover placement="top-start" title="提示" trigger="hover" >
<a href="http://doc.ms.mingsoft.net/plugs-cms/biao-qian/nei-rong-biao-qian-ms-field.html" target="_blank">
{
ms
:
field
.hit
/
}
</a>
<a href="http://doc.ms.mingsoft.net/plugs-cms/biao-qian/wen-zhang-lie-biao-ms-arclist.html" target="_blank">[field.hit/]</a>
<a href="http://doc.mingsoft.net/plugs-cms/biao-qian/wen-zhang-lie-biao-ms-arclist.html" target="_blank">$
{
'$'
}{
field
.hit
}
</a>
<i class="el-icon-question" slot="reference"></i>
</el-popover>
</template>
...
...
src/main/webapp/WEB-INF/manager/include/local.ftl
deleted
100644 → 0
View file @
5a360c5a
<#
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
V
ueI18n
({
locale
:
window
.indexlocale.language
,
//
设置地区
fallbackLocale
:
defaultLocal
,
})
//加载语言
localeMessage
.forEach
(
function
(
value
)
{
if
(
window
[
value
]
!=undefined)
{
var
message
=
window
[
value
]
if
(
window
['
base_
'+
value
]!=
undefined
){
message
=
O
bject
.assign
({},
message
,
window
['
base_
'+
value
]
)
}
i18n
.setLocaleMessage
(
value
,
message
)
}
})
var
localElement
=
i18n
.getLocaleMessage
(
i18n
.locale
)
if
(
O
bject
.keys
(
localElement
)
.indexOf
(
"el"
)
!=
-1
){
ELEMENT
.locale
(
localElement
)
}
}
)(window);
</
script
>
\ No newline at end of file
Write
Preview
Supports
Markdown
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