Commit f855706f authored by Noah Zinsmeister's avatar Noah Zinsmeister Committed by GitHub

update i18n; kinda fix tests; remove stale dependencies (#266)

parent f8b8cd0e
...@@ -12,3 +12,4 @@ install: yarn ...@@ -12,3 +12,4 @@ install: yarn
script: script:
- yarn check:all - yarn check:all
- yarn build - yarn build
- yarn test
...@@ -36,4 +36,4 @@ REACT_APP_NETWORK_ID=2 REACT_APP_NETWORK='Ropsten Test Network' yarn start ...@@ -36,4 +36,4 @@ REACT_APP_NETWORK_ID=2 REACT_APP_NETWORK='Ropsten Test Network' yarn start
## Contributions ## Contributions
Please open all pull requests against the `beta` branch. CI checks will run against all PRs. To ensure that your changes will pass, run `yarn check:all` before pushing. If this command fails, you can try to automatically fix eslint/prettier problems with `yarn lint`/`yarn format`, or manually fix the problems. **Please open all pull requests against the `beta` branch.** CI checks will run against all PRs. To ensure that your changes will pass, run `yarn check:all` before pushing. If this command fails, you can try to automatically fix problems with `yarn fix:all`, or do it manually.
...@@ -5,38 +5,31 @@ ...@@ -5,38 +5,31 @@
"homepage": ".", "homepage": ".",
"private": true, "private": true,
"dependencies": { "dependencies": {
"axios": "^0.18.0",
"bignumber.js": "^7.2.1", "bignumber.js": "^7.2.1",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"d3": "^4.13.0",
"deep-equal": "^1.0.1",
"ethers": "^4.0.27", "ethers": "^4.0.27",
"fuse": "^0.4.0", "fuse": "^0.4.0",
"i18next": "^13.0.1", "i18next": "^15.0.9",
"i18next-browser-languagedetector": "^2.2.4", "i18next-browser-languagedetector": "^3.0.1",
"i18next-xhr-backend": "^1.5.1", "i18next-xhr-backend": "^2.0.1",
"jazzicon": "^1.5.0", "jazzicon": "^1.5.0",
"node-sass": "^4.9.3", "node-sass": "^4.11.0",
"npm": "^6.0.0",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^16.8.6", "react": "^16.8.6",
"react-cookies": "^0.1.0",
"react-dom": "^16.8.6", "react-dom": "^16.8.6",
"react-ga": "^2.5.3", "react-ga": "^2.5.7",
"react-helmet": "^5.2.0", "react-i18next": "^10.7.0",
"react-i18next": "^8.4.0",
"react-redux": "^5.0.7", "react-redux": "^5.0.7",
"react-responsive": "^5.0.0", "react-responsive": "^5.0.0",
"react-router-dom": "^5.0.0", "react-router-dom": "^5.0.0",
"react-scripts": "^2.1.8", "react-scripts": "^2.1.8",
"react-scroll-to-component": "^1.0.2",
"react-select": "^1.2.1",
"react-transition-group": "1.x", "react-transition-group": "1.x",
"redux": "^3.7.2", "redux": "^3.7.2",
"redux-subscriber": "^1.1.0", "redux-subscriber": "^1.1.0",
"redux-thunk": "^2.2.0", "redux-thunk": "^2.2.0",
"ua-parser-js": "^0.7.18", "ua-parser-js": "^0.7.18",
"web3": "1.0.0-beta.52" "web3": "1.0.0-beta.52",
"web3-react": "^4.0.0"
}, },
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
...@@ -47,8 +40,9 @@ ...@@ -47,8 +40,9 @@
"eject": "react-scripts eject", "eject": "react-scripts eject",
"lint:base": "yarn eslint './src/**/*.{js,jsx}'", "lint:base": "yarn eslint './src/**/*.{js,jsx}'",
"format:base": "yarn prettier './src/**/*.{js,jsx,scss}'", "format:base": "yarn prettier './src/**/*.{js,jsx,scss}'",
"lint": "yarn lint:base --fix", "fix:lint": "yarn lint:base --fix",
"format": "yarn format:base --write", "fix:format": "yarn format:base --write",
"fix:all": "yarn fix:lint && yarn fix:format",
"check:lint": "yarn lint:base", "check:lint": "yarn lint:base",
"check:format": "yarn format:base --check", "check:format": "yarn format:base --check",
"check:all": "yarn check:lint && yarn check:format" "check:all": "yarn check:lint && yarn check:format"
......
...@@ -4,7 +4,7 @@ import PropTypes from 'prop-types' ...@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
import { CSSTransitionGroup } from 'react-transition-group' import { CSSTransitionGroup } from 'react-transition-group'
import classnames from 'classnames' import classnames from 'classnames'
import { withRouter } from 'react-router-dom' import { withRouter } from 'react-router-dom'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import Fuse from '../../helpers/fuse' import Fuse from '../../helpers/fuse'
import Modal from '../Modal' import Modal from '../Modal'
import TokenLogo from '../TokenLogo' import TokenLogo from '../TokenLogo'
...@@ -394,5 +394,5 @@ export default withRouter( ...@@ -394,5 +394,5 @@ export default withRouter(
addPendingTx: opts => dispatch(addPendingTx(opts)), addPendingTx: opts => dispatch(addPendingTx(opts)),
addApprovalTx: opts => dispatch(addApprovalTx(opts)) addApprovalTx: opts => dispatch(addApprovalTx(opts))
}) })
)(withNamespaces()(CurrencyInputPanel)) )(withTranslation()(CurrencyInputPanel))
) )
...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types' ...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import classnames from 'classnames' import classnames from 'classnames'
import UAParser from 'ua-parser-js' import UAParser from 'ua-parser-js'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import Logo from '../Logo' import Logo from '../Logo'
import CoinbaseWalletLogo from '../../assets/images/coinbase-wallet-logo.png' import CoinbaseWalletLogo from '../../assets/images/coinbase-wallet-logo.png'
import TrustLogo from '../../assets/images/trust-wallet-logo.svg' import TrustLogo from '../../assets/images/trust-wallet-logo.svg'
...@@ -168,4 +168,4 @@ export default connect(state => ({ ...@@ -168,4 +168,4 @@ export default connect(state => ({
isConnected: !!state.web3connect.account, isConnected: !!state.web3connect.account,
web3: state.web3connect.web3, web3: state.web3connect.web3,
networkId: state.web3connect.networkId networkId: state.web3connect.networkId
}))(withNamespaces()(Header)) }))(withTranslation()(Header))
...@@ -2,7 +2,7 @@ import React, { Component } from 'react' ...@@ -2,7 +2,7 @@ import React, { Component } from 'react'
import { withRouter } from 'react-router-dom' import { withRouter } from 'react-router-dom'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import { dismissBetaMessage } from '../../ducks/app' import { dismissBetaMessage } from '../../ducks/app'
import { Tab, Tabs } from '../Tab' import { Tab, Tabs } from '../Tab'
...@@ -62,5 +62,5 @@ export default withRouter( ...@@ -62,5 +62,5 @@ export default withRouter(
dispatch => ({ dispatch => ({
dismissBetaMessage: () => dispatch(dismissBetaMessage()) dismissBetaMessage: () => dispatch(dismissBetaMessage())
}) })
)(withNamespaces()(NavigationTabs)) )(withTranslation()(NavigationTabs))
) )
...@@ -4,7 +4,7 @@ import { connect } from 'react-redux' ...@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
import classnames from 'classnames' import classnames from 'classnames'
import Jazzicon from 'jazzicon' import Jazzicon from 'jazzicon'
import { CSSTransitionGroup } from 'react-transition-group' import { CSSTransitionGroup } from 'react-transition-group'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import './web3-status.scss' import './web3-status.scss'
import Modal from '../Modal' import Modal from '../Modal'
...@@ -142,4 +142,4 @@ export default connect(state => { ...@@ -142,4 +142,4 @@ export default connect(state => {
pending: state.web3connect.transactions.pending, pending: state.web3connect.transactions.pending,
confirmed: state.web3connect.transactions.confirmed confirmed: state.web3connect.transactions.confirmed
} }
})(withNamespaces()(Web3Status)) })(withTranslation()(Web3Status))
import i18n from 'i18next' import i18next from 'i18next'
import Backend from 'i18next-xhr-backend' import XHR from 'i18next-xhr-backend'
import LanguageDetector from 'i18next-browser-languagedetector' import LanguageDetector from 'i18next-browser-languagedetector'
import { reactI18nextModule } from 'react-i18next' import { initReactI18next } from 'react-i18next'
const resources = { i18next
loadPath: `./locales/{{lng}}.json`
}
i18n
// load translation using xhr -> see /public/locales // load translation using xhr -> see /public/locales
// learn more: https://github.com/i18next/i18next-xhr-backend // https://github.com/i18next/i18next-xhr-backend
.use(Backend) .use(XHR)
// detect user language // detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector // https://github.com/i18next/i18next-browser-languageDetector
.use(LanguageDetector) .use(LanguageDetector)
// pass the i18n instance to react-i18next. .use(initReactI18next)
.use(reactI18nextModule) // https://www.i18next.com/overview/configuration-options
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({ .init({
backend: resources, backend: {
loadPath: './locales/{{lng}}.json'
},
fallbackLng: 'en', fallbackLng: 'en',
keySeparator: false, keySeparator: false,
interpolation: { interpolation: {
escapeValue: false escapeValue: false // not needed for react as it escapes by default
} }
}) })
export default i18n export default i18next
import React from 'react' import React, { Suspense } from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import ReactGA from 'react-ga' import ReactGA from 'react-ga'
import './i18n' import './i18n'
import App from './pages/App' import App from './pages/App'
import store from './store' import store from './store'
import './index.scss' import './index.scss'
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'production') {
ReactGA.initialize('test', { testMode: true })
} else {
ReactGA.initialize('UA-128182339-1') ReactGA.initialize('UA-128182339-1')
} else {
ReactGA.initialize('test', { testMode: true })
} }
ReactGA.pageview(window.location.pathname + window.location.search) ReactGA.pageview(window.location.pathname + window.location.search)
window.addEventListener('load', function() { ReactDOM.render(
ReactDOM.render( // catch the suspense in case translations are not yet loaded
<Suspense fallback={null}>
<Provider store={store}> <Provider store={store}>
<App /> <App />
</Provider>, </Provider>
</Suspense>,
document.getElementById('root') document.getElementById('root')
) )
})
@import url('https://rsms.me/inter/inter-ui.css'); @import url('https://rsms.me/inter/inter.css');
@import './variables.scss'; @import './variables.scss';
html, html,
......
...@@ -2,7 +2,7 @@ import React, { Component } from 'react' ...@@ -2,7 +2,7 @@ import React, { Component } from 'react'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import CurrencyInputPanel from '../../components/CurrencyInputPanel' import CurrencyInputPanel from '../../components/CurrencyInputPanel'
import OversizedPanel from '../../components/OversizedPanel' import OversizedPanel from '../../components/OversizedPanel'
import ContextualInfo from '../../components/ContextualInfo' import ContextualInfo from '../../components/ContextualInfo'
...@@ -644,7 +644,7 @@ export default connect( ...@@ -644,7 +644,7 @@ export default connect(
selectors: () => dispatch(selectors()), selectors: () => dispatch(selectors()),
addPendingTx: id => dispatch(addPendingTx(id)) addPendingTx: id => dispatch(addPendingTx(id))
}) })
)(withNamespaces()(AddLiquidity)) )(withTranslation()(AddLiquidity))
function b(text) { function b(text) {
return <span className="swap__highlight-text">{text}</span> return <span className="swap__highlight-text">{text}</span>
......
...@@ -2,7 +2,7 @@ import React, { Component } from 'react' ...@@ -2,7 +2,7 @@ import React, { Component } from 'react'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { withRouter } from 'react-router-dom' import { withRouter } from 'react-router-dom'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import { selectors, addPendingTx } from '../../ducks/web3connect' import { selectors, addPendingTx } from '../../ducks/web3connect'
import classnames from 'classnames' import classnames from 'classnames'
import NavigationTabs from '../../components/NavigationTabs' import NavigationTabs from '../../components/NavigationTabs'
...@@ -239,5 +239,5 @@ export default withRouter( ...@@ -239,5 +239,5 @@ export default withRouter(
addExchange: opts => dispatch(addExchange(opts)), addExchange: opts => dispatch(addExchange(opts)),
addPendingTx: id => dispatch(addPendingTx(id)) addPendingTx: id => dispatch(addPendingTx(id))
}) })
)(withNamespaces()(CreateExchange)) )(withTranslation()(CreateExchange))
) )
import React, { Component } from 'react' import React, { Component } from 'react'
import { withRouter } from 'react-router-dom' import { withRouter } from 'react-router-dom'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import OversizedPanel from '../../components/OversizedPanel' import OversizedPanel from '../../components/OversizedPanel'
import Dropdown from '../../assets/images/dropdown-blue.svg' import Dropdown from '../../assets/images/dropdown-blue.svg'
import Modal from '../../components/Modal' import Modal from '../../components/Modal'
...@@ -80,4 +80,4 @@ class ModeSelector extends Component { ...@@ -80,4 +80,4 @@ class ModeSelector extends Component {
} }
} }
export default withRouter(withNamespaces()(ModeSelector)) export default withRouter(withTranslation()(ModeSelector))
...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types' ...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { BigNumber as BN } from 'bignumber.js' import { BigNumber as BN } from 'bignumber.js'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import NavigationTabs from '../../components/NavigationTabs' import NavigationTabs from '../../components/NavigationTabs'
import ModeSelector from './ModeSelector' import ModeSelector from './ModeSelector'
import CurrencyInputPanel from '../../components/CurrencyInputPanel' import CurrencyInputPanel from '../../components/CurrencyInputPanel'
...@@ -430,7 +430,7 @@ export default connect( ...@@ -430,7 +430,7 @@ export default connect(
selectors: () => dispatch(selectors()), selectors: () => dispatch(selectors()),
addPendingTx: id => dispatch(addPendingTx(id)) addPendingTx: id => dispatch(addPendingTx(id))
}) })
)(withNamespaces()(RemoveLiquidity)) )(withTranslation()(RemoveLiquidity))
function b(text) { function b(text) {
return <span className="swap__highlight-text">{text}</span> return <span className="swap__highlight-text">{text}</span>
......
...@@ -3,7 +3,7 @@ import { connect } from 'react-redux' ...@@ -3,7 +3,7 @@ import { connect } from 'react-redux'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import { BigNumber as BN } from 'bignumber.js' import { BigNumber as BN } from 'bignumber.js'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import { selectors, addPendingTx } from '../../ducks/web3connect' import { selectors, addPendingTx } from '../../ducks/web3connect'
import Header from '../../components/Header' import Header from '../../components/Header'
import NavigationTabs from '../../components/NavigationTabs' import NavigationTabs from '../../components/NavigationTabs'
...@@ -840,7 +840,7 @@ export default connect( ...@@ -840,7 +840,7 @@ export default connect(
selectors: () => dispatch(selectors()), selectors: () => dispatch(selectors()),
addPendingTx: id => dispatch(addPendingTx(id)) addPendingTx: id => dispatch(addPendingTx(id))
}) })
)(withNamespaces()(Send)) )(withTranslation()(Send))
const b = text => <span className="swap__highlight-text">{text}</span> const b = text => <span className="swap__highlight-text">{text}</span>
......
...@@ -5,7 +5,7 @@ import classnames from 'classnames' ...@@ -5,7 +5,7 @@ import classnames from 'classnames'
import { BigNumber as BN } from 'bignumber.js' import { BigNumber as BN } from 'bignumber.js'
import MediaQuery from 'react-responsive' import MediaQuery from 'react-responsive'
import ReactGA from 'react-ga' import ReactGA from 'react-ga'
import { withNamespaces } from 'react-i18next' import { withTranslation } from 'react-i18next'
import { selectors, addPendingTx } from '../../ducks/web3connect' import { selectors, addPendingTx } from '../../ducks/web3connect'
import Header from '../../components/Header' import Header from '../../components/Header'
import NavigationTabs from '../../components/NavigationTabs' import NavigationTabs from '../../components/NavigationTabs'
...@@ -810,7 +810,7 @@ export default connect( ...@@ -810,7 +810,7 @@ export default connect(
selectors: () => dispatch(selectors()), selectors: () => dispatch(selectors()),
addPendingTx: id => dispatch(addPendingTx(id)) addPendingTx: id => dispatch(addPendingTx(id))
}) })
)(withNamespaces()(Swap)) )(withTranslation()(Swap))
const b = text => <span className="swap__highlight-text">{text}</span> const b = text => <span className="swap__highlight-text">{text}</span>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment