diff --git a/src/i18n/locales/en/question.json b/src/i18n/locales/en/question.json index 3671c17..7c1ce13 100644 --- a/src/i18n/locales/en/question.json +++ b/src/i18n/locales/en/question.json @@ -9,6 +9,7 @@ "amount_qty": "amount: {{ quantity }}", "asset_name": "asset: {{ asset }}", "assets_used_pay": "asset used in payments: {{ asset }}", + "coin": "coin: {{ coin }}", "description": "description: {{ description }}", "deploy_at": "would you like to deploy this AT?", "download_file": "would you like to download:", @@ -28,6 +29,7 @@ "encryption_requires_public_key": "encrypting data requires public keys", "fetch_balance_token": "failed to fetch {{ token }} Balance. Try again!", "fetch_balance": "unable to fetch balance", + "fetch_connection_history": "failed to fetch server connection history", "fetch_generic": "unable to fetch", "fetch_group": "failed to fetch the group", "fetch_list": "failed to fetch the list", @@ -69,9 +71,13 @@ "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", "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", "submit_sell_order": "failed to submit sell order", "synchronization_attempts": "failed to synchronize after {{ quantity }} attempts", @@ -126,18 +132,24 @@ "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_sell_order_detail": "{{ qort_amount }} QORT for {{ foreign_amount }} {{ ticker }}", + "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_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?", "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", + "server_host": "host: {{ host }}", + "server_type": "type: {{ type }}", "to_group": "to: group {{ group_id }}", "to_recipient": "to: {{ recipient }}", "total_locking_fee": "total Locking Fee:", diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts index 4a45593..c043d64 100644 --- a/src/qortalRequests/get.ts +++ b/src/qortalRequests/get.ts @@ -3294,7 +3294,10 @@ export const updateForeignFee = async (data, isFromExtension) => { text2: `type: ${type === 'feerequired' ? 'unlocking' : 'locking'}`, text3: `value: ${text3}`, text4, - highlightedText: `Coin: ${coin}`, + highlightedText: i18n.t('question:coin', { + coin: coin, + postProcess: 'capitalizeFirstChar', + }), }, isFromExtension ); @@ -3372,7 +3375,11 @@ export const getServerConnectionHistory = async (data) => { }); if (!response.ok) - throw new Error('Failed to fetch server connection history'); + throw new Error( + i18n.t('question:message.error.fetch_connection_history', { + postProcess: 'capitalizeFirstChar', + }) + ); let res; try { @@ -3387,7 +3394,12 @@ export const getServerConnectionHistory = async (data) => { return res; // Return full response here } catch (error) { - throw new Error(error?.message || 'Error in get server connection history'); + throw new Error( + error?.message || + i18n.t('question:message.error.fetch_connection_history', { + postProcess: 'capitalizeFirstChar', + }) + ); } }; @@ -3423,10 +3435,21 @@ export const setCurrentForeignServer = async (data, isFromExtension) => { const resPermission = await getUserPermission( { - text1: `Do you give this application permission to set the current server?`, - text2: `type: ${type}`, - text3: `host: ${host}`, - highlightedText: `Coin: ${coin}`, + text1: i18n.t('question:permission_set_current_server', { + postProcess: 'capitalizeFirstChar', + }), + text2: i18n.t('question:server_type', { + type: type, + postProcess: 'capitalizeFirstChar', + }), + text3: i18n.t('question:server_host', { + host: host, + postProcess: 'capitalizeFirstChar', + }), + highlightedText: i18n.t('question:coin', { + coin: coin, + postProcess: 'capitalizeFirstChar', + }), }, isFromExtension ); @@ -3457,7 +3480,12 @@ export const setCurrentForeignServer = async (data, isFromExtension) => { body: JSON.stringify(body), }); - if (!response.ok) throw new Error('Failed to set current server'); + if (!response.ok) + throw new Error( + i18n.t('question:message.error.server_current_set', { + postProcess: 'capitalizeFirstChar', + }) + ); let res; try { @@ -3505,10 +3533,21 @@ export const addForeignServer = async (data, isFromExtension) => { const resPermission = await getUserPermission( { - text1: `Do you give this application permission to add a server?`, - text2: `type: ${type}`, - text3: `host: ${host}`, - highlightedText: `Coin: ${coin}`, + text1: i18n.t('question:permission_server_add', { + postProcess: 'capitalizeFirstChar', + }), + text2: i18n.t('question:server_type', { + type: type, + postProcess: 'capitalizeFirstChar', + }), + text3: i18n.t('question:server_host', { + host: host, + postProcess: 'capitalizeFirstChar', + }), + highlightedText: i18n.t('question:coin', { + coin: coin, + postProcess: 'capitalizeFirstChar', + }), }, isFromExtension ); @@ -3539,7 +3578,12 @@ export const addForeignServer = async (data, isFromExtension) => { body: JSON.stringify(body), }); - if (!response.ok) throw new Error('Failed to add server'); + if (!response.ok) + throw new Error( + i18n.t('question:message.error.server_current_add', { + postProcess: 'capitalizeFirstChar', + }) + ); let res; try { @@ -3587,10 +3631,21 @@ export const removeForeignServer = async (data, isFromExtension) => { const resPermission = await getUserPermission( { - text1: `Do you give this application permission to remove a server?`, - text2: `type: ${type}`, - text3: `host: ${host}`, - highlightedText: `Coin: ${coin}`, + text1: i18n.t('question:permission_server_remove', { + postProcess: 'capitalizeFirstChar', + }), + text2: i18n.t('question:server_type', { + type: type, + postProcess: 'capitalizeFirstChar', + }), + text3: i18n.t('question:server_host', { + host: host, + postProcess: 'capitalizeFirstChar', + }), + highlightedText: i18n.t('question:coin', { + coin: coin, + postProcess: 'capitalizeFirstChar', + }), }, isFromExtension ); @@ -3621,7 +3676,12 @@ export const removeForeignServer = async (data, isFromExtension) => { body: JSON.stringify(body), }); - if (!response.ok) throw new Error('Failed to remove server'); + if (!response.ok) + throw new Error( + i18n.t('question:message.error.server_remove', { + postProcess: 'capitalizeFirstChar', + }) + ); let res; try { @@ -3649,7 +3709,12 @@ export const getDaySummary = async () => { }, }); - if (!response.ok) throw new Error('Failed to retrieve summary'); + if (!response.ok) + throw new Error( + i18n.t('question:message.error.retrieve_summary', { + postProcess: 'capitalizeFirstChar', + }) + ); let res; try { @@ -3664,7 +3729,12 @@ export const getDaySummary = async () => { return res; // Return the full response } catch (error) { - throw new Error(error?.message || 'Error in retrieving summary'); + throw new Error( + error?.message || + i18n.t('question:message.error.retrieve_summary', { + postProcess: 'capitalizeFirstChar', + }) + ); } }; @@ -4694,7 +4764,7 @@ export const createSellOrder = async (data, isFromExtension) => { text1: i18n.t('question:permission_sell_order', { postProcess: 'capitalizeFirstChar', }), - text2: i18n.t('question:permission_sell_order_detail', { + text2: i18n.t('question:permission_order_detail', { qort_amount: data.qortAmount, foreign_amount: parsedForeignAmount, ticker: data.foreignBlockchain, @@ -4780,11 +4850,15 @@ export const cancelSellOrder = async (data, isFromExtension) => { const resPermission = await getUserPermission( { - text1: - 'Do you give this application permission to perform: cancel a sell order?', - text2: `${resData.qortAmount}${' '} - ${`QORT`}`, - text3: `FOR ${resData.expectedForeignAmount} ${resData.foreignBlockchain}`, + text1: i18n.t('question:permission_cancel_sell_order', { + postProcess: 'capitalizeFirstChar', + }), + text2: i18n.t('question:permission_order_detail', { + qort_amount: resData.qortAmount, + foreign_amount: resData.expectedForeignAmount, + ticker: resData.foreignBlockchain, + postProcess: 'capitalizeFirstChar', + }), fee: fee.fee, }, isFromExtension