Fix i18n in setting page not update when click change language button at footer

This commit is contained in:
Hoàng Rio 2018-10-29 11:58:25 +07:00
parent 79468ab1bc
commit 9863c1f1ac
2 changed files with 14 additions and 11 deletions

View File

@ -12,23 +12,23 @@ class Settings extends Component {
settings = { settings = {
filtering: { filtering: {
enabled: false, enabled: false,
title: this.props.t('Block domains using filters and hosts files'), title: 'Block domains using filters and hosts files',
subtitle: this.props.t('You can setup blocking rules in the <a href="#filters">Filters</a> settings.'), subtitle: 'You can setup blocking rules in the <a href="#filters">Filters</a> settings.',
}, },
safebrowsing: { safebrowsing: {
enabled: false, enabled: false,
title: this.props.t('Use AdGuard browsing security web service'), title: 'Use AdGuard browsing security web service',
subtitle: this.props.t('AdGuard Home will check if domain is blacklisted by the browsing security web service. It will use privacy-friendly lookup API to perform the check: only a short prefix of the domain name SHA256 hash is sent to the server.'), subtitle: 'AdGuard Home will check if domain is blacklisted by the browsing security web service. It will use privacy-friendly lookup API to perform the check: only a short prefix of the domain name SHA256 hash is sent to the server.',
}, },
parental: { parental: {
enabled: false, enabled: false,
title: this.props.t('Use AdGuard parental control web service'), title: 'Use AdGuard parental control web service',
subtitle: this.props.t('AdGuard Home will check if domain contains adult materials. It uses the same privacy-friendly API as the browsing security web service.'), subtitle: 'AdGuard Home will check if domain contains adult materials. It uses the same privacy-friendly API as the browsing security web service.',
}, },
safesearch: { safesearch: {
enabled: false, enabled: false,
title: this.props.t('Enforce safe search'), title: 'Enforce safe search',
subtitle: this.props.t('AdGuard Home can enforce safe search in the following search engines: Google, Bing, Yandex.'), subtitle: 'AdGuard Home can enforce safe search in the following search engines: Google, Bing, Yandex.',
}, },
}; };

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { withNamespaces } from 'react-i18next';
import './Checkbox.css'; import './Checkbox.css';
@ -10,6 +11,7 @@ class Checkbox extends Component {
subtitle, subtitle,
enabled, enabled,
handleChange, handleChange,
t,
} = this.props; } = this.props;
return ( return (
<div className="form__group"> <div className="form__group">
@ -18,8 +20,8 @@ class Checkbox extends Component {
<input type="checkbox" className="checkbox__input" onChange={handleChange} checked={enabled}/> <input type="checkbox" className="checkbox__input" onChange={handleChange} checked={enabled}/>
<span className="checkbox__label"> <span className="checkbox__label">
<span className="checkbox__label-text"> <span className="checkbox__label-text">
<span className="checkbox__label-title">{title}</span> <span className="checkbox__label-title">{ t(title) }</span>
<span className="checkbox__label-subtitle" dangerouslySetInnerHTML={{ __html: subtitle }}/> <span className="checkbox__label-subtitle" dangerouslySetInnerHTML={{ __html: t(subtitle) }}/>
</span> </span>
</span> </span>
</label> </label>
@ -33,6 +35,7 @@ Checkbox.propTypes = {
subtitle: PropTypes.string.isRequired, subtitle: PropTypes.string.isRequired,
enabled: PropTypes.bool.isRequired, enabled: PropTypes.bool.isRequired,
handleChange: PropTypes.func.isRequired, handleChange: PropTypes.func.isRequired,
t: PropTypes.func,
}; };
export default Checkbox; export default withNamespaces()(Checkbox);