diff --git a/package.json b/package.json index 4a0014daf..4dd72036a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@chronobank/mint", - "version": "0.9.3", + "version": "0.9.4", "description": "Control panel for ChronoBank", "private": true, "author": "chronobank", diff --git a/src/layouts/partials/LocaleDropDown/LocaleDropDown.jsx b/src/layouts/partials/LocaleDropDown/LocaleDropDown.jsx index e3a9c2228..21b207d29 100644 --- a/src/layouts/partials/LocaleDropDown/LocaleDropDown.jsx +++ b/src/layouts/partials/LocaleDropDown/LocaleDropDown.jsx @@ -7,7 +7,6 @@ import { Menu, MenuItem, Popover } from 'material-ui' import PropTypes from 'prop-types' import React, { PureComponent } from 'react' import { connect } from 'react-redux' -import i18n from 'i18n' import { Button } from 'components' import { changeMomentLocale } from 'redux/ui/actions' @@ -16,6 +15,7 @@ import './LocaleDropDown.scss' function mapStateToProps (state) { return { locale: state.get('i18n').locale, + translations: state.get('i18n').translations, } } @@ -32,6 +32,7 @@ export default class LocaleDropDown extends PureComponent { static propTypes = { locale: PropTypes.string, onChangeLocale: PropTypes.func, + translations: PropTypes.arrayOf(PropTypes.object), } constructor (props) { @@ -64,7 +65,7 @@ export default class LocaleDropDown extends PureComponent { } render () { - const locales = Object.entries(i18n).map(([ name, dictionary ]) => ({ + const locales = Object.entries(this.props.translations).map(([ name, dictionary ]) => ({ name, title: dictionary.title, })) diff --git a/src/redux/i18n/actions.js b/src/redux/i18n/actions.js index bd72c4a4f..867acbf9a 100644 --- a/src/redux/i18n/actions.js +++ b/src/redux/i18n/actions.js @@ -19,7 +19,7 @@ export const loadI18n = (locale) => async (dispatch, getState) => { const translationsFiltered = {} Object.entries(translations).filter((t) => { return typeof t[1] === 'object' && Object.keys(t[1]).length - }).map((t) => translationsFiltered[t[0]] = t[1]) + }).map((t) => translationsFiltered[t[0]] = merge({}, currentI18n.translations['en'], t[1])) // i18nJson is global object getting from ./i18nJson.js file dispatch(loadTranslations(merge({}, currentI18n.translations, translationsFiltered, i18nJson)))