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
12ce8052
Commit
12ce8052
authored
Oct 09, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改国际化语言工具
parent
c17a0b70
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
DefaultMessages.java
src/main/java/com/egolm/film/messages/DefaultMessages.java
+9
-2
No files found.
src/main/java/com/egolm/film/messages/DefaultMessages.java
View file @
12ce8052
package
com
.
egolm
.
film
.
messages
;
package
com
.
egolm
.
film
.
messages
;
import
java.util.Locale
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.NoSuchMessageException
;
import
org.springframework.context.NoSuchMessageException
;
import
org.springframework.context.i18n.LocaleContextHolder
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.support.RequestContextUtils
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XException
;
@Component
@Component
...
@@ -16,7 +21,9 @@ public class DefaultMessages implements Messages {
...
@@ -16,7 +21,9 @@ public class DefaultMessages implements Messages {
public
String
get
(
String
name
,
String
...
args
)
{
public
String
get
(
String
name
,
String
...
args
)
{
try
{
try
{
return
messageSource
.
getMessage
(
name
,
args
,
LocaleContextHolder
.
getLocale
());
HttpServletRequest
request
=
WebMvcConfig
.
getRequest
();
Locale
locale
=
RequestContextUtils
.
getLocale
(
request
);
return
messageSource
.
getMessage
(
name
,
args
,
locale
==
null
?
Locale
.
CHINA
:
locale
);
}
catch
(
NoSuchMessageException
e
)
{
}
catch
(
NoSuchMessageException
e
)
{
return
name
;
return
name
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
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