Skip to content

Commit 86ef930

Browse files
committed
fix: add missing translations
1 parent 72f7c99 commit 86ef930

File tree

12 files changed

+201
-99
lines changed

12 files changed

+201
-99
lines changed

App.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { checkNetworkConnection, showToast } from './src/utils/helpers.ts';
1717
import { setDeepLink } from './src/store/slices/pubkysSlice.ts';
1818
import { parseInput } from './src/utils/inputParser.ts';
1919
import { SafeAreaProvider } from 'react-native-safe-area-context';
20+
import { useTranslation } from 'react-i18next';
2021

2122
const _toastConfig = toastConfig();
2223

@@ -25,6 +26,7 @@ function App(): React.JSX.Element {
2526
const currentTheme = useSelector(getTheme);
2627
const isOnline = useSelector(getIsOnline);
2728
const dispatch = useDispatch();
29+
const { t } = useTranslation();
2830

2931
// Handle deep linking
3032
useEffect(() => {
@@ -78,14 +80,14 @@ function App(): React.JSX.Element {
7880
if (isConnected) {
7981
showToast({
8082
type: 'success',
81-
title: "You're Back Online!",
82-
description: 'You can now authorize with Pubky Ring',
83+
title: t('network.backOnline'),
84+
description: t('network.backOnlineDescription'),
8385
});
8486
} else {
8587
showToast({
8688
type: 'error',
87-
title: 'Currently Offline',
88-
description: 'You need to be online to authorize with Pubky Ring',
89+
title: t('network.currentlyOffline'),
90+
description: t('network.offlineDescription'),
8991
autoHide: false,
9092
});
9193
}
@@ -97,7 +99,7 @@ function App(): React.JSX.Element {
9799
clearTimeout(timer);
98100
unsubscribe();
99101
};
100-
}, [dispatch, isOnline]);
102+
}, [dispatch, isOnline, t]);
101103

102104
const theme = useMemo(() => {
103105
switch (currentTheme) {

src/hooks/inputHandlerUtils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ export const handleNoPubkysAvailable = (
113113
// Has pubkys but none are set up
114114
showToast({
115115
type: 'info',
116-
title: 'No Pubkys are setup',
117-
description: 'Please setup any of your existing Pubkys to proceed.',
116+
title: i18n.t('pubky.noPubkysSetup'),
117+
description: i18n.t('pubky.setupExistingToProcess'),
118118
visibilityTime: 5000,
119119
});
120120
} else {
121121
// No pubkys at all - show add-pubky sheet if callbacks provided
122122
showToast({
123123
type: 'info',
124-
title: 'No Pubkys exist',
125-
description: 'Please add and setup a Pubky to proceed.',
124+
title: i18n.t('pubky.noPubkysExist'),
125+
description: i18n.t('pubky.addAndSetupToProcess'),
126126
visibilityTime: 5000,
127127
onPress: callbacks?.createPubky && callbacks?.importPubky ? (): void => {
128128
SheetManager.show('add-pubky', {

src/hooks/usePubkyManagement.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,23 @@ import { EBackupPreference } from '../types/pubky';
1818
import { getStore } from "../utils/store-helpers.ts";
1919
import { getPubkyKeys } from '../store/selectors/pubkySelectors';
2020
import { copyToClipboard } from "../utils/clipboard.ts";
21+
import { useTranslation } from 'react-i18next';
2122

2223
export const usePubkyManagement = (): {
2324
createPubky: () => Promise<void>;
2425
importPubky: (mnemonic?: string) => Promise<Result<string>>;
2526
confirmPubkyBackup: (pubky: string, backupPreference: EBackupPreference) => void;
2627
} => {
2728
const dispatch = useDispatch();
29+
const { t } = useTranslation();
2830

2931
const createPubky = useCallback(async () => {
3032
const pubky = await createNewPubky(dispatch);
3133
if (pubky.isErr()) {
3234
showToast({
3335
type: 'error',
34-
title: 'Error',
35-
description: 'An error occurred while creating the Pubky',
36+
title: t('common.error'),
37+
description: t('pubkyErrors.createError'),
3638
});
3739
return;
3840
}
@@ -41,7 +43,7 @@ export const usePubkyManagement = (): {
4143
pubky: pubky.value,
4244
});
4345
}, 200);
44-
}, [dispatch]);
46+
}, [dispatch, t]);
4547

4648
const importPubky = useCallback(
4749
async (data = ''): Promise<Result<string>> => {
@@ -53,7 +55,7 @@ export const usePubkyManagement = (): {
5355
return err(res.error.message);
5456
}
5557
if (!res.value.isSecretKey) {
56-
return err('Not a valid secret key or recovery phrase.');
58+
return err(t('import.notValidSecretKey'));
5759
}
5860

5961
let secretKey = '';
@@ -74,7 +76,7 @@ export const usePubkyManagement = (): {
7476
const msg = secretKeyRes.error.message;
7577
showToast({
7678
type: 'error',
77-
title: 'Error',
79+
title: t('common.error'),
7880
description: msg,
7981
});
8082
return err(msg);
@@ -91,7 +93,7 @@ export const usePubkyManagement = (): {
9193
const msg = pubky.error.message;
9294
showToast({
9395
type: 'error',
94-
title: 'Error',
96+
title: t('common.error'),
9597
description: msg,
9698
});
9799
return err(msg);
@@ -105,29 +107,29 @@ export const usePubkyManagement = (): {
105107
onContinue: () => {
106108
setTimeout(() => {
107109
showEditPubkySheet({
108-
title: 'Setup',
110+
title: t('pubky.setup'),
109111
pubky: pubky.value,
110112
});
111113
}, 200);
112114
},
113115
});
114116
}, 200);
115-
return ok('Successfully created pubky.');
117+
return ok(t('pubky.successfullyCreated'));
116118
}
117119
}
118120

119121
const importFileRes = await importFile(dispatch);
120122
if (importFileRes.isErr()) {
121-
const msg = importFileRes.error?.message ?? 'Unable to import file.';
123+
const msg = importFileRes.error?.message ?? t('import.unableToImportFile');
122124
if (importFileRes.error?.message && importFileRes.error.message !== 'OPERATION_CANCELED') {
123125
showToast({
124126
type: 'error',
125-
title: 'Error',
127+
title: t('common.error'),
126128
description: msg,
127129
onPress: () => {
128130
copyToClipboard(msg);
129131
// eslint-disable-next-line no-alert
130-
alert('Error message copied to clipboard');
132+
alert(t('errors.errorCopiedToClipboard'));
131133
},
132134
visibilityTime: 10000,
133135
});
@@ -143,18 +145,18 @@ export const usePubkyManagement = (): {
143145
onContinue: () => {
144146
setTimeout(() => {
145147
showEditPubkySheet({
146-
title: 'Setup',
148+
title: t('pubky.setup'),
147149
pubky: importFileRes.value,
148150
});
149151
}, 200);
150152
}
151153
});
152154
}, 200);
153155

154-
const msg = 'Pubky imported successfully';
156+
const msg = t('import.pubkyImportedSuccessfully');
155157
return ok(msg);
156158
},
157-
[dispatch],
159+
[dispatch, t],
158160
);
159161

160162
const confirmPubkyBackup = useCallback(

src/i18n/locales/en.json

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@
7979
"pubkyImported": "Pubky Imported",
8080
"pubkyReImported": "Pubky Re-Imported",
8181
"importSuccess": "You successfully imported your Pubky.",
82-
"reImportSuccess": "You successfully re-imported your Pubky."
82+
"reImportSuccess": "You successfully re-imported your Pubky.",
83+
"notValidSecretKey": "Not a valid secret key or recovery phrase.",
84+
"unableToImportFile": "Unable to import file."
8385
},
8486
"pubky": {
8587
"noSelection": "No Pubky Selected",
@@ -91,7 +93,12 @@
9193
"selectPubkyMessage": "Select which pubky you want to use to authorize this service, browser or device.",
9294
"noPubkysAvailable": "You do not have any pubky's that are setup and available. Please create and setup a pubky first.",
9395
"yourPubky": "Your pubky.",
94-
"yourPubkyDescription": "This is your first unique identifier, your pubky. Create as many as you need for different purposes. You are your keys."
96+
"yourPubkyDescription": "This is your first unique identifier, your pubky. Create as many as you need for different purposes. You are your keys.",
97+
"noPubkysSetup": "No Pubkys are setup",
98+
"setupExistingToProcess": "Please setup any of your existing Pubkys to proceed.",
99+
"noPubkysExist": "No Pubkys exist",
100+
"addAndSetupToProcess": "Please add and setup a Pubky to proceed.",
101+
"successfullyCreated": "Successfully created pubky."
95102
},
96103
"backup": {
97104
"encryptedFile": "Encrypted File",
@@ -108,7 +115,10 @@
108115
"recoveryPhraseMessage": "Write down these 12 words in the right order and store them in a safe place.",
109116
"tapToReveal": "Tap to reveal",
110117
"recoveryWarning": "Never share your recovery phrase with anyone as this may result in the loss of access to your profile, data, and online identity.",
111-
"finishBackup": "Finish backup"
118+
"finishBackup": "Finish backup",
119+
"couldNotRetrieveSecretKey": "Could not retrieve secret key for backup",
120+
"backupCreated": "Backup Created",
121+
"failedToCreateBackup": "Failed to create backup file"
112122
},
113123
"onboarding": {
114124
"title": "Keychain for the next web.",
@@ -155,7 +165,8 @@
155165
"failedToGetSecretKey": "Failed to get secret key",
156166
"failedToProcessAuth": "Failed to process auth",
157167
"failedToImportPubky": "Failed to import pubky",
158-
"failedToCreatePubkyWithInvite": "Failed to create pubky with invite code"
168+
"failedToCreatePubkyWithInvite": "Failed to create pubky with invite code",
169+
"errorCopiedToClipboard": "Error message copied to clipboard"
159170
},
160171
"terms": {
161172
"title": "Terms of Use.",
@@ -234,7 +245,25 @@
234245
"unableToGetSecretKey": "Unable to get secret key",
235246
"invalidInviteCode": "Invalid invite code. Please check and try again.",
236247
"unableToSignIn": "Unable to sign in: {{error}}",
237-
"unexpectedError": "An unexpected error occurred. Please try again."
248+
"unexpectedError": "An unexpected error occurred. Please try again.",
249+
"createError": "An error occurred while creating the Pubky",
250+
"failedToGenerateSecretKey": "Failed to generate secret key",
251+
"failedToCreatePubky": "Failed to create pubky",
252+
"failedToSavePubky": "Failed to save pubky",
253+
"expectedImageData": "Expected image data but received text",
254+
"failedToGetPublicKey": "Failed to get public key from secret key",
255+
"mnemonicDoesNotMatchSecretKey": "The provided mnemonic phrase does not generate the expected secret key.",
256+
"mnemonicDoesNotMatchPubky": "The provided mnemonic phrase does not generate the expected pubky.",
257+
"failedToSaveToKeychain": "Failed to save pubky to keychain",
258+
"errorSavingPubky": "Error saving pubky",
259+
"errorDeletingPubky": "Error deleting pubky",
260+
"secretKeyNotFoundInKeychain": "Secret key not found in keychain",
261+
"failedToGetSecretKeyFromKeychain": "Failed to get secret key from keychain",
262+
"homeserverNotFound": "Homeserver not found for this pubky. Please ensure the pubky is properly configured.",
263+
"failedToSignOut": "Failed to sign out of homeserver",
264+
"pubkyRequiredForAuth": "Pubky is required for auth",
265+
"failedToGetSecretKey": "Failed to get secret key",
266+
"authorizationError": "An error occurred during authorization"
238267
},
239268
"inviteCode": {
240269
"title": "Invite code.",
@@ -276,5 +305,23 @@
276305
"settings": "Settings",
277306
"pubkyDetail": "Pubky Details",
278307
"editPubky": "Edit Pubky"
308+
},
309+
"permissions": {
310+
"cameraTitle": "Permission to use camera",
311+
"cameraMessage": "Pubky Ring needs permission to use your camera"
312+
},
313+
"keychain": {
314+
"failedToGetValue": "Failed to get keychain value",
315+
"failedToSetValue": "Failed to set keychain value",
316+
"failedToResetValue": "Failed to reset keychain value"
317+
},
318+
"signup": {
319+
"failedToGenerateKeypair": "Failed to generate keypair",
320+
"signupSuccessful": "Signup Successful",
321+
"newPubkyCreated": "Your new Pubky has been created",
322+
"failedToProcessSignup": "Failed to process signup"
323+
},
324+
"invite": {
325+
"unknownErrorProcessing": "Unknown error processing invite"
279326
}
280327
}

src/i18n/locales/es.json

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@
7979
"pubkyImported": "Pubky Importado",
8080
"pubkyReImported": "Pubky reimportado",
8181
"importSuccess": "Ha importado correctamente su Pubky.",
82-
"reImportSuccess": "Ha reimportado correctamente su Pubky."
82+
"reImportSuccess": "Ha reimportado correctamente su Pubky.",
83+
"notValidSecretKey": "No es una clave secreta o frase de recuperación válida.",
84+
"unableToImportFile": "No se puede importar el archivo."
8385
},
8486
"pubky": {
8587
"noSelection": "No Pubky Seleccionado",
@@ -91,7 +93,12 @@
9193
"selectPubkyMessage": "Seleccione qué pubky desea utilizar para autorizar este servicio, navegador o dispositivo.",
9294
"noPubkysAvailable": "No tiene ningún pubky configurado y disponible. Por favor, cree y configure primero un pubky.",
9395
"yourPubky": "Su pubky.",
94-
"yourPubkyDescription": "Este es su primer identificador único, su pubky. Cree tantos como necesite para distintos fines. Usted es su clave."
96+
"yourPubkyDescription": "Este es su primer identificador único, su pubky. Cree tantos como necesite para distintos fines. Usted es su clave.",
97+
"noPubkysSetup": "No hay Pubkys",
98+
"setupExistingToProcess": "Por favor, configure cualquiera de sus Pubkys existentes para continuar.",
99+
"noPubkysExist": "No existen Pubkys",
100+
"addAndSetupToProcess": "Por favor, añada y configure un Pubky para continuar.",
101+
"successfullyCreated": "Creado con éxito pubky."
95102
},
96103
"backup": {
97104
"encryptedFile": "Archivo cifrado",
@@ -108,7 +115,10 @@
108115
"recoveryPhraseMessage": "Escriba estas 12 palabras en el orden correcto y guárdelas en un lugar seguro.",
109116
"tapToReveal": "Toque para revelar",
110117
"recoveryWarning": "Nunca comparta su frase de recuperación con nadie, ya que podría perder el acceso a su perfil, datos e identidad en línea.",
111-
"finishBackup": "Finalizar la copia de seguridad"
118+
"finishBackup": "Finalizar la copia de seguridad",
119+
"couldNotRetrieveSecretKey": "No se ha podido recuperar la clave secreta para la copia de seguridad",
120+
"backupCreated": "Copia de seguridad creada",
121+
"failedToCreateBackup": "Fallo al crear el archivo de copia de seguridad"
112122
},
113123
"onboarding": {
114124
"title": "Llavero para la próxima web.",
@@ -155,7 +165,8 @@
155165
"failedToGetSecretKey": "Fallo al obtener la clave secreta",
156166
"failedToProcessAuth": "Fallo al procesar auth",
157167
"failedToImportPubky": "Fallo al importar pubky",
158-
"failedToCreatePubkyWithInvite": "Fallo al crear pubky con código de invitación"
168+
"failedToCreatePubkyWithInvite": "Fallo al crear pubky con código de invitación",
169+
"errorCopiedToClipboard": "Mensaje de error copiado en el portapapeles"
159170
},
160171
"terms": {
161172
"title": "Condiciones de uso.",
@@ -234,7 +245,25 @@
234245
"unableToGetSecretKey": "No se puede obtener la clave secreta",
235246
"invalidInviteCode": "Código de invitación no válido. Por favor, compruébelo e inténtelo de nuevo.",
236247
"unableToSignIn": "No se puede iniciar sesión: {{error}}",
237-
"unexpectedError": "Se ha producido un error inesperado. Por favor, inténtelo de nuevo."
248+
"unexpectedError": "Se ha producido un error inesperado. Por favor, inténtelo de nuevo.",
249+
"createError": "Se ha producido un error al crear el Pubky",
250+
"failedToGenerateSecretKey": "Fallo al generar la clave secreta",
251+
"failedToCreatePubky": "Fallo al crear pubky",
252+
"failedToSavePubky": "No salvó a pubky",
253+
"expectedImageData": "Se esperaban datos de imagen pero se recibió texto",
254+
"failedToGetPublicKey": "Fallo al obtener la clave pública a partir de la clave secreta",
255+
"mnemonicDoesNotMatchSecretKey": "La frase mnemotécnica proporcionada no genera la clave secreta esperada.",
256+
"mnemonicDoesNotMatchPubky": "La frase mnemotécnica proporcionada no genera el pubky esperado.",
257+
"failedToSaveToKeychain": "Fallo al guardar pubky en el llavero",
258+
"errorSavingPubky": "Error al guardar pubky",
259+
"errorDeletingPubky": "Error al borrar pubky",
260+
"secretKeyNotFoundInKeychain": "Clave secreta no encontrada en el llavero",
261+
"failedToGetSecretKeyFromKeychain": "Fallo al obtener la clave secreta del llavero",
262+
"homeserverNotFound": "Homeserver no encontrado para este pubky. Por favor, asegúrese de que el pubky está configurado correctamente.",
263+
"failedToSignOut": "Fallo al cerrar sesión en el servidor doméstico",
264+
"pubkyRequiredForAuth": "Pubky es necesario para auth",
265+
"failedToGetSecretKey": "Fallo al obtener la clave secreta",
266+
"authorizationError": "Se ha producido un error durante la autorización"
238267
},
239268
"inviteCode": {
240269
"title": "Código de invitación.",
@@ -276,5 +305,23 @@
276305
"settings": "Ajustes",
277306
"pubkyDetail": "Detalles del Pubky",
278307
"editPubky": "Editar Pubky"
308+
},
309+
"permissions": {
310+
"cameraTitle": "Permiso para utilizar la cámara",
311+
"cameraMessage": "Pubky Ring necesita permiso para usar su cámara"
312+
},
313+
"keychain": {
314+
"failedToGetValue": "Fallo al obtener el valor del llavero",
315+
"failedToSetValue": "Fallo al establecer el valor del llavero",
316+
"failedToResetValue": "Fallo al restablecer el valor del llavero"
317+
},
318+
"signup": {
319+
"failedToGenerateKeypair": "Fallo al generar el par de claves",
320+
"signupSuccessful": "Inscripción realizada con éxito",
321+
"newPubkyCreated": "Su nuevo Pubky ha sido creado",
322+
"failedToProcessSignup": "No se ha podido procesar la inscripción"
323+
},
324+
"invite": {
325+
"unknownErrorProcessing": "Unknown error processing invite"
279326
}
280327
}

src/utils/actions/inviteAction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ export const handleInviteAction = async (
7171

7272
return ok(pubky);
7373
} catch (error) {
74-
const errorMessage = error instanceof Error ? error.message : 'Unknown error processing invite';
74+
const errorMessage = error instanceof Error ? error.message : i18n.t('invite.unknownErrorProcessing');
7575
console.error('Error handling invite code:', errorMessage);
7676
showToast({
7777
type: 'error',
78-
title: 'Error',
79-
description: 'Failed to process invite code',
78+
title: i18n.t('common.error'),
79+
description: i18n.t('errors.inviteProcessingFailed'),
8080
});
8181
return err(errorMessage);
8282
}

0 commit comments

Comments
 (0)