Fixing some stuff...

This commit is contained in:
Fillerino 2017-07-07 15:26:03 +02:00
parent d733a7b1b4
commit 2ca08f92b5
5 changed files with 35 additions and 26 deletions

View file

@ -253,6 +253,6 @@ export function doChangeLanguage(newLanguage) {
app.i18n.setLocale(newLanguage);
return {
type: types.CHANGE_LANGUAGE,
data: { newLanguage: newLanguage }
}
data: { newLanguage: newLanguage },
};
}

View file

@ -1,8 +1,17 @@
import React from "react";
import { connect } from "react-redux";
import { doClearCache } from "actions/app";
import { doSetDaemonSetting, doSetClientSetting, doChangeLanguage } from "actions/settings";
import { selectDaemonSettings, selectShowNsfw, selectCurrentLanguage } from "selectors/settings";
import { doClearCache, doChangeLanguage } from "actions/app";
import {
doSetDaemonSetting,
doSetClientSetting,
} from "actions/settings";
import {
selectDaemonSettings,
selectShowNsfw,
} from "selectors/settings";
import {
selectCurrentLanguage,
} from "selectors/app"
import SettingsPage from "./view";
const select = state => ({
@ -15,7 +24,7 @@ const perform = dispatch => ({
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
clearCache: () => dispatch(doClearCache()),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
changeLanguage: (newLanguage) => dispatch(doChangeLanguage),
changeLanguage: newLanguage => dispatch(doChangeLanguage),
});
export default connect(select, perform)(SettingsPage);

View file

@ -86,7 +86,7 @@ class SettingsPage extends React.PureComponent {
}
onLanguageChange(e) {
this.props.changeLanguage(e.target.value)
this.props.changeLanguage(e.target.value);
}
// onLanguageChange(language) {
@ -166,27 +166,27 @@ class SettingsPage extends React.PureComponent {
name="language"
label={__("English")}
onChange={() => {
this.onLanguageChange.bind(this);
this.onLanguageChange.bind(this);
}}
defaultChecked={this.state.language == "en"}
/>
</div>
{window.app.i18n.localLanguages.map((dLang) => (
<div key={dLang} className="form-row">
<FormField
type="radio"
name="language"
key={dLang}
label={window.app.i18n.resLang(dLang)}
onChange={() => {
this.onLanguageChange.bind(this);
}}
defaultChecked={this.state.language == dLang}
/>
{window.app.i18n.localLanguages.map(dLang =>
<div key={dLang} className="form-row">
<FormField
type="radio"
name="language"
key={dLang}
label={window.app.i18n.resLang(dLang)}
onChange={() => {
this.onLanguageChange.bind(this);
}}
defaultChecked={this.state.language == dLang}
/>
</div>
)}
</div>
))}
</div>
</section>
</section>
<section className="card">
<div className="card__content">
<h3>{__("Download Directory")}</h3>

View file

@ -194,5 +194,5 @@ export const selectBadgeNumber = createSelector(
export const selectCurrentLanguage = createSelector(
_selectState,
(state) => state.currentLanguage || "en"
)
state => state.currentLanguage || "en"
);