Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Accounts Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Accounts Web
Commits
9bf497e5
Commit
9bf497e5
authored
Apr 07, 2017
by
2breakegg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i18n
parent
e6c53dad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
14 deletions
+9
-14
src/index.js
src/index.js
+5
-6
src/models/common.js
src/models/common.js
+3
-2
src/models/user.js
src/models/user.js
+1
-6
No files found.
src/index.js
View file @
9bf497e5
...
...
@@ -47,13 +47,12 @@ app.router(require('./router'));
addLocaleData
([...
en
,
...
zh
]);
/*eslint-disable */
let
language
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
/*eslint-enable */
const
languageWithoutRegionCode
=
language
.
toLowerCase
().
split
(
/
[
_-
]
+/
)[
0
];
language
=
(
localeData
[
languageWithoutRegionCode
]
||
localeData
[
language
])
?
language
:
'
zh-CN
'
;
const
messages
=
localeData
[
languageWithoutRegionCode
]
||
localeData
[
language
]
||
localeData
.
zh
;
const
languageY
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
const
anguageWithoutRegionCode
=
languageY
.
toLowerCase
().
split
(
/
[
_-
]
+/
)[
0
];
const
language
=
anguageWithoutRegionCode
===
'
zh
'
?
'
zh-CN
'
:
'
en-US
'
;
const
messages
=
localeData
[
language
];
const
App
=
app
.
start
();
ReactDOM
.
render
(
...
...
src/models/common.js
View file @
9bf497e5
...
...
@@ -27,9 +27,10 @@ export default {
subscriptions
:
{
setup
({
dispatch
})
{
let
client
;
const
language
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
const
language
Y
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
// const languageWithoutRegionCode = language.toLowerCase().split(/[_-]+/)[0];
const
anguageWithoutRegionCode
=
languageY
.
toLowerCase
().
split
(
/
[
_-
]
+/
)[
0
];
const
language
=
anguageWithoutRegionCode
===
'
zh
'
?
'
zh-CN
'
:
'
en-US
'
;
const
messages
=
i18n
[
language
];
const
{
userAgent
}
=
navigator
;
...
...
src/models/user.js
View file @
9bf497e5
...
...
@@ -208,15 +208,10 @@ export default {
dispatch
(
routerRedux
.
replace
(
'
/signin
'
));
}
history
.
listen
(({
pathname
,
query
})
=>
{
history
.
listen
(({
pathname
})
=>
{
if
(
pathname
===
'
/
'
)
{
dispatch
({
type
:
'
preLogin
'
,
payload
:
{
token
}
});
}
if
(
pathname
===
'
/reset
'
||
pathname
===
'
/activate
'
)
{
if
(
!
query
.
key
)
{
message
.
error
(
'
缺少参数
'
);
}
}
});
},
},
...
...
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