From 9e9dc08ad85a7e9ec217c4f2d8bcfffc116169bb Mon Sep 17 00:00:00 2001 From: Minh Duc Vo Date: Mon, 6 May 2019 15:14:57 +0700 Subject: [PATCH] PasswordChangeDialog : localized --- .../passwordChange/passwordChangeDialog.js | 42 ++++++++++++------- src/strings/hestia-l10n | 2 +- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/app/globalStatusBar/userSetting/passwordChange/passwordChangeDialog.js b/src/app/globalStatusBar/userSetting/passwordChange/passwordChangeDialog.js index 1349895..978ae85 100644 --- a/src/app/globalStatusBar/userSetting/passwordChange/passwordChangeDialog.js +++ b/src/app/globalStatusBar/userSetting/passwordChange/passwordChangeDialog.js @@ -7,8 +7,7 @@ import { fade } from '../../lib/libTransition.js'; import passwordChange from '../stub/passwordChange.js'; import { withSnackbar } from 'notistack'; - -import { translations } from '../../../../strings/hestia-l10n/l10n-loader.js'; +import { withNamespaces } from 'react-i18next'; /** * @name PasswordChangeForm @@ -62,28 +61,37 @@ class PasswordChangeDialog extends Component { changePassword = () => { passwordChange(this.props.userId, this.state.oldKey, this.state.newKey).catch(() => { - this.props.enqueueSnackbar( - translations[this.props.globalState.language].resources.globalStatusBar.userSetting.dialog.entry - .password.error, - { variant: 'error' } - ); + this.props.enqueueSnackbar(this.props.t('globalStatusBar.userSetting.dialog.entry.password.error'), { + variant: 'error' + }); }); }; render() { + const { t } = this.props; return ( - Changing password for {this.props.user} + + {t('globalStatusBar.userSetting.dialog.entry.password.dialog.title')} {this.props.user} + - Password length must be longer than 6 and smaller than 18. + { + t('globalStatusBar.userSetting.dialog.entry.password.dialog.notice', { + returnObjects: 1 + })[0] + }
- Upon successful operation you will be logged out - be careful. + { + t('globalStatusBar.userSetting.dialog.entry.password.dialog.notice', { + returnObjects: 1 + })[1] + }


- +
@@ -120,4 +130,4 @@ class PasswordChangeDialog extends Component { } } -export default withGlobalState(withSnackbar(PasswordChangeDialog)); +export default withNamespaces()(withGlobalState(withSnackbar(PasswordChangeDialog))); diff --git a/src/strings/hestia-l10n b/src/strings/hestia-l10n index f82ba93..8fea4d0 160000 --- a/src/strings/hestia-l10n +++ b/src/strings/hestia-l10n @@ -1 +1 @@ -Subproject commit f82ba9373f4ff20fcb5df183990fa97e83f380f0 +Subproject commit 8fea4d0d5b1c0f1610fbd12345d18af530a0c9c8