From 37acd87c440c971118c5ec78c7dbff07367e299e Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Fri, 17 Oct 2025 13:55:48 +0200 Subject: [PATCH] Fix context menu translations which prevented clickhandler from working (#520) --- .../components/credentials/CredentialCard.tsx | 18 ++++++++++-------- apps/mobile-app/i18n/locales/en.json | 5 ++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/apps/mobile-app/components/credentials/CredentialCard.tsx b/apps/mobile-app/components/credentials/CredentialCard.tsx index 60ae6c69b..8b1e55b84 100644 --- a/apps/mobile-app/components/credentials/CredentialCard.tsx +++ b/apps/mobile-app/components/credentials/CredentialCard.tsx @@ -83,15 +83,17 @@ export function CredentialCard({ credential, onCredentialDelete }: CredentialCar const handleContextMenuAction = async (event: OnPressMenuItemEvent): Promise => { const { name } = event.nativeEvent; + console.log('handleContextMenuAction', name); + switch (name) { - case 'Edit': + case t('credentials.contextMenu.edit'): Keyboard.dismiss(); router.push({ pathname: '/(tabs)/credentials/add-edit', params: { id: credential.Id } }); break; - case 'Delete': + case t('credentials.contextMenu.delete'): Keyboard.dismiss(); Alert.alert( t('credentials.deleteCredential'), @@ -116,37 +118,37 @@ export function CredentialCard({ credential, onCredentialDelete }: CredentialCar ] ); break; - case 'Copy Username': + case t('credentials.contextMenu.copyUsername'): if (credential.Username) { await copyToClipboard(credential.Username); if (Platform.OS === 'ios') { Toast.show({ type: 'success', - text1: 'Username copied to clipboard', + text1: t('credentials.toasts.usernameCopied'), position: 'bottom', }); } } break; - case 'Copy Email': + case t('credentials.contextMenu.copyEmail'): if (credential.Alias?.Email) { await copyToClipboard(credential.Alias.Email); if (Platform.OS === 'ios') { Toast.show({ type: 'success', - text1: 'Email copied to clipboard', + text1: t('credentials.toasts.emailCopied'), position: 'bottom', }); } } break; - case 'Copy Password': + case t('credentials.contextMenu.copyPassword'): if (credential.Password) { await copyToClipboard(credential.Password); if (Platform.OS === 'ios') { Toast.show({ type: 'success', - text1: 'Password copied to clipboard', + text1: t('credentials.toasts.passwordCopied'), position: 'bottom', }); } diff --git a/apps/mobile-app/i18n/locales/en.json b/apps/mobile-app/i18n/locales/en.json index 55ea79696..42a24a8c8 100644 --- a/apps/mobile-app/i18n/locales/en.json +++ b/apps/mobile-app/i18n/locales/en.json @@ -167,7 +167,10 @@ "toasts": { "credentialUpdated": "Credential updated successfully", "credentialCreated": "Credential created successfully", - "credentialDeleted": "Credential deleted successfully" + "credentialDeleted": "Credential deleted successfully", + "usernameCopied": "Username copied to clipboard", + "emailCopied": "Email copied to clipboard", + "passwordCopied": "Password copied to clipboard" }, "createNewAliasFor": "Create new alias for", "errors": {