Add translations

This commit is contained in:
Nicola Benaglia 2025-05-23 09:26:20 +02:00
parent ae511cd122
commit fb97a2f453
4 changed files with 95 additions and 22 deletions

View File

@ -101,7 +101,8 @@
"use_custom": "use custom node", "use_custom": "use custom node",
"use_local": "use local node", "use_local": "use local node",
"using": "using node", "using": "using node",
"using_public": "using public node" "using_public": "using public node",
"using_public_gateway": "using public node: {{ gateway }}"
}, },
"note": "note", "note": "note",
"password": "password", "password": "password",

View File

@ -184,6 +184,7 @@
"file_too_large": "file {{ filename }} is too large. Max size allowed is {{ size }} MB.", "file_too_large": "file {{ filename }} is too large. Max size allowed is {{ size }} MB.",
"generic": "an error occurred", "generic": "an error occurred",
"initiate_download": "failed to initiate download", "initiate_download": "failed to initiate download",
"invalid_amount": "invalid amount",
"invalid_base64": "invalid base64 data", "invalid_base64": "invalid base64 data",
"invalid_embed_link": "invalid embed link", "invalid_embed_link": "invalid embed link",
"invalid_image_embed_link_name": "invalid image embed link. Missing param.", "invalid_image_embed_link_name": "invalid image embed link. Missing param.",

View File

@ -21,15 +21,18 @@
"encryption_failed": "encryption failed", "encryption_failed": "encryption failed",
"encryption_requires_public_key": "encrypting data requires public keys", "encryption_requires_public_key": "encrypting data requires public keys",
"fetch_balance": "unable to fetch balance", "fetch_balance": "unable to fetch balance",
"fetch_balance_token": "failed to fetch {{ token }} Balance. Try again!",
"fetch_generic": "unable to fetch", "fetch_generic": "unable to fetch",
"fetch_group": "failed to fetch the group", "fetch_group": "failed to fetch the group",
"fetch_list": "failed to fetch the list", "fetch_list": "failed to fetch the list",
"fetch_poll": "failed to fetch poll", "fetch_poll": "failed to fetch poll",
"fetch_recipient_public_key": "failed to fetch recipient's public key",
"insufficient_balance_qort": "your QORT balance is insufficient", "insufficient_balance_qort": "your QORT balance is insufficient",
"insufficient_balance": "your asset balance is insufficient", "insufficient_balance": "your asset balance is insufficient",
"insufficient_funds": "insufficient funds", "insufficient_funds": "insufficient funds",
"invalid_receiver": "invalid receiver address or name", "invalid_receiver": "invalid receiver address or name",
"missing_fields": "missing fields: {{ fields }}", "missing_fields": "missing fields: {{ fields }}",
"name_already_for_sale": "this name is already for sale",
"name_not_for_sale": "this name is not for sale", "name_not_for_sale": "this name is not for sale",
"no_api_found": "no usable API found", "no_api_found": "no usable API found",
"no_data_encrypted_resource": "no data in the encrypted resource", "no_data_encrypted_resource": "no data in the encrypted resource",
@ -47,6 +50,7 @@
"send": "failed to send", "send": "failed to send",
"submit_sell_order": "failed to submit sell order", "submit_sell_order": "failed to submit sell order",
"timeout_request": "request timed out", "timeout_request": "request timed out",
"get_foreign_fee": "error in get foreign fee",
"update_foreign_fee": "failed to update foreign fee", "update_foreign_fee": "failed to update foreign fee",
"upload_encryption": "upload failed due to failed encryption", "upload_encryption": "upload failed due to failed encryption",
"user_qortal_name": "user has no Qortal name" "user_qortal_name": "user has no Qortal name"
@ -64,7 +68,8 @@
"user_declined_join": "user declined to join group", "user_declined_join": "user declined to join group",
"user_declined_list": "user declined to get list of hosted resources", "user_declined_list": "user declined to get list of hosted resources",
"user_declined_request": "user declined request", "user_declined_request": "user declined request",
"user_declined_share_list": "user declined to share list" "user_declined_share_list": "user declined to share list",
"user_declined_send_message": "user declined to send message"
} }
}, },
"name": "name: {{ name }}", "name": "name: {{ name }}",
@ -73,6 +78,8 @@
"permission_access_list": "do you give this application permission to access the list", "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_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_authenticate": "do you give this application permission to authenticate?",
"permission_buy_order": "do you give this application permission to perform a buy order?",
"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_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?", "permission_delete_hosts_resources": "do you give this application permission to delete {{ size }} hosted resources?",
"permission_pay_publish": "do you give this application permission to make the following payments and publishes?", "permission_pay_publish": "do you give this application permission to make the following payments and publishes?",

View File

@ -2006,13 +2006,22 @@ export const sendChatMessage = async (data, isFromExtension, appInfo) => {
const balance = await getBalanceInfo(); const balance = await getBalanceInfo();
const hasEnoughBalance = +balance < 4 ? false : true; const hasEnoughBalance = +balance < 4 ? false : true;
if (!hasEnoughBalance) { if (!hasEnoughBalance) {
throw new Error('You need at least 4 QORT to send a message'); throw new Error(
i18n.t('group:message.error.qortals_required', {
quantity: 4,
postProcess: 'capitalizeFirstChar',
})
);
} }
if (isRecipient && recipient) { if (isRecipient && recipient) {
const url = await createEndpoint(`/addresses/publickey/${recipient}`); const url = await createEndpoint(`/addresses/publickey/${recipient}`);
const response = await fetch(url); const response = await fetch(url);
if (!response.ok) if (!response.ok)
throw new Error("Failed to fetch recipient's public key"); throw new Error(
i18n.t('question:message.error.fetch_recipient_public_key', {
postProcess: 'capitalizeFirstChar',
})
);
let key; let key;
let hasPublicKey; let hasPublicKey;
@ -2141,7 +2150,11 @@ export const sendChatMessage = async (data, isFromExtension, appInfo) => {
throw new Error('Please enter a recipient or groupId'); throw new Error('Please enter a recipient or groupId');
} }
} else { } else {
throw new Error('User declined to send message'); throw new Error(
i18n.t('question:message.generic.user_declined_send_message', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
@ -2517,8 +2530,10 @@ export const getWalletBalance = async (
if (!bypassPermission && !skip) { if (!bypassPermission && !skip) {
resPermission = await getUserPermission( resPermission = await getUserPermission(
{ {
text1: 'Do you give this application permission to fetch your', text1: i18n.t('question:permission_fetch_balance', {
highlightedText: `${data.coin} balance`, coin: data.coin, // TODO highlight coin in the modal
postProcess: 'capitalizeFirstChar',
}),
checkbox1: { checkbox1: {
value: true, value: true,
label: i18n.t('question:always_retrieve_balance', { label: i18n.t('question:always_retrieve_balance', {
@ -3052,7 +3067,12 @@ export const getForeignFee = async (data) => {
} }
return res; // Return full response here return res; // Return full response here
} catch (error) { } catch (error) {
throw new Error(error?.message || 'Error in get foreign fee'); throw new Error(
error?.message ||
i18n.t('question:message.error.get_foreign_fee', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
@ -3646,7 +3666,10 @@ export const sendCoin = async (data, isFromExtension) => {
walletBalance = await response.text(); walletBalance = await response.text();
} }
if (isNaN(Number(walletBalance))) { if (isNaN(Number(walletBalance))) {
const errorMsg = 'Failed to Fetch QORT Balance. Try again!'; const errorMsg = i18n.t('question:message.error.fetch_balance_token', {
token: 'QORT',
postProcess: 'capitalizeFirstChar',
});
throw new Error(errorMsg); throw new Error(errorMsg);
} }
@ -3663,7 +3686,9 @@ export const sendCoin = async (data, isFromExtension) => {
throw new Error(errorMsg); throw new Error(errorMsg);
} }
if (amount <= 0) { if (amount <= 0) {
const errorMsg = 'Invalid Amount!'; const errorMsg = i18n.t('core:message.error.invalid_amount', {
postProcess: 'capitalizeFirstChar',
});
throw new Error(errorMsg); throw new Error(errorMsg);
} }
if (recipient.length === 0) { if (recipient.length === 0) {
@ -3707,13 +3732,22 @@ export const sendCoin = async (data, isFromExtension) => {
const btcWalletBalance = await getWalletBalance({ coin: checkCoin }, true); const btcWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
if (isNaN(Number(btcWalletBalance))) { if (isNaN(Number(btcWalletBalance))) {
throw new Error('Unable to fetch BTC balance'); throw new Error(
i18n.t('question:message.error.fetch_balance_token', {
token: 'BTC',
postProcess: 'capitalizeFirstChar',
})
);
} }
const btcWalletBalanceDecimals = Number(btcWalletBalance); const btcWalletBalanceDecimals = Number(btcWalletBalance);
const btcAmountDecimals = Number(amount); const btcAmountDecimals = Number(amount);
const fee = feePerByte * 500; // default 0.00050000 const fee = feePerByte * 500; // default 0.00050000
if (btcAmountDecimals + fee > btcWalletBalanceDecimals) { if (btcAmountDecimals + fee > btcWalletBalanceDecimals) {
throw new Error('INSUFFICIENT_FUNDS'); throw new Error(
i18n.t('question:message.error.insufficient_funds', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const resPermission = await getUserPermission( const resPermission = await getUserPermission(
@ -3774,7 +3808,10 @@ export const sendCoin = async (data, isFromExtension) => {
const ltcWalletBalance = await getWalletBalance({ coin: checkCoin }, true); const ltcWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
if (isNaN(Number(ltcWalletBalance))) { if (isNaN(Number(ltcWalletBalance))) {
const errorMsg = 'Failed to Fetch LTC Balance. Try again!'; const errorMsg = i18n.t('question:message.error.fetch_balance_token', {
token: 'LTC',
postProcess: 'capitalizeFirstChar',
});
throw new Error(errorMsg); throw new Error(errorMsg);
} }
const ltcWalletBalanceDecimals = Number(ltcWalletBalance); const ltcWalletBalanceDecimals = Number(ltcWalletBalance);
@ -3843,7 +3880,10 @@ export const sendCoin = async (data, isFromExtension) => {
const feePerByte = data.fee ? data.fee : dogeFeePerByte; const feePerByte = data.fee ? data.fee : dogeFeePerByte;
const dogeWalletBalance = await getWalletBalance({ coin: checkCoin }, true); const dogeWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
if (isNaN(Number(dogeWalletBalance))) { if (isNaN(Number(dogeWalletBalance))) {
const errorMsg = 'Failed to Fetch DOGE Balance. Try again!'; const errorMsg = i18n.t('question:message.error.fetch_balance_token', {
token: 'DOGE',
postProcess: 'capitalizeFirstChar',
});
throw new Error(errorMsg); throw new Error(errorMsg);
} }
const dogeWalletBalanceDecimals = Number(dogeWalletBalance); const dogeWalletBalanceDecimals = Number(dogeWalletBalance);
@ -3916,7 +3956,10 @@ export const sendCoin = async (data, isFromExtension) => {
const feePerByte = data.fee ? data.fee : dgbFeePerByte; const feePerByte = data.fee ? data.fee : dgbFeePerByte;
const dgbWalletBalance = await getWalletBalance({ coin: checkCoin }, true); const dgbWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
if (isNaN(Number(dgbWalletBalance))) { if (isNaN(Number(dgbWalletBalance))) {
const errorMsg = 'Failed to Fetch DGB Balance. Try again!'; const errorMsg = i18n.t('question:message.error.fetch_balance_token', {
token: 'DGB',
postProcess: 'capitalizeFirstChar',
});
throw new Error(errorMsg); throw new Error(errorMsg);
} }
const dgbWalletBalanceDecimals = Number(dgbWalletBalance); const dgbWalletBalanceDecimals = Number(dgbWalletBalance);
@ -3986,7 +4029,10 @@ export const sendCoin = async (data, isFromExtension) => {
const feePerByte = data.fee ? data.fee : rvnFeePerByte; const feePerByte = data.fee ? data.fee : rvnFeePerByte;
const rvnWalletBalance = await getWalletBalance({ coin: checkCoin }, true); const rvnWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
if (isNaN(Number(rvnWalletBalance))) { if (isNaN(Number(rvnWalletBalance))) {
const errorMsg = 'Failed to Fetch RVN Balance. Try again!'; const errorMsg = i18n.t('question:message.error.fetch_balance_token', {
token: 'RVN',
postProcess: 'capitalizeFirstChar',
});
throw new Error(errorMsg); throw new Error(errorMsg);
} }
const rvnWalletBalanceDecimals = Number(rvnWalletBalance); const rvnWalletBalanceDecimals = Number(rvnWalletBalance);
@ -4056,7 +4102,10 @@ export const sendCoin = async (data, isFromExtension) => {
const arrrWalletBalance = await getWalletBalance({ coin: checkCoin }, true); const arrrWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
if (isNaN(Number(arrrWalletBalance))) { if (isNaN(Number(arrrWalletBalance))) {
const errorMsg = 'Failed to Fetch ARRR Balance. Try again!'; const errorMsg = i18n.t('question:message.error.fetch_balance_token', {
token: 'ARR',
postProcess: 'capitalizeFirstChar',
});
throw new Error(errorMsg); throw new Error(errorMsg);
} }
const arrrWalletBalanceDecimals = Number(arrrWalletBalance); const arrrWalletBalanceDecimals = Number(arrrWalletBalance);
@ -4192,8 +4241,9 @@ export const createBuyOrder = async (data, isFromExtension) => {
const buyingFees = await getBuyingFees(foreignBlockchain); const buyingFees = await getBuyingFees(foreignBlockchain);
const resPermission = await getUserPermission( const resPermission = await getUserPermission(
{ {
text1: text1: i18n.t('question:permission_buy_order', {
'Do you give this application permission to perform a buy order?', postProcess: 'capitalizeFirstChar',
}), // TODO translate better
text2: `${atAddresses?.length}${' '} text2: `${atAddresses?.length}${' '}
${`buy order${atAddresses?.length === 1 ? '' : 's'}`}`, ${`buy order${atAddresses?.length === 1 ? '' : 's'}`}`,
text3: `${crosschainAtInfo?.reduce((latest, cur) => { text3: `${crosschainAtInfo?.reduce((latest, cur) => {
@ -4204,7 +4254,10 @@ export const createBuyOrder = async (data, isFromExtension) => {
}, 0) }, 0)
)} )}
${` ${buyingFees.ticker}`}`, ${` ${buyingFees.ticker}`}`,
highlightedText: `Is using public node: ${isGateway}`, highlightedText: i18n.t('auth:node.using_public_gateway', {
gateway: isGateway,
postProcess: 'capitalizeFirstChar',
}),
fee: '', fee: '',
html: ` html: `
<div style="max-height: 30vh; overflow-y: auto; font-family: sans-serif;"> <div style="max-height: 30vh; overflow-y: auto; font-family: sans-serif;">
@ -5794,9 +5847,19 @@ export const sellNameRequest = async (data, isFromExtension) => {
const response = await fetch(validApi + '/names/' + name); const response = await fetch(validApi + '/names/' + name);
const nameData = await response.json(); const nameData = await response.json();
if (!nameData) throw new Error('This name does not exist'); if (!nameData)
throw new Error(
i18n.t('auth:message.error.name_not_existing', {
postProcess: 'capitalizeFirstChar',
})
);
if (nameData?.isForSale) throw new Error('This name is already for sale'); if (nameData?.isForSale)
throw new Error(
i18n.t('question:message.error.name_already_for_sale', {
postProcess: 'capitalizeFirstChar',
})
);
const fee = await getFee('SELL_NAME'); const fee = await getFee('SELL_NAME');
const resPermission = await getUserPermission( const resPermission = await getUserPermission(
{ {
@ -6278,6 +6341,7 @@ export const multiPaymentWithPrivateData = async (data, isFromExtension) => {
}, },
isFromExtension isFromExtension
); );
const { accepted, checkbox1 = false } = resPermission; const { accepted, checkbox1 = false } = resPermission;
if (!accepted) { if (!accepted) {
throw new Error( throw new Error(