diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 550c304f..478a3021 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -70,9 +70,18 @@ export const initSettings = (settingsList) => async (dispatch) => { safesearch, } = settingsList; const newSettingsList = { - safebrowsing: { ...safebrowsing, enabled: safebrowsingStatus.enabled }, - parental: { ...parental, enabled: parentalStatus.enabled }, - safesearch: { ...safesearch, enabled: safesearchStatus.enabled }, + safebrowsing: { + ...safebrowsing, + enabled: safebrowsingStatus.enabled, + }, + parental: { + ...parental, + enabled: parentalStatus.enabled, + }, + safesearch: { + ...safesearch, + enabled: safesearchStatus.enabled, + }, }; dispatch(initSettingsSuccess({ settingsList: newSettingsList })); } catch (error) { @@ -274,13 +283,14 @@ export const testUpstream = (config) => async (dispatch) => { values.upstream_dns = normalizeTextarea(values.upstream_dns); const upstreamResponse = await apiClient.testUpstream(values); - const testMessages = Object.keys(upstreamResponse).map((key) => { - const message = upstreamResponse[key]; - if (message !== 'OK') { - dispatch(addErrorToast({ error: i18next.t('dns_test_not_ok_toast', { key }) })); - } - return message; - }); + const testMessages = Object.keys(upstreamResponse) + .map((key) => { + const message = upstreamResponse[key]; + if (message !== 'OK') { + dispatch(addErrorToast({ error: i18next.t('dns_test_not_ok_toast', { key }) })); + } + return message; + }); if (testMessages.every((message) => message === 'OK')) { dispatch(addSuccessToast('dns_test_ok_toast')); @@ -393,11 +403,17 @@ export const toggleDhcpSuccess = createAction('TOGGLE_DHCP_SUCCESS'); export const toggleDhcp = (values) => async (dispatch) => { dispatch(toggleDhcpRequest()); - let config = { ...values, enabled: false }; + let config = { + ...values, + enabled: false, + }; let successMessage = 'disabled_dhcp'; if (!values.enabled) { - config = { ...values, enabled: true }; + config = { + ...values, + enabled: true, + }; successMessage = 'enabled_dhcp'; dispatch(findActiveDhcp(values.interface_name)); } diff --git a/client/src/components/App/index.js b/client/src/components/App/index.js index 2318c7a9..afbd3888 100644 --- a/client/src/components/App/index.js +++ b/client/src/components/App/index.js @@ -36,6 +36,7 @@ import i18n from '../../i18n'; import Loading from '../ui/Loading'; import { FILTERS_URLS, MENU_URLS, SETTINGS_URLS } from '../../helpers/constants'; import Services from '../Filters/Services'; +import { setHtmlLangAttr } from '../../helpers/helpers'; class App extends Component { componentDidMount() { @@ -62,6 +63,7 @@ class App extends Component { if (!processing) { if (language) { i18n.changeLanguage(language); + setHtmlLangAttr(language); } } diff --git a/client/src/components/ui/Footer.js b/client/src/components/ui/Footer.js index 14f37637..482573d6 100644 --- a/client/src/components/ui/Footer.js +++ b/client/src/components/ui/Footer.js @@ -1,6 +1,6 @@ -import React, { Component, Fragment } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; -import { Trans, withTranslation } from 'react-i18next'; +import { useTranslation } from 'react-i18next'; import classNames from 'classnames'; import { REPOSITORY, PRIVACY_POLICY_LINK } from '../../helpers/constants'; @@ -10,6 +10,7 @@ import i18n from '../../i18n'; import Version from './Version'; import './Footer.css'; import './Select.css'; +import { setHtmlLangAttr } from '../../helpers/helpers'; const linksData = [ { @@ -27,83 +28,85 @@ const linksData = [ }, ]; -class Footer extends Component { - getYear = () => { +const Footer = (props) => { + const { t } = useTranslation(); + + const getYear = () => { const today = new Date(); return today.getFullYear(); }; - changeLanguage = (event) => { - i18n.changeLanguage(event.target.value); + const changeLanguage = (event) => { + const { value } = event.target; + i18n.changeLanguage(value); + setHtmlLangAttr(value); }; - renderCopyright = () =>