fix locale 404 not default

This commit is contained in:
Jay 2017-04-05 15:36:29 +08:00
parent 34f2d0e24a
commit 8d8b4818ae
2 changed files with 4 additions and 2 deletions

View File

@ -92816,7 +92816,8 @@ var PageRoot = function (_React$Component) {
return response.json();
}).then(function (json) {
if (json.status != 1) return location.replace('/');
var lang = navigator.language.substring(0, 2);
var slang = sessionStorage.getItem('lang');
var lang = slang || navigator.language.substring(0, 2);
fetch('/locales/' + lang + '.json').then(function (response) {
if (response.status == 200) return response.json();
return {};

View File

@ -39,7 +39,8 @@ class PageRoot extends React.Component {
.then(response=>response.json())
.then(json => {
if(json.status != 1) return location.replace('/');
let lang = navigator
let slang = sessionStorage.getItem('lang');
let lang = slang || navigator
.language
.substring(0, 2);
fetch(`/locales/${lang}.json`).then(response => {