Add translation for buy order

This commit is contained in:
Nicola Benaglia 2025-05-23 14:45:59 +02:00
parent bac28d324f
commit e0de100d01
2 changed files with 50 additions and 20 deletions

View File

@ -47,6 +47,7 @@
"registered_name": "a registered name is needed to publish",
"retrieve_file": "failed to retrieve file",
"retrieve_keys": "unable to retrieve keys",
"same_foreign_blockchain": "all requested ATs need to be of the same foreign Blockchain.",
"send": "failed to send",
"submit_sell_order": "failed to submit sell order",
"timeout_request": "request timed out",
@ -79,6 +80,12 @@
"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_delete_hosts_resources": "do you give this application permission to delete {{ size }} hosted resources?",
@ -90,5 +97,7 @@
"poll": "poll: {{ name }}",
"request_create_poll": "you are requesting to create the poll below:",
"request_vote_poll": "you are being requested to vote on the poll below:",
"to_recipient": "to: {{ recipient }}"
"to_recipient": "to: {{ recipient }}",
"total_locking_fee": "total Locking Fee:",
"total_unlocking_fee": "total Unlocking Fee:"
}

View File

@ -4229,7 +4229,9 @@ export const createBuyOrder = async (data, isFromExtension) => {
const resData = await resAddress.json();
if (foreignBlockchain !== resData?.foreignBlockchain) {
throw new Error(
'All requested ATs need to be of the same foreign Blockchain.'
i18n.t('core:message.error.same_foreign_blockchain', {
postProcess: 'capitalizeFirstChar',
})
);
}
return resData;
@ -4237,23 +4239,30 @@ export const createBuyOrder = async (data, isFromExtension) => {
);
const crosschainAtInfo = await Promise.all(atPromises);
try {
const buyingFees = await getBuyingFees(foreignBlockchain);
const resPermission = await getUserPermission(
{
text1: i18n.t('question:permission_buy_order', {
postProcess: 'capitalizeFirstChar',
}), // TODO translate better
text2: `${atAddresses?.length}${' '}
${`buy order${atAddresses?.length === 1 ? '' : 's'}`}`,
text3: `${crosschainAtInfo?.reduce((latest, cur) => {
return latest + +cur?.qortAmount;
}, 0)} QORT FOR ${roundUpToDecimals(
crosschainAtInfo?.reduce((latest, cur) => {
return latest + +cur?.expectedForeignAmount;
}, 0)
)}
${` ${buyingFees.ticker}`}`,
}),
text2: i18n.t('question:permission_buy_order_quantity', {
quantity: atAddresses?.length,
postProcess: 'capitalizeFirstChar',
}),
text3: i18n.t('question:permission_buy_order_ticker', {
qort_amount: crosschainAtInfo?.reduce((latest, cur) => {
return latest + +cur?.qortAmount;
}, 0),
foreign_amount: roundUpToDecimals(
crosschainAtInfo?.reduce((latest, cur) => {
return latest + +cur?.expectedForeignAmount;
}, 0)
),
ticker: buyingFees.ticker,
postProcess: 'capitalizeFirstChar',
}),
highlightedText: i18n.t('auth:node.using_public_gateway', {
gateway: isGateway,
postProcess: 'capitalizeFirstChar',
@ -4283,15 +4292,27 @@ export const createBuyOrder = async (data, isFromExtension) => {
</style>
<div class="fee-container">
<div class="fee-label">Total Unlocking Fee:</div>
<div class="fee-label">${i18n.t('question:total_unlocking_fee', {
postProcess: 'capitalizeFirstChar',
})}</div>
<div>${(+buyingFees?.unlock?.fee * atAddresses?.length)?.toFixed(8)} ${buyingFees.ticker}</div>
<div class="fee-description">
This fee is an estimate based on ${atAddresses?.length} ${atAddresses?.length > 1 ? 'orders' : 'order'}, assuming a 300-byte size at a rate of ${buyingFees?.unlock?.feePerKb?.toFixed(8)} ${buyingFees.ticker} per KB.
</div>
<div class="fee-label">Total Locking Fee:</div>
<div>${+buyingFees?.lock.fee.toFixed(8)} ${buyingFees.ticker} per kb</div>
${i18n.t('question:permission_buy_order_fee_estimation', {
quantity: atAddresses?.length,
fee: buyingFees?.unlock?.feePerKb?.toFixed(8),
ticker: buyingFees.ticker,
postProcess: 'capitalizeFirstChar',
})}
</div>
<div class="fee-label">${i18n.t('question:total_locking_fee', {
postProcess: 'capitalizeFirstChar',
})}</div>
<div>${i18n.t('question:permission_buy_order_per_kb', {
fee: +buyingFees?.lock.fee.toFixed(8),
ticker: buyingFees.ticker,
postProcess: 'capitalizeFirstChar',
})}
</div>
</div>
</div>
`,