Skip to content

Commit

Permalink
Merge pull request #2 from lxzhangchao/ch_react_page
Browse files Browse the repository at this point in the history
Using react-intl-universal to improve multi language in react page
  • Loading branch information
lxzhangchao authored Jul 7, 2017
2 parents 5a4e13f + 7a01ac9 commit 551844a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 22 deletions.
2 changes: 2 additions & 0 deletions superset/assets/javascripts/explore/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ const bootstrappedState = Object.assign(
alert: null,
},
);

const store = createStore(exploreReducer, bootstrappedState,
compose(applyMiddleware(thunk), initEnhancer(false)),
);

ReactDOM.render(
<Provider store={store}>
<div>
Expand Down
21 changes: 0 additions & 21 deletions superset/assets/javascripts/explore/stores/language.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@

import zh_CN from '../stores/zh_CN';
import en_US from '../stores/en_US';
const $ = window.$ = require('jquery'); // eslint-disable-line

export function chooseMessage() {

function getLocale() {
const locale = $.ajax({
url: '/superset/rest/api/getLocale',
async: false,
});
return locale.responseText
}
switch (getLocale()) {
case 'en':
return en_US;
case 'zh':
return zh_CN;
default:
return en_US;
}
}

export function getLanguage() {
function getLocale() {
const locale = $.ajax({
Expand Down
1 change: 0 additions & 1 deletion superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"react-dom": "^15.5.1",
"react-gravatar": "^2.6.1",
"react-grid-layout": "^0.14.4",
"react-intl": "^2.3.0",
"react-intl-universal": "^1.1.1",
"react-map-gl": "^1.7.0",
"react-redux": "^5.0.2",
Expand Down

0 comments on commit 551844a

Please sign in to comment.