From 0539995a5dff98fc0949a1b5202b3630c66a9f2b Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Fri, 23 May 2025 16:10:54 +0200 Subject: [PATCH] Add translations --- src/i18n/locales/en/question.json | 29 ++++ src/qortalRequests/get.ts | 230 ++++++++++++++++++++++++------ 2 files changed, 213 insertions(+), 46 deletions(-) diff --git a/src/i18n/locales/en/question.json b/src/i18n/locales/en/question.json index ac96ab3..fc0d9f3 100644 --- a/src/i18n/locales/en/question.json +++ b/src/i18n/locales/en/question.json @@ -1,7 +1,10 @@ { + "accept_app_fee": "accept app fee", "always_authenticate": "always authenticate automatically", + "always_chat_messages": "always allow chat messages from this app", "always_retrieve_balance": "always allow balance to be retrieved automatically", "always_retrieve_list": "always allow lists to be retrieved automatically", + "always_retrieve_wallet": "always allow wallet to be retrieved automatically", "amount_qty": "amount: {{ quantity }}", "asset_name": "asset: {{ asset }}", "assets_used_pay": "asset used in payments: {{ asset }}", @@ -29,11 +32,20 @@ "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", + "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.", + "gateway_retrieve_balance": "retrieving {{ token }} balance is not allowed through a gateway", + "gateway_wallet_local_node": "cannot view {{ token }} wallet through the gateway. Please use your local node.", "get_foreign_fee": "error in get foreign fee", "insufficient_balance_qort": "your QORT balance is insufficient", "insufficient_balance": "your asset balance is insufficient", "insufficient_funds": "insufficient funds", + "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", + "mime_type": "a mimeType could not be derived", "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", @@ -43,23 +55,35 @@ "no_group_found": "group not found", "no_group_key": "no group key found", "no_poll": "poll not found", + "no_resources_publish": "no resources to publish", "node_info": "failed to retrieve node info", "node_status": "failed to retrieve node status", + "only_encrypted_data": "only encrypted data can go into private services", "perform_request": "failed to perform request", + "poll_create": "failed to create poll", + "poll_vote": "failed to vote on the poll", "process_transaction": "unable to process transaction", "registered_name": "a registered name is needed to publish", + "resources_publish": "some resources have failed 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", + "server_info": "error in retrieving server info", "submit_sell_order": "failed to submit sell order", + "synchronization_attempts": "failed to synchronize after {{ quantity }} attempts", "timeout_request": "request timed out", + "token_not_supported": "{{ token }} is not supported for this call", + "unknown_error": "unknown error", "update_foreign_fee": "failed to update foreign fee", "update_tradebot": "unable to update tradebot", "upload_encryption": "upload failed due to failed encryption", + "upload": "upload failed", + "use_private_service": "for an encrypted publish please use a service that ends with _PRIVATE", "user_qortal_name": "user has no Qortal name" }, "generic": { + "confirm_join_group": "confirm joining the group:", "include_data_decrypt": "please include data to decrypt", "include_data_encrypt": "please include data to encrypt", "max_retry_transaction": "max retries reached. Skipping transaction.", @@ -72,6 +96,7 @@ "user_declined_join": "user declined to join group", "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" } @@ -99,9 +124,13 @@ "permission_sell_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_send_chat_message": "do you give this application permission to send this chat message?", "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:", + "to_group": "to: group {{ group_id }}", "to_recipient": "to: {{ recipient }}", "total_locking_fee": "total Locking Fee:", "total_unlocking_fee": "total Unlocking Fee:" diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts index c098450..e137770 100644 --- a/src/qortalRequests/get.ts +++ b/src/qortalRequests/get.ts @@ -1398,7 +1398,9 @@ export const publishQDNResource = async ( (handleDynamicValues['appFee'] = +appFee + +feePayment.fee), (handleDynamicValues['checkbox1'] = { value: true, - label: 'accept app fee', + label: i18n.t('question:accept_app_fee', { + postProcess: 'capitalizeFirstChar', + }), }); } if (!!data?.encrypt) { @@ -1490,8 +1492,13 @@ export const checkArrrSyncStatus = async (seed) => { } } - // If we exceed 6 tries, throw an error - throw new Error('Failed to synchronize after 36 attempts'); + // If we exceed N tries, throw an error + throw new Error( + i18n.t('question:message.error.synchronization_attempts', { + quantity: 36, + postProcess: 'capitalizeFirstChar', + }) + ); }; export const publishMultipleQDNResources = async ( @@ -1501,12 +1508,13 @@ export const publishMultipleQDNResources = async ( ) => { const requiredFields = ['resources']; const missingFields: string[] = []; - let feeAmount = null; + requiredFields.forEach((field) => { if (!data[field]) { missingFields.push(field); } }); + if (missingFields.length > 0) { const missingFieldsString = missingFields.join(', '); const errorMsg = i18n.t('question:message.error.missing_fields', { @@ -1515,24 +1523,38 @@ export const publishMultipleQDNResources = async ( }); throw new Error(errorMsg); } + const resources = data.resources; if (!Array.isArray(resources)) { - throw new Error('Invalid data'); + throw new Error( + i18n.t('group:message.generic.invalid_data', { + postProcess: 'capitalizeFirstChar', + }) + ); } + if (resources.length === 0) { - throw new Error('No resources to publish'); + throw new Error( + i18n.t('question:message.error.no_resources_publish', { + postProcess: 'capitalizeFirstChar', + }) + ); } const encrypt = data?.encrypt; for (const resource of resources) { const resourceEncrypt = encrypt && resource?.disableEncrypt !== true; + if (!resourceEncrypt && resource?.service.endsWith('_PRIVATE')) { - const errorMsg = 'Only encrypted data can go into private services'; + const errorMsg = i18n.t('question:message.error.only_encrypted_data', { + postProcess: 'capitalizeFirstChar', + }); throw new Error(errorMsg); } else if (resourceEncrypt && !resource?.service.endsWith('_PRIVATE')) { - const errorMsg = - 'For an encrypted publish please use a service that ends with _PRIVATE'; + const errorMsg = i18n.t('question:message.error.use_private_service', { + postProcess: 'capitalizeFirstChar', + }); throw new Error(errorMsg); } } @@ -1540,6 +1562,7 @@ export const publishMultipleQDNResources = async ( const fee = await getFee('ARBITRARY'); const registeredName = await getNameInfo(); const name = registeredName; + if (!name) { throw new Error( i18n.t('question:message.error.registered_name', { @@ -1547,9 +1570,11 @@ export const publishMultipleQDNResources = async ( }) ); } + const appFee = data?.appFee ? +data.appFee : undefined; const appFeeRecipient = data?.appFeeRecipient; let hasAppFee = false; + if (appFee && appFee > 0 && appFeeRecipient) { hasAppFee = true; } @@ -1561,7 +1586,9 @@ export const publishMultipleQDNResources = async ( (handleDynamicValues['appFee'] = +appFee + +feePayment.fee), (handleDynamicValues['checkbox1'] = { value: true, - label: 'accept app fee', + label: i18n.t('question:accept_app_fee', { + postProcess: 'capitalizeFirstChar', + }), }); } if (data?.encrypt) { @@ -1575,8 +1602,6 @@ export const publishMultipleQDNResources = async ( html: `