diff --git a/src/i18n/locales/en/question.json b/src/i18n/locales/en/question.json index 7c1ce13..8a46fe7 100644 --- a/src/i18n/locales/en/question.json +++ b/src/i18n/locales/en/question.json @@ -22,8 +22,11 @@ "copy_clipboard": "failed to copy to clipboard", "create_sell_order": "failed to Create Sell Order. Try again!", "create_tradebot": "unable to create tradebot", + "decode_transaction": "failed to decode transaction", "decrypt": "unable to decrypt", + "decrypt_message": "failed to decrypt the message. Ensure the data and keys are correct", "decryption_failed": "decryption failed", + "empty_receiver": "receiver cannot be empty!", "encrypt": "unable to encrypt", "encryption_failed": "encryption failed", "encryption_requires_public_key": "encrypting data requires public keys", @@ -35,9 +38,9 @@ "fetch_list": "failed to fetch the list", "fetch_poll": "failed to fetch poll", "fetch_recipient_public_key": "failed to fetch recipient's public key", - "fetch_wallet": "fetch Wallet Failed. Please try again", "fetch_wallet_info": "unable to fetch wallet information", "fetch_wallet_transactions": "unable to fetch wallet transactions", + "fetch_wallet": "fetch Wallet Failed. Please try again", "file_extension": "a file extension could not be derived", "gateway_balance_local_node": "cannot view {{ token }} balance through the gateway. Please use your local node.", "gateway_non_qort_local_node": "cannot send a non-QORT coin through the gateway. Please use your local node.", @@ -47,6 +50,8 @@ "insufficient_balance_qort": "your QORT balance is insufficient", "insufficient_balance": "your asset balance is insufficient", "insufficient_funds": "insufficient funds", + "invalid_encryption_iv": "invalid IV: AES-GCM requires a 12-byte IV", + "invalid_encryption_key": "invalid key: AES-GCM requires a 256-bit key.", "invalid_fullcontent": "field fullContent is in an invalid format. Either use a string, base64 or an object", "invalid_receiver": "invalid receiver address or name", "invalid_type": "invalid type", @@ -68,17 +73,19 @@ "poll_create": "failed to create poll", "poll_vote": "failed to vote on the poll", "process_transaction": "unable to process transaction", + "provide_key_shared_link": "for an encrypted resource, you must provide the key to create the shared link", "registered_name": "a registered name is needed to publish", "resources_publish": "some resources have failed to publish", "retrieve_file": "failed to retrieve file", - "retrieve_summary": "failed to retrieve summary", "retrieve_keys": "unable to retrieve keys", + "retrieve_summary": "failed to retrieve summary", + "retrieve_sync_status": "error in retrieving {{ token }} sync status", "same_foreign_blockchain": "all requested ATs need to be of the same foreign Blockchain.", "send": "failed to send", "server_current_add": "failed to add current server", "server_current_set": "failed to set current server", - "server_remove": "failed to remove server", "server_info": "error in retrieving server info", + "server_remove": "failed to remove server", "submit_sell_order": "failed to submit sell order", "synchronization_attempts": "failed to synchronize after {{ quantity }} attempts", "timeout_request": "request timed out", @@ -101,6 +108,7 @@ "no_action_public_node": "this action cannot be done through a public node", "private_service": "please use a private service", "provide_group_id": "please provide a groupId", + "read_transaction_carefully": "read the transaction carefully before accepting!", "user_declined_add_list": "user declined add to list", "user_declined_delete_from_list": "User declined delete from list", "user_declined_delete_hosted_resources": "user declined delete hosted resources", @@ -108,8 +116,8 @@ "user_declined_list": "user declined to get list of hosted resources", "user_declined_request": "user declined request", "user_declined_save_file": "user declined to save file", - "user_declined_share_list": "user declined to share list", - "user_declined_send_message": "user declined to send message" + "user_declined_send_message": "user declined to send message", + "user_declined_share_list": "user declined to share list" } }, "name": "name: {{ name }}", @@ -118,36 +126,36 @@ "permission_access_list": "do you give this application permission to access the list", "permission_all_item_list": "do you give this application permission to add the following to the list {{ name }}:", "permission_authenticate": "do you give this application permission to authenticate?", - "permission_buy_order": "do you give this application permission to perform a buy order?", "permission_buy_order_fee_estimation_one": "this fee is an estimate based on {{ quantity }} order, assuming a 300-byte size at a rate of {{ fee }} {{ ticker }} per KB.", "permission_buy_order_fee_estimation_other": "this fee is an estimate based on {{ quantity }} orders, assuming a 300-byte size at a rate of {{ fee }} {{ ticker }} per KB.", "permission_buy_order_per_kb": "{{ fee }} {{ ticker }} per kb", "permission_buy_order_quantity_one": "{{ quantity }} buy order", "permission_buy_order_quantity_other": "{{ quantity }} buy orders", "permission_buy_order_ticker": "{{ qort_amount }} QORT for {{ foreign_amount }} {{ ticker }}", - "permission_fetch_balance": "do you give this application permission to fetch your {{ coin }} balance", - "permission_list_hosted_data": "do you give this application permission to get a list of your hosted data?", + "permission_buy_order": "do you give this application permission to perform a buy order?", + "permission_cancel_sell_order": "do you give this application permission to perform: cancel a sell order?", "permission_delete_hosts_resources": "do you give this application permission to delete {{ size }} hosted resources?", + "permission_fetch_balance": "do you give this application permission to fetch your {{ coin }} balance", + "permission_get_wallet_info": "do you give this application permission to get your wallet information?", + "permission_get_wallet_transactions": "do you give this application permission to retrieve your wallet transactions", + "permission_list_hosted_data": "do you give this application permission to get a list of your hosted data?", + "permission_order_detail": "{{ qort_amount }} QORT for {{ foreign_amount }} {{ ticker }}", "permission_pay_publish": "do you give this application permission to make the following payments and publishes?", "permission_publish_qdn": "do you give this application permission to publish to QDN?", "permission_remove_from_list": "do you give this application permission to remove the following from the list {{ name }}:", "permission_sell_order": "do you give this application permission to perform a sell order?", - "permission_order_detail": "{{ qort_amount }} QORT for {{ foreign_amount }} {{ ticker }}", - "permission_send_coins": "do you give this application permission to send coins?", - "permission_transfer_asset": "do you give this application permission to transfer the following asset?", - "permission_get_wallet_info": "do you give this application permission to get your wallet information?", - "permission_get_wallet_transactions": "do you give this application permission to retrieve your wallet transactions", "permission_send_chat_message": "do you give this application permission to send this chat message?", - "permission_set_current_server": "do you give this application permission to set the current server?", + "permission_send_coins": "do you give this application permission to send coins?", "permission_server_add": "do you give this application permission to add a server?", "permission_server_remove": "do you give this application permission to remove a server?", - "permission_cancel_sell_order": "do you give this application permission to perform: cancel a sell order?", + "permission_set_current_server": "do you give this application permission to set the current server?", + "permission_transfer_asset": "do you give this application permission to transfer the following asset?", "poll": "poll: {{ name }}", "provide_recipient_group_id": "please provide a recipient or groupId", "request_create_poll": "you are requesting to create the poll below:", "request_vote_poll": "you are being requested to vote on the poll below:", - "sats": "{{ amount }} sats", "sats_per_kb": "{{ amount }} sats per KB", + "sats": "{{ amount }} sats", "server_host": "host: {{ host }}", "server_type": "type: {{ type }}", "to_group": "to: group {{ group_id }}", diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts index c043d64..5cf64d0 100644 --- a/src/qortalRequests/get.ts +++ b/src/qortalRequests/get.ts @@ -3846,7 +3846,13 @@ export const getArrrSyncStatus = async () => { return res; // Return the full response } catch (error) { - throw new Error(error?.message || 'Error in retrieving arrr sync status'); + throw new Error( + error?.message || + i18n.t('question:message.error.retrieve_sync_status', { + token: 'ARRR', + postProcess: 'capitalizeFirstChar', + }) + ); } }; @@ -3936,7 +3942,9 @@ export const sendCoin = async (data, isFromExtension) => { throw new Error(errorMsg); } if (recipient.length === 0) { - const errorMsg = 'Receiver cannot be empty!'; + const errorMsg = i18n.t('question:message.error.empty_receiver', { + postProcess: 'capitalizeFirstChar', + }); throw new Error(errorMsg); } @@ -3945,7 +3953,10 @@ export const sendCoin = async (data, isFromExtension) => { text1: i18n.t('question:permission_send_coins', { postProcess: 'capitalizeFirstChar', }), - text2: `To: ${recipient}`, + text2: i18n.t('question:to_recipient', { + recipient: recipient, + postProcess: 'capitalizeFirstChar', + }), highlightedText: `${amount} ${checkCoin}`, fee: fee, confirmCheckbox: true, @@ -3999,7 +4010,10 @@ export const sendCoin = async (data, isFromExtension) => { text1: i18n.t('question:permission_send_coins', { postProcess: 'capitalizeFirstChar', }), - text2: `To: ${recipient}`, + text2: i18n.t('question:to_recipient', { + recipient: recipient, + postProcess: 'capitalizeFirstChar', + }), highlightedText: `${amount} ${checkCoin}`, foreignFee: `${fee} BTC`, }, @@ -4073,7 +4087,10 @@ export const sendCoin = async (data, isFromExtension) => { text1: i18n.t('question:permission_send_coins', { postProcess: 'capitalizeFirstChar', }), - text2: `To: ${recipient}`, + text2: i18n.t('question:to_recipient', { + recipient: recipient, + postProcess: 'capitalizeFirstChar', + }), highlightedText: `${amount} ${checkCoin}`, foreignFee: `${fee} LTC`, }, @@ -5092,12 +5109,20 @@ export const signTransaction = async (data, isFromExtension) => { }, body: _body, }); - if (!response.ok) throw new Error('Failed to decode transaction'); + if (!response.ok) + throw new Error( + i18n.t('question:message.error.decode_transaction', { + postProcess: 'capitalizeFirstChar', + }) + ); const decodedData = await response.json(); const resPermission = await getUserPermission( { text1: `Do you give this application permission to ${shouldProcess ? 'SIGN and PROCESS' : 'SIGN'} a transaction?`, - highlightedText: 'Read the transaction carefully before accepting!', + highlightedText: i18n.t( + 'question:message.generic.read_transaction_carefully', + { postProcess: 'capitalizeFirstChar' } + ), text2: `Tx type: ${decodedData.type}`, json: decodedData, }, @@ -5249,7 +5274,9 @@ export const createAndCopyEmbedLink = async (data, isFromExtension) => { missingFieldsFunc(data, ['type', 'name', 'service', 'identifier']); if (data?.encryptionType === 'private' && !data?.key) { throw new Error( - 'For an encrypted resource, you must provide the key to create the shared link' + i18n.t('question:message.generic.provide_key_shared_link', { + postProcess: 'capitalizeFirstChar', + }) ); } const queryParams = buildQueryParams(data); @@ -6089,10 +6116,18 @@ export const decryptAESGCMRequest = async (data, isFromExtension) => { const ciphertext = base64ToUint8Array(encryptedData); // Validate IV and key lengths if (ivUint8Array.length !== 12) { - throw new Error('Invalid IV: AES-GCM requires a 12-byte IV.'); + throw new Error( + i18n.t('question:message.error.invalid_encryption_iv', { + postProcess: 'capitalizeFirstChar', + }) + ); } if (encryptionKey.length !== 32) { - throw new Error('Invalid key: AES-GCM requires a 256-bit key.'); + throw new Error( + i18n.t('question:message.error.invalid_encryption_key', { + postProcess: 'capitalizeFirstChar', + }) + ); } try { @@ -6116,7 +6151,9 @@ export const decryptAESGCMRequest = async (data, isFromExtension) => { } catch (error) { console.error('Decryption failed:', error); throw new Error( - 'Failed to decrypt the message. Ensure the data and keys are correct.' + i18n.t('question:message.error.decrypt_message', { + postProcess: 'capitalizeFirstChar', + }) ); } };