Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
member-api
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
曲欣亮
member-api
Commits
0eae5882
Commit
0eae5882
authored
Oct 11, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化国际化配置
parent
3c9f700f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
20 deletions
+17
-20
MemberOpenApiController.java
...main/java/com/egolm/film/api/MemberOpenApiController.java
+1
-1
DefaultMessages.java
...main/java/com/egolm/film/common/impl/DefaultMessages.java
+2
-1
LocaleConfig.java
src/main/java/com/egolm/film/config/LocaleConfig.java
+4
-4
application.properties
src/main/resources/application.properties
+0
-2
messages.properties
src/main/resources/i18n/messages.properties
+0
-10
messages_en_US.properties
src/main/resources/i18n/messages_en_US.properties
+9
-0
messages_zh_CN.properties
src/main/resources/i18n/messages_zh_CN.properties
+1
-2
No files found.
src/main/java/com/egolm/film/api/MemberOpenApiController.java
View file @
0eae5882
...
...
@@ -115,7 +115,7 @@ public class MemberOpenApiController {
@PostMapping
(
"getLocale"
)
@ApiOperation
(
"获取当前语言环境"
)
public
Object
getLocale
(
HttpServletRequest
request
)
{
return
Rjx
.
jsonOk
().
set
Message
(
LocaleContextHolder
.
getLocale
().
toString
(
));
return
Rjx
.
jsonOk
().
set
(
"locale"
,
LocaleContextHolder
.
getLocale
().
toString
()).
set
(
"msg.test"
,
messages
.
get
(
"msg.test"
));
}
}
src/main/java/com/egolm/film/common/impl/DefaultMessages.java
View file @
0eae5882
...
...
@@ -20,7 +20,8 @@ public class DefaultMessages implements Messages {
public
String
get
(
String
name
,
String
...
args
)
{
try
{
Locale
locale
=
LocaleContextHolder
.
getLocale
();
return
messageSource
.
getMessage
(
name
,
args
,
locale
==
null
?
Locale
.
CHINA
:
locale
);
locale
=
locale
==
null
?
Locale
.
CHINA
:
locale
;
return
messageSource
.
getMessage
(
name
,
args
,
locale
);
}
catch
(
NoSuchMessageException
e
)
{
return
name
;
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/egolm/film/config/LocaleConfig.java
View file @
0eae5882
package
com
.
egolm
.
film
.
config
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.support.ResourceBundleMessageSource
;
@Configuration
Properties
(
prefix
=
"spring.messages"
)
@Configuration
public
class
LocaleConfig
{
@Bean
public
MessageSource
messageSource
()
{
ResourceBundleMessageSource
messageSource
=
new
ResourceBundleMessageSource
();
messageSource
.
setBasename
(
"
/
i18n/messages"
);
messageSource
.
setBasename
(
"i18n/messages"
);
messageSource
.
setDefaultEncoding
(
"utf-8"
);
messageSource
.
setAlwaysUseMessageFormat
(
true
);
messageSource
.
setCacheSeconds
(-
1
);
...
...
src/main/resources/application.properties
View file @
0eae5882
...
...
@@ -13,8 +13,6 @@ spring.http.encoding.force=true
spring.http.encoding.enabled
=
true
spring.http.encoding.charset
=
utf-8
spring.messages.basename
=
classpath:i18n/messages
com.egolm.film.email.smtp.host
=
mail.egolm.com
com.egolm.film.email.smtp.port
=
25
com.egolm.film.email.smtp.is_auth
=
true
...
...
src/main/resources/i18n/messages.properties
View file @
0eae5882
email.getPassword.subject
=
\u
4E2D
\u
56FD
\u7535\u
5F71
\u8282
[
\u
627E
\u
56DE
\u
5BC6
\u7801
]
\u
90AE
\u
4EF6
email.getPassword.content
=
{0},
\u
60A8
\u
597D,
\u
60A8
\u7684\u
65B0
\u
5BC6
\u7801\u
662F: [{1}]
sys.err
=
\u
7CFB
\u
7EDF
\u9519\u
8BEF
sys.err.user_disabled
=
\u7528\u6237\u
5DF2
\u
7ECF
\u7981\u7528
sys.err.user_pwd_err=
\u7528\u6237\u6216\u
5BC6
\u7801\u9519\u
8BEF
sys.err.user_pwd_null
=
\u7528\u6237\u
540D
\u
548C
\u
5BC6
\u7801\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
msg.hello
=
\u
60A8
\u
597D
msg.your_pwd
=
\u
60A8
\u7684\u
5BC6
\u7801\u
662F
\ No newline at end of file
src/main/resources/i18n/messages_en_US.properties
View file @
0eae5882
email.getPassword.subject
=
China Film Festival [retrieve password] email
email.getPassword.content
=
Hello {0}, Your password is: [{1}]
sys.err
=
System error
sys.err.user_disabled
=
User disabled
sys.err.user_pwd_err
=
User or password error
sys.err.user_pwd_null
=
User and passowrd can not be null
msg.test
=
Test
\ No newline at end of file
src/main/resources/i18n/messages_zh_CN.properties
View file @
0eae5882
...
...
@@ -6,5 +6,4 @@ sys.err.user_disabled=\u7528\u6237\u5DF2\u7ECF\u7981\u7528
sys.err.user_pwd_err=
\u7528\u6237\u6216\u
5BC6
\u7801\u9519\u
8BEF
sys.err.user_pwd_null
=
\u7528\u6237\u
540D
\u
548C
\u
5BC6
\u7801\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
msg.hello
=
\u
60A8
\u
597D
msg.your_pwd
=
\u
60A8
\u7684\u
5BC6
\u7801\u
662F
\ No newline at end of file
msg.test
=
\u
6D4B
\u
8BD5
\ 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