diff --git a/client/package.json b/client/package.json index a85d00a4..5bf9152b 100644 --- a/client/package.json +++ b/client/package.json @@ -6,8 +6,7 @@ "build-dev": "NODE_ENV=development ./node_modules/.bin/webpack --config webpack.dev.js", "watch": "NODE_ENV=development ./node_modules/.bin/webpack --config webpack.dev.js --watch", "build-prod": "NODE_ENV=production ./node_modules/.bin/webpack --config webpack.prod.js", - "lint": "eslint frontend/", - "start": "react-scripts start" + "lint": "eslint frontend/" }, "dependencies": { "@nivo/line": "^0.49.1", diff --git a/client/src/components/Dashboard/Statistics.js b/client/src/components/Dashboard/Statistics.js index 3e7842b0..ba111798 100644 --- a/client/src/components/Dashboard/Statistics.js +++ b/client/src/components/Dashboard/Statistics.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { Trans } from 'react-i18next'; +import { Trans, withNamespaces } from 'react-i18next'; import Card from '../ui/Card'; import Line from '../ui/Line'; @@ -107,4 +107,4 @@ Statistics.propTypes = { refreshButton: PropTypes.node.isRequired, }; -export default Statistics; +export default withNamespaces()(Statistics); diff --git a/client/src/components/Header/Menu.js b/client/src/components/Header/Menu.js index 1140d7d7..010683b4 100644 --- a/client/src/components/Header/Menu.js +++ b/client/src/components/Header/Menu.js @@ -3,7 +3,7 @@ import { NavLink } from 'react-router-dom'; import PropTypes from 'prop-types'; import enhanceWithClickOutside from 'react-click-outside'; import classnames from 'classnames'; -import { Trans } from 'react-i18next'; +import { Trans, withNamespaces } from 'react-i18next'; import { REPOSITORY } from '../../helpers/constants'; class Menu extends Component { @@ -74,4 +74,4 @@ Menu.propTypes = { toggleMenuOpen: PropTypes.func, }; -export default enhanceWithClickOutside(Menu); +export default withNamespaces()(enhanceWithClickOutside(Menu)); diff --git a/client/src/components/Header/Version.js b/client/src/components/Header/Version.js index 7da7950e..0faedbcc 100644 --- a/client/src/components/Header/Version.js +++ b/client/src/components/Header/Version.js @@ -1,8 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Trans } from 'react-i18next'; +import { Trans, withNamespaces } from 'react-i18next'; -export default function Version(props) { +function Version(props) { const { dnsVersion, dnsAddress, dnsPort } = props; return (
@@ -21,3 +21,5 @@ Version.propTypes = { dnsAddress: PropTypes.string, dnsPort: PropTypes.number, }; + +export default withNamespaces()(Version); diff --git a/client/src/components/Header/index.js b/client/src/components/Header/index.js index ada6b3b7..b8c483ff 100644 --- a/client/src/components/Header/index.js +++ b/client/src/components/Header/index.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import PropTypes from 'prop-types'; import classnames from 'classnames'; -import { Trans } from 'react-i18next'; +import { Trans, withNamespaces } from 'react-i18next'; import Menu from './Menu'; import Version from './Version'; @@ -73,4 +73,4 @@ Header.propTypes = { location: PropTypes.object, }; -export default Header; +export default withNamespaces()(Header); diff --git a/client/src/components/Toasts/Toast.js b/client/src/components/Toasts/Toast.js index 36e40467..0e951f09 100644 --- a/client/src/components/Toasts/Toast.js +++ b/client/src/components/Toasts/Toast.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { Trans } from 'react-i18next'; +import { Trans, withNamespaces } from 'react-i18next'; class Toast extends Component { componentDidMount() { @@ -36,4 +36,4 @@ Toast.propTypes = { removeToast: PropTypes.func.isRequired, }; -export default Toast; +export default withNamespaces()(Toast); diff --git a/client/src/components/ui/Footer.js b/client/src/components/ui/Footer.js index 49f5e3e6..76774c88 100644 --- a/client/src/components/ui/Footer.js +++ b/client/src/components/ui/Footer.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; -import { Trans } from 'react-i18next'; +import { Trans, withNamespaces } from 'react-i18next'; import { REPOSITORY } from '../../helpers/constants'; +import i18n from '../../i18n'; class Footer extends Component { getYear = () => { @@ -8,6 +9,10 @@ class Footer extends Component { return today.getFullYear(); }; + changeLanguage = () => { + i18n.changeLanguage(i18n.language === 'en' ? 'vi' : 'en'); + } + render() { return (
+
+ +
Report an issue @@ -39,4 +50,4 @@ class Footer extends Component { } } -export default Footer; +export default withNamespaces()(Footer); diff --git a/client/src/components/ui/Popover.js b/client/src/components/ui/Popover.js index 68df8fe3..efc0a736 100644 --- a/client/src/components/ui/Popover.js +++ b/client/src/components/ui/Popover.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { Trans } from 'react-i18next'; +import { Trans, withNamespaces } from 'react-i18next'; import { getSourceData } from '../../helpers/trackers/trackers'; import { captitalizeWords } from '../../helpers/helpers'; @@ -52,4 +52,4 @@ Popover.propTypes = { data: PropTypes.object.isRequired, }; -export default Popover; +export default withNamespaces()(Popover);