diff --git a/src/components/forging/forgingStats.js b/src/components/forging/forgingStats.js index 94c6ea9f1..ead417167 100644 --- a/src/components/forging/forgingStats.js +++ b/src/components/forging/forgingStats.js @@ -31,7 +31,7 @@ class ForgingStats extends React.Component { statCardObjects[0].label = this.props.t('Last 24 hours'); [1, 2, 3].forEach((i) => { statCardObjects[i].label = this.props.t( - 'Last x days', { day: statCardObjects[i].days }); + 'Last x days', { count: statCardObjects[i].days }); }); return ( diff --git a/src/components/forging/forgingStats.test.js b/src/components/forging/forgingStats.test.js index f96390f93..528cf5e61 100644 --- a/src/components/forging/forgingStats.test.js +++ b/src/components/forging/forgingStats.test.js @@ -42,14 +42,14 @@ describe('ForgingStats', () => { }); it('should render Card component for Last 7 days', () => { - expect(wrapper.find('Card').at(1).text().trim()).to.equal('Last x days 32.13 LSK'); + expect(wrapper.find('Card').at(1).text().trim()).to.equal('Last 7 days 32.13 LSK'); }); it('should render Card component for Last 30 days', () => { - expect(wrapper.find('Card').at(2).text().trim()).to.equal('Last x days 3,213.18 LSK'); + expect(wrapper.find('Card').at(2).text().trim()).to.equal('Last 30 days 3,213.18 LSK'); }); it('should render Card component for Last 365 days', () => { - expect(wrapper.find('Card').at(3).text().trim()).to.equal('Last x days 321,317.91 LSK'); + expect(wrapper.find('Card').at(3).text().trim()).to.equal('Last 365 days 321,317.91 LSK'); }); }); diff --git a/src/components/header/header.js b/src/components/header/header.js index 24ec95ee8..0824726a5 100644 --- a/src/components/header/header.js +++ b/src/components/header/header.js @@ -74,7 +74,7 @@ const Header = props => ( className={`${styles.iconButton} ${offlineStyle.disableWhenOffline}`} icon='language' position='topRight'> {Object.keys(languages).map(key => ( - i18n.changeLanguage(key)} /> ))} diff --git a/src/constants/languages.js b/src/constants/languages.js index c3682a3bb..3ffae793e 100644 --- a/src/constants/languages.js +++ b/src/constants/languages.js @@ -1,6 +1,12 @@ const languages = { - en: 'English', - de: 'Deutsch', + en: { + name: 'English', + common: require('../locales/en/common.json'), + }, + de: { + name: 'Deutsch', + common: require('../locales/de/common.json'), + }, }; export default languages; diff --git a/src/i18n.js b/src/i18n.js index d45f2f59b..1c64c7c54 100755 --- a/src/i18n.js +++ b/src/i18n.js @@ -1,13 +1,20 @@ import i18n from 'i18next'; -import XHR from 'i18next-xhr-backend'; +import languages from './constants/languages'; // import Cache from 'i18next-localstorage-cache'; +const resources = Object.keys(languages).reduce((accumulator, key) => { + accumulator[key] = { + common: languages[key].common, + }; + return accumulator; +}, {}); + i18n - .use(XHR) // .use(Cache) .init({ fallbackLng: 'en', lng: 'en', + resources, react: { // wait: true, // globally set to wait for loaded translations in translate hoc // exposeNamespace: true // exposes namespace on data-i18next-options to be used in eg.