From cb33d93f8eb566d13b15704611b9e84ff5cd7353 Mon Sep 17 00:00:00 2001 From: Lisa Hillebrand Date: Fri, 25 Nov 2022 20:12:57 +0100 Subject: [PATCH] 623 Remove common translation file --- components/PasswordPrompt.js | 57 ++++++++++++++++-------------------- i18n/en.json | 6 ++++ i18n/en/common.json | 6 ---- i18n/i18n.js | 3 +- 4 files changed, 32 insertions(+), 40 deletions(-) delete mode 100644 i18n/en/common.json diff --git a/components/PasswordPrompt.js b/components/PasswordPrompt.js index 4ad776c..414f6c7 100644 --- a/components/PasswordPrompt.js +++ b/components/PasswordPrompt.js @@ -16,9 +16,12 @@ import { useTranslation } from 'react-i18next' const PasswordPrompt = ({ enableShowApp }) => { const [password, setPassword] = useState(null) - const { t } = useTranslation() + const { t } = useTranslation(null, { keyPrefix: 'password' }) - const cancelButton = { text: t('common:cancel'), style: 'cancel' } + const cancelButton = { + text: t('forgotPasswordDialog.cancel'), + style: 'cancel', + } const unlockApp = async () => { const hash = new SHA512().hex(password) @@ -26,11 +29,11 @@ const PasswordPrompt = ({ enableShowApp }) => { if (!connected) { Alert.alert( - t('common:incorrectPassword'), - t('common:incorrectPasswordMessage'), + t('incorrectPasswordDialog.incorrectPassword'), + t('incorrectPasswordDialog.incorrectPasswordMessage'), [ { - text: t('common:tryAgain'), + text: t('incorrectPasswordDialog.tryAgain'), onPress: () => setPassword(null), }, ] @@ -47,31 +50,23 @@ const PasswordPrompt = ({ enableShowApp }) => { } const onDeleteData = () => { - Alert.alert( - t('password.confirmationDialog.title'), - t('password.confirmationDialog.text'), - [ - cancelButton, - { - text: t('password.confirmationDialog.confirm'), - onPress: onDeleteDataConfirmation, - }, - ] - ) + Alert.alert(t('confirmationDialog.title'), t('confirmationDialog.text'), [ + cancelButton, + { + text: t('confirmationDialog.confirm'), + onPress: onDeleteDataConfirmation, + }, + ]) } const onConfirmDeletion = async () => { - Alert.alert( - t('password.forgotPassword'), - t('password.forgotPasswordDialog.text'), - [ - cancelButton, - { - text: t('password.forgotPasswordDialog.confirm'), - onPress: onDeleteData, - }, - ] - ) + Alert.alert(t('forgotPassword'), t('forgotPasswordDialog.text'), [ + cancelButton, + { + text: t('forgotPasswordDialog.confirm'), + onPress: onDeleteData, + }, + ]) } return ( @@ -82,14 +77,12 @@ const PasswordPrompt = ({ enableShowApp }) => { - + diff --git a/i18n/en.json b/i18n/en.json index 3c0222c..3522e3a 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -141,9 +141,15 @@ "enterPassword": "Enter password here", "forgotPassword": "Forgot your password?", "forgotPasswordDialog": { + "cancel": "Cancel", "confirm": "Yes, delete all my data", "text": "If you've forgotten your password, unfortunately, there is nothing we can do to recover your data, because it is encrypted with the password only you know. You can, however, delete all your encrypted data and start fresh. Once all data has been erased, you can set a new password in the settings, if you like." }, + "incorrectPasswordDialog": { + "incorrectPassword": "Password incorrect", + "incorrectPasswordMessage": "That password is incorrect.", + "tryAgain": "Try again" + }, "unlockApp": "Unlock app" }, "stats": { diff --git a/i18n/en/common.json b/i18n/en/common.json deleted file mode 100644 index e05c5db..0000000 --- a/i18n/en/common.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cancel": "Cancel", - "incorrectPassword": "Password incorrect", - "incorrectPasswordMessage": "That password is incorrect.", - "tryAgain": "Try again" -} diff --git a/i18n/i18n.js b/i18n/i18n.js index 66f5029..7aec838 100644 --- a/i18n/i18n.js +++ b/i18n/i18n.js @@ -3,10 +3,9 @@ import { initReactI18next } from 'react-i18next' // translation files import en from './en.json' -import enCommon from './en/common.json' const resources = { - en: { common: enCommon, translation: en }, + en: { translation: en }, } i18n