From 17a568674fca06d40adb3c67b39eca70b9513120 Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Fri, 23 May 2025 17:08:43 +0200 Subject: [PATCH] Add translations --- src/i18n/locales/en/question.json | 6 +++++ src/qortalRequests/get.ts | 41 ++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/i18n/locales/en/question.json b/src/i18n/locales/en/question.json index 8a46fe7..b04d688 100644 --- a/src/i18n/locales/en/question.json +++ b/src/i18n/locales/en/question.json @@ -150,6 +150,12 @@ "permission_server_remove": "do you give this application permission to remove a server?", "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?", + "permission_sell_name_transaction": "do you give this application permission to create a sell name transaction?", + "permission_sell_name_transaction_detail": "sell {{ name }} for {{ price }} QORT", + "permission_sell_name_cancel": "do you give this application permission to cancel the selling of a name?", + "permission_buy_name": "do you give this application permission to buy a name?", + "permission_buy_name_detail": "buying {{ name }} for {{ price }} QORT", + "permission_sign_fee": "do you give this application permission to sign the required fees for all your trade offers?", "poll": "poll: {{ name }}", "provide_recipient_group_id": "please provide a recipient or groupId", "request_create_poll": "you are requesting to create the poll below:", diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts index 5cf64d0..f15c892 100644 --- a/src/qortalRequests/get.ts +++ b/src/qortalRequests/get.ts @@ -6197,8 +6197,17 @@ export const sellNameRequest = async (data, isFromExtension) => { const fee = await getFee('SELL_NAME'); const resPermission = await getUserPermission( { - text1: `Do you give this application permission to create a sell name transaction?`, - highlightedText: `Sell ${name} for ${sellPrice} QORT`, + text1: i18n.t('question:permission_sell_name_transaction', { + postProcess: 'capitalizeFirstChar', + }), + highlightedText: i18n.t( + 'question:permission_sell_name_transaction_detail', + { + name: name, + price: sellPrice, + postProcess: 'capitalizeFirstChar', + } + ), fee: fee.fee, }, isFromExtension @@ -6250,8 +6259,13 @@ export const cancelSellNameRequest = async (data, isFromExtension) => { const fee = await getFee('CANCEL_SELL_NAME'); const resPermission = await getUserPermission( { - text1: `Do you give this application permission to cancel the selling of a name?`, - highlightedText: `Name: ${name}`, + text1: i18n.t('question:permission_sell_name_cancel', { + postProcess: 'capitalizeFirstChar', + }), + highlightedText: i18n.t('question:name', { + name: name, + postProcess: 'capitalizeFirstChar', + }), fee: fee.fee, }, isFromExtension @@ -6287,26 +6301,33 @@ export const buyNameRequest = async (data, isFromExtension) => { }); throw new Error(errorMsg); } + const name = data.nameForSale; - const validApi = await getBaseApi(); - const response = await fetch(validApi + '/names/' + name); const nameData = await response.json(); + if (!nameData?.isForSale) throw new Error( i18n.t('question:message.error.name_not_for_sale', { postProcess: 'capitalizeFirstChar', }) ); + const sellerAddress = nameData.owner; const sellPrice = +nameData.salePrice; const fee = await getFee('BUY_NAME'); const resPermission = await getUserPermission( { - text1: `Do you give this application permission to buy a name?`, - highlightedText: `Buying ${name} for ${sellPrice} QORT`, + text1: i18n.t('question:permission_buy_name', { + postProcess: 'capitalizeFirstChar', + }), + highlightedText: i18n.t('question:permission_buy_name_detail', { + name: name, + price: sellPrice, + postProcess: 'capitalizeFirstChar', + }), fee: fee.fee, }, isFromExtension @@ -6331,7 +6352,9 @@ export const buyNameRequest = async (data, isFromExtension) => { export const signForeignFees = async (data, isFromExtension) => { const resPermission = await getUserPermission( { - text1: `Do you give this application permission to sign the required fees for all your trade offers?`, + text1: i18n.t('question:permission_sign_fee', { + postProcess: 'capitalizeFirstChar', + }), }, isFromExtension );