From 0c8cd67ed89c1f03048d27b2b61df1e8db6137b9 Mon Sep 17 00:00:00 2001 From: Alexander Evchenko Date: Thu, 21 Sep 2023 11:20:07 +0400 Subject: [PATCH] chore: change strings to translation contants --- src/lib/i18n.ts | 3 +++ src/screens/contacts/ContactFormScreen.tsx | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/i18n.ts b/src/lib/i18n.ts index 9b916e12c..51c7b80c0 100644 --- a/src/lib/i18n.ts +++ b/src/lib/i18n.ts @@ -14,6 +14,7 @@ const resources = { address_copied_to_keyboard: 'Address copied to Clipboard', message_copied_to_clipboard: 'Copied to Clipboard', ok: 'OK', + back: 'Go Back', basic_row_pending: '• Pending', basic_row_failed: '• Failed', type_placeholder: 'type...', @@ -175,6 +176,8 @@ const resources = { contact_form_button_convert_checksum: 'Convert to correct checksum', contact_form_button_add_proposed_contact: 'Add', contact_form_button_add_proposed_contact_ending: 'to your Contacts', + contact_form_alert_title: 'Contact already exists!', + contact_form_edit_existing_button: 'Edit existing contact', transaction_form_label_asset: 'asset', transaction_summary_screen_title: 'Transaction Summary', transaction_summary_send_title: 'Send', diff --git a/src/screens/contacts/ContactFormScreen.tsx b/src/screens/contacts/ContactFormScreen.tsx index 777e48667..eb1ab9570 100644 --- a/src/screens/contacts/ContactFormScreen.tsx +++ b/src/screens/contacts/ContactFormScreen.tsx @@ -102,8 +102,11 @@ export const ContactFormScreen = ({ formState: { errors }, } = methods + // form values const addressObj = watch('address') const nameValue = watch('name') + + // form errors const hasErrors = addressObj.address.length === 0 || nameValue.length === 0 || @@ -145,16 +148,16 @@ export const ContactFormScreen = ({ const contactExists = checkIfContactExists(displayAddress, contacts) if (contactExists) { - Alert.alert('Contact already exists!', undefined, [ + Alert.alert(t('contact_form_alert_title'), undefined, [ { - text: 'Go Back', + text: t('back'), onPress: () => { navigation.replace(contactsStackRouteNames.ContactsList) proposed && navigation.navigate(rootTabsRouteNames.Home) }, }, { - text: 'Edit existing contact', + text: t('contact_form_edit_existing_button'), onPress: () => { dispatch(editContact(contact)) navigation.replace(contactsStackRouteNames.ContactsList) @@ -181,6 +184,7 @@ export const ContactFormScreen = ({ proposed, contacts, checkIfContactExists, + t, ], )