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
0d1226fc
Commit
0d1226fc
authored
Oct 09, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
语言环境设置
parent
faa1cfc0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
MemberOpenApiController.java
...main/java/com/egolm/film/api/MemberOpenApiController.java
+17
-2
No files found.
src/main/java/com/egolm/film/api/MemberOpenApiController.java
View file @
0d1226fc
package
com
.
egolm
.
film
.
api
;
import
java.util.Locale
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.context.i18n.LocaleContextHolder
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.film.config.interceptor.LocaleSessionInterceptor
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -41,7 +48,15 @@ public class MemberOpenApiController {
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"string"
,
required
=
true
,
name
=
"i18n_language"
,
defaultValue
=
"zh_CN"
),
})
public
Object
setLocale
(
String
i18n_language
)
{
public
Object
setLocale
(
HttpSession
session
,
String
i18n_language
)
{
Locale
locale
=
new
Locale
(
i18n_language
);
session
.
setAttribute
(
LocaleSessionInterceptor
.
I18N_LANGUAGE_SESSION
,
locale
);
return
Rjx
.
jsonOk
();
}
@PostMapping
(
"getLocale"
)
@ApiOperation
(
"获取当前语言环境"
)
public
Object
getLocale
(
HttpServletRequest
request
)
{
return
Rjx
.
jsonOk
().
setMessage
(
LocaleContextHolder
.
getLocale
().
getLanguage
());
}
}
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