diff --git a/src/components/NotAuthenticated.tsx b/src/components/NotAuthenticated.tsx index 0ee147c..192379e 100644 --- a/src/components/NotAuthenticated.tsx +++ b/src/components/NotAuthenticated.tsx @@ -118,7 +118,10 @@ export const NotAuthenticated = ({ window.sendMessage('setCustomNodes', copyPrev).catch((error) => { console.error( 'Failed to set custom nodes:', - error.message || 'An error occurred' + error.message || + t('core:message.error.generic', { + postProcess: 'capitalizeFirstChar', + }) ); }); return copyPrev; @@ -175,7 +178,10 @@ export const NotAuthenticated = ({ .catch((error) => { console.error( 'Failed to get custom nodes from storage:', - error.message || 'An error occurred' + error.message || + t('core:message.error.generic', { + postProcess: 'capitalizeFirstChar', + }) ); }); }, []); @@ -238,7 +244,11 @@ export const NotAuthenticated = ({ const stillHasLocal = await checkIfUserHasLocalNode(); if (isLocalKey && !stillHasLocal && !fromStartUp) { - throw new Error('Please turn on your local node'); + throw new Error( + t('auth:message.generic.turn_local_node', { + postProcess: 'capitalizeFirstChar', + }) + ); } //check custom nodes // !gateways.some(gateway => apiKey?.url?.includes(gateway)) @@ -297,7 +307,10 @@ export const NotAuthenticated = ({ .catch((error) => { console.error( 'Failed to set custom nodes:', - error.message || 'An error occurred' + error.message || + t('core:message.error.generic', { + postProcess: 'capitalizeFirstChar', + }) ); }); return copyPrev; @@ -348,7 +361,9 @@ export const NotAuthenticated = ({ console.error( 'Failed to set API key:', error.message || - t('core:error', { postProcess: 'capitalizeFirstChar' }) + t('core:message.error.generic', { + postProcess: 'capitalizeFirstChar', + }) ); }); } else { @@ -383,7 +398,7 @@ export const NotAuthenticated = ({ console.error( 'Failed to set API key:', error.message || - t('core:error', { + t('core:message.error.generic', { postProcess: 'capitalizeFirstChar', }) ); @@ -451,7 +466,10 @@ export const NotAuthenticated = ({ .catch((error) => { console.error( 'Failed to set custom nodes:', - error.message || 'An error occurred' + error.message || + t('core:message.error.generic', { + postProcess: 'capitalizeFirstChar', + }) ); }); }; @@ -547,7 +565,9 @@ export const NotAuthenticated = ({ postProcess: 'capitalizeFirstChar', })} + + { console.error( 'Failed to set API key:', - error.message || 'An error occurred' + error.message || + t('core:message.error.generic', { + postProcess: 'capitalizeFirstChar', + }) ); }); } @@ -808,7 +831,10 @@ export const NotAuthenticated = ({ .catch((error) => { console.error( 'Failed to set API key:', - error.message || 'An error occurred' + error.message || + t('core:message.error.generic', { + postProcess: 'capitalizeFirstChar', + }) ); }); }} @@ -869,7 +895,10 @@ export const NotAuthenticated = ({ .catch((error) => { console.error( 'Failed to set API key:', - error.message || 'An error occurred' + error.message || + t('core:message.error.generic', { + postProcess: 'capitalizeFirstChar', + }) ); }); }} @@ -1066,7 +1095,10 @@ export const NotAuthenticated = ({ .catch((error) => { console.error( 'Failed to set custom nodes:', - error.message || 'An error occurred' + error.message || + t('core:message.error.generic', { + postProcess: 'capitalizeFirstChar', + }) ); }); return copyPrev; diff --git a/src/hooks/useHandlePrivateApps.tsx b/src/hooks/useHandlePrivateApps.tsx index 1115b52..74be902 100644 --- a/src/hooks/useHandlePrivateApps.tsx +++ b/src/hooks/useHandlePrivateApps.tsx @@ -69,7 +69,11 @@ export const useHandlePrivateApps = () => { ); } - throw new Error('Unable to fetch app'); + throw new Error( + t('core:message.error.unable_fetch_app', { + postProcess: 'capitalizeFirstChar', + }) + ); } data = await responseData.text(); diff --git a/src/hooks/useQortalGetSaveSettings.tsx b/src/hooks/useQortalGetSaveSettings.tsx index dc307eb..214455b 100644 --- a/src/hooks/useQortalGetSaveSettings.tsx +++ b/src/hooks/useQortalGetSaveSettings.tsx @@ -30,7 +30,6 @@ function fetchFromLocalStorage(key) { } const getPublishRecord = async (myName) => { - // const validApi = await findUsableApi(); const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT_PRIVATE&identifier=ext_saved_settings&exactmatchnames=true&limit=1&prefix=true&name=${myName}`; const response = await fetch(url); if (!response.ok) { diff --git a/src/i18n/locales/en/auth.json b/src/i18n/locales/en/auth.json index fb84c57..2822ffa 100644 --- a/src/i18n/locales/en/auth.json +++ b/src/i18n/locales/en/auth.json @@ -79,6 +79,7 @@ "keep_secure": "keep your account file secure", "publishing_key": "reminder: After publishing the key, it will take a couple of minutes for it to appear. Please just wait.", "seedphrase_notice": "a SEEDPHRASE has been randomly generated in the background.", + "turn_local_node": "please turn on your local node", "type_seed": "type or paste in your seed-phrase", "your_accounts": "your saved accounts" }, diff --git a/src/i18n/locales/en/core.json b/src/i18n/locales/en/core.json index 50fb40d..698e167 100644 --- a/src/i18n/locales/en/core.json +++ b/src/i18n/locales/en/core.json @@ -198,6 +198,7 @@ "unable_decrypt_app": "unable to decrypt private app'", "unable_encrypt_app": "unable to encrypt app. App not published'", "unable_fetch_app": "unable to fetch app", + "unable_fetch_publish": "unable to fetch publish", "unable_publish_app": "unable to publish app", "unable_publish_image": "unable to publish image", "unable_rate": "unable to rate",