mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-06 00:16:58 +00:00
Add translations
This commit is contained in:
parent
7fa2c05f97
commit
a6d77d8615
@ -102,7 +102,6 @@ import {
|
||||
} from './background-cases';
|
||||
import { getData, removeKeysAndLogout, storeData } from './utils/chromeStorage';
|
||||
import TradeBotRespondRequest from './transactions/TradeBotRespondRequest';
|
||||
// import {BackgroundFetch} from '@transistorsoft/capacitor-background-fetch';
|
||||
|
||||
export let groupSecretkeys = {};
|
||||
|
||||
@ -127,6 +126,7 @@ export const groupApi = 'https://ext-node.qortal.link';
|
||||
export const groupApiSocket = 'wss://ext-node.qortal.link';
|
||||
export const groupApiLocal = 'http://127.0.0.1:12391';
|
||||
export const groupApiSocketLocal = 'ws://127.0.0.1:12391';
|
||||
|
||||
const timeDifferenceForNotificationChatsBackground = 86400000;
|
||||
const requestQueueAnnouncements = new RequestQueueWithPromise(1);
|
||||
|
||||
@ -3423,8 +3423,7 @@ const checkGroupList = async () => {
|
||||
directs: sortedDirects,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
@ -3539,7 +3538,7 @@ export const checkNewMessages = async () => {
|
||||
targetOrigin
|
||||
);
|
||||
} catch (error) {
|
||||
} finally {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
@ -3788,35 +3787,10 @@ export const checkThreads = async (bringBack) => {
|
||||
targetOrigin
|
||||
);
|
||||
} catch (error) {
|
||||
} finally {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
// Configure Background Fetch
|
||||
// BackgroundFetch.configure({
|
||||
// minimumFetchInterval: 15, // Minimum 15-minute interval
|
||||
// enableHeadless: true, // Enable headless mode for Android
|
||||
// }, async (taskId) => {
|
||||
// // This is where your background task logic goes
|
||||
// const wallet = await getSaveWallet();
|
||||
// const address = wallet.address0;
|
||||
// if (!address) return;
|
||||
// checkActiveChatsForNotifications();
|
||||
// checkNewMessages();
|
||||
// checkThreads();
|
||||
|
||||
// await new Promise((res)=> {
|
||||
// setTimeout(() => {
|
||||
// res()
|
||||
// }, 55000);
|
||||
// })
|
||||
// // Always finish the task when complete
|
||||
// BackgroundFetch.finish(taskId);
|
||||
// }, (taskId) => {
|
||||
// // Optional timeout callback
|
||||
// BackgroundFetch.finish(taskId);
|
||||
// });
|
||||
|
||||
let notificationCheckInterval;
|
||||
let paymentsCheckInterval;
|
||||
|
||||
|
@ -359,7 +359,9 @@ export const NotAuthenticated = ({
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(
|
||||
'Failed to set API key:',
|
||||
it('auth:message.error.unable_set_apikey', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
error.message ||
|
||||
t('core:message.error.generic', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
@ -396,7 +398,9 @@ export const NotAuthenticated = ({
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(
|
||||
'Failed to set API key:',
|
||||
it('auth:message.error.unable_set_apikey', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
error.message ||
|
||||
t('core:message.error.generic', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
@ -678,7 +682,9 @@ export const NotAuthenticated = ({
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(
|
||||
'Failed to set API key:',
|
||||
it('auth:message.error.unable_set_apikey', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
error.message ||
|
||||
t('core:message.error.generic', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
@ -830,7 +836,9 @@ export const NotAuthenticated = ({
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(
|
||||
'Failed to set API key:',
|
||||
it('auth:message.error.unable_set_apikey', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
error.message ||
|
||||
t('core:message.error.generic', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
@ -894,7 +902,9 @@ export const NotAuthenticated = ({
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(
|
||||
'Failed to set API key:',
|
||||
it('auth:message.error.unable_set_apikey', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
error.message ||
|
||||
t('core:message.error.generic', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
|
@ -60,6 +60,7 @@
|
||||
"name_not_existing": "name does not exist",
|
||||
"name_not_registered": "name not registered",
|
||||
"unable_block_user": "unable to block user",
|
||||
"unable_set_apikey": "failed to set API key:",
|
||||
"unable_fetch_user_account": "unable to fetch user account",
|
||||
"unable_decrypt": "unable to decrypt",
|
||||
"unable_reencrypt_secret_key": "unable to re-encrypt secret key"
|
||||
|
@ -173,6 +173,7 @@
|
||||
"app_need_name": "your app needs a name",
|
||||
"file_too_large": "file {{ filename }} is too large. Max size allowed is {{ size }} MB.",
|
||||
"generic": "an error occurred",
|
||||
"invalid_base64": "invalid base64 data",
|
||||
"invalid_embed_link": "invalid embed link",
|
||||
"invalid_poll_embed_link_name": "invalid poll embed link. Missing name.",
|
||||
"invalid_image_embed_link_name": "invalid image embed link. Missing param.",
|
||||
|
@ -2,21 +2,27 @@
|
||||
"always_authenticate": "always authenticate automatically",
|
||||
"always_retrieve_balance": "always allow balance to be retrieved automatically",
|
||||
"always_retrieve_list": "always allow lists to be retrieved automatically",
|
||||
"authenticate": "do you give this application permission to authenticate?",
|
||||
"amount_qty": "amount: {{ quantity }}",
|
||||
"asset_name": "asset: {{ asset }}",
|
||||
"assets_used_pay": "asset used in payments: {{ asset }}",
|
||||
"description": "description: {{ description }}",
|
||||
"deploy_at": "would you like to deploy this AT?",
|
||||
"message": {
|
||||
"error": {
|
||||
"create_sell_order": "failed to Create Sell Order. Try again!",
|
||||
"cancel_sell_order": "failed to Cancel Sell Order. Try again!",
|
||||
"fetch_balance": "unable to fetch balance",
|
||||
"fetch_group": "failed to fetch the group",
|
||||
"fetch_list": "failed to fetch the list",
|
||||
"insufficient_balance": "your asset balance is insufficient",
|
||||
"insufficient_balance_qort": "your QORT balance is insufficient",
|
||||
"missing_fields": "missing fields: {{ fields }}",
|
||||
"no_data_encrypted_resource": "no data in the encrypted resource",
|
||||
"no_group_found": "group not found",
|
||||
"no_group_key": "no group key found",
|
||||
"perform_request": "failed to perform request",
|
||||
"retrieve_file": "failed to retrieve file",
|
||||
"submit_sell_order": "failed to submit sell order",
|
||||
"timeout_request": "request timed out",
|
||||
"unable_create_tradebot": "unable to create tradebot",
|
||||
"unable_decrypt": "unable to decrypt",
|
||||
@ -37,6 +43,11 @@
|
||||
"name": "name: {{ name }}",
|
||||
"option": "option: {{ option }}",
|
||||
"options": "options: {{ optionList }}",
|
||||
"permission_authenticate": "do you give this application permission to authenticate?",
|
||||
"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_pay_publish": "do you give this application permission to make the following payments and publishes?",
|
||||
"permission_transfer_asset": "do you give this application permission to transfer the following asset?",
|
||||
"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:"
|
||||
|
@ -503,7 +503,7 @@ export const getUserAccount = async ({
|
||||
if (!skip) {
|
||||
resPermission = await getUserPermission(
|
||||
{
|
||||
text1: i18n.t('question:authenticate', {
|
||||
text1: i18n.t('question:permission_authenticate', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
checkbox1: {
|
||||
@ -916,8 +916,9 @@ export const getHostedData = async (data, isFromExtension) => {
|
||||
}
|
||||
const resPermission = await getUserPermission(
|
||||
{
|
||||
text1: 'Do you give this application permission to',
|
||||
text2: `Get a list of your hosted data?`,
|
||||
text1: i18n.t('question:message.error.submit_sell_order', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
},
|
||||
isFromExtension
|
||||
);
|
||||
@ -964,8 +965,10 @@ export const deleteHostedData = async (data, isFromExtension) => {
|
||||
});
|
||||
const resPermission = await getUserPermission(
|
||||
{
|
||||
text1: 'Do you give this application permission to',
|
||||
text2: `Delete ${data?.hostedData?.length} hosted resources?`,
|
||||
text1: i18n.t('question:permission_delete_hosts_resources', {
|
||||
size: data?.hostedData?.length,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
},
|
||||
isFromExtension
|
||||
);
|
||||
@ -1205,7 +1208,12 @@ export const deleteListItems = async (data, isFromExtension) => {
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
if (!data?.item && !data?.items) {
|
||||
throw new Error('Missing fields: items');
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.missing_fields', {
|
||||
fields: 'items',
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
const item = data?.item;
|
||||
const items = data?.items;
|
||||
@ -3488,7 +3496,12 @@ export const sendCoin = async (data, isFromExtension) => {
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
if (!data?.destinationAddress && !data?.recipient) {
|
||||
throw new Error('Missing fields: recipient');
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.missing_fields', {
|
||||
fields: 'recipient',
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
let checkCoin = data.coin;
|
||||
const wallet = await getSaveWallet();
|
||||
@ -4202,7 +4215,9 @@ const tradeBotCreateRequest = async (body, keyPair) => {
|
||||
body
|
||||
);
|
||||
return {
|
||||
error: 'Failed to Create Sell Order. Try again!',
|
||||
error: i18n.t('question:message.error.create_sell_order', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
failedTradeBot: findFailedTradeBot,
|
||||
};
|
||||
}
|
||||
@ -4210,7 +4225,11 @@ const tradeBotCreateRequest = async (body, keyPair) => {
|
||||
if (res?.signature) {
|
||||
return res;
|
||||
} else {
|
||||
throw new Error('Failed to Create Sell Order. Try again!');
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.create_sell_order', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -4279,7 +4298,12 @@ export const createSellOrder = async (data, isFromExtension) => {
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error(error?.message || 'Failed to submit sell order.');
|
||||
throw new Error(
|
||||
error?.message ||
|
||||
i18n.t('question:message.error.submit_sell_order', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -4346,7 +4370,12 @@ export const cancelSellOrder = async (data, isFromExtension) => {
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error(error?.message || 'Failed to submit sell order.');
|
||||
throw new Error(
|
||||
error?.message ||
|
||||
i18n.t('question:message.error.submit_sell_order', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -5485,7 +5514,12 @@ export const decryptAESGCMRequest = async (data, isFromExtension) => {
|
||||
const requiredFields = ['encryptedData', 'iv', 'senderPublicKey'];
|
||||
requiredFields.forEach((field) => {
|
||||
if (!data[field]) {
|
||||
throw new Error(`Missing required field: ${field}`);
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.missing_fields', {
|
||||
fields: field,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@ -5776,7 +5810,12 @@ export const multiPaymentWithPrivateData = async (data, isFromExtension) => {
|
||||
const requiredFields = ['payments', 'assetId'];
|
||||
requiredFields.forEach((field) => {
|
||||
if (data[field] === undefined || data[field] === null) {
|
||||
throw new Error(`Missing required field: ${field}`);
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.missing_fields', {
|
||||
fields: field,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
const resKeyPair = await getKeyPair();
|
||||
@ -5801,7 +5840,12 @@ export const multiPaymentWithPrivateData = async (data, isFromExtension) => {
|
||||
|
||||
for (const field of requiredFieldsPayment) {
|
||||
if (!payment[field]) {
|
||||
throw new Error(`Missing required field: ${field}`);
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.missing_fields', {
|
||||
fields: field,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5829,7 +5873,12 @@ export const multiPaymentWithPrivateData = async (data, isFromExtension) => {
|
||||
|
||||
for (const field of requiredFieldsArbitraryTx) {
|
||||
if (!arbitraryTx[field]) {
|
||||
throw new Error(`Missing required field: ${field}`);
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.missing_fields', {
|
||||
fields: field,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5840,7 +5889,12 @@ export const multiPaymentWithPrivateData = async (data, isFromExtension) => {
|
||||
}
|
||||
|
||||
const isValid = isValidBase64WithDecode(arbitraryTx.base64);
|
||||
if (!isValid) throw new Error('Invalid base64 data');
|
||||
if (!isValid)
|
||||
throw new Error(
|
||||
i18n.t('core:message.error.invalid_base64', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
if (!arbitraryTx?.service?.includes('_PRIVATE'))
|
||||
throw new Error('Please use a PRIVATE service');
|
||||
const additionalPublicKeys = arbitraryTx?.additionalPublicKeys || [];
|
||||
@ -5868,7 +5922,12 @@ export const multiPaymentWithPrivateData = async (data, isFromExtension) => {
|
||||
|
||||
for (const field of requiredFieldsArbitraryTx) {
|
||||
if (!arbitraryTx[field]) {
|
||||
throw new Error(`Missing required field: ${field}`);
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.missing_fields', {
|
||||
fields: field,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5879,7 +5938,12 @@ export const multiPaymentWithPrivateData = async (data, isFromExtension) => {
|
||||
}
|
||||
|
||||
const isValid = isValidBase64WithDecode(arbitraryTx.base64);
|
||||
if (!isValid) throw new Error('Invalid base64 data');
|
||||
if (!isValid)
|
||||
throw new Error(
|
||||
i18n.t('core:message.error.invalid_base64', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
if (!arbitraryTx?.service?.includes('_PRIVATE'))
|
||||
throw new Error('Please use a PRIVATE service');
|
||||
const additionalPublicKeys = arbitraryTx?.additionalPublicKeys || [];
|
||||
@ -5899,17 +5963,30 @@ export const multiPaymentWithPrivateData = async (data, isFromExtension) => {
|
||||
if (!name) throw new Error('A name is needed to publish');
|
||||
const balance = await getBalanceInfo();
|
||||
|
||||
if (+balance < fee) throw new Error('Your QORT balance is insufficient');
|
||||
if (+balance < fee)
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.insufficient_balance_qort', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
const assetBalance = await getAssetBalanceInfo(assetId);
|
||||
const assetInfo = await getAssetInfo(assetId);
|
||||
if (assetBalance < totalAmount)
|
||||
throw new Error('Your asset balance is insufficient');
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.insufficient_balance', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
|
||||
const resPermission = await getUserPermission(
|
||||
{
|
||||
text1:
|
||||
'Do you give this application permission to make the following payments and publishes?',
|
||||
text2: `Asset used in payments: ${assetInfo.name}`,
|
||||
text1: i18n.t('question:permission_pay_publish', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
text2: i18n.t('question:assets_used_pay', {
|
||||
asset: assetInfo.name,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
html: `
|
||||
<div style="max-height: 30vh; overflow-y: auto;">
|
||||
<style>
|
||||
@ -6127,7 +6204,12 @@ export const transferAssetRequest = async (data, isFromExtension) => {
|
||||
const requiredFields = ['amount', 'assetId', 'recipient'];
|
||||
requiredFields.forEach((field) => {
|
||||
if (data[field] === undefined || data[field] === null) {
|
||||
throw new Error(`Missing required field: ${field}`);
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.missing_fields', {
|
||||
fields: field,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
const amount = data.amount;
|
||||
@ -6137,10 +6219,19 @@ export const transferAssetRequest = async (data, isFromExtension) => {
|
||||
const { fee } = await getFee('TRANSFER_ASSET');
|
||||
const balance = await getBalanceInfo();
|
||||
|
||||
if (+balance < +fee) throw new Error('Your QORT balance is insufficient');
|
||||
if (+balance < +fee)
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.insufficient_balance_qort', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
const assetBalance = await getAssetBalanceInfo(assetId);
|
||||
if (assetBalance < amount)
|
||||
throw new Error('Your asset balance is insufficient');
|
||||
throw new Error(
|
||||
i18n.t('question:message.error.insufficient_balance', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
})
|
||||
);
|
||||
const confirmReceiver = await getNameOrAddress(recipient);
|
||||
if (confirmReceiver.error) {
|
||||
throw new Error('Invalid receiver address or name');
|
||||
@ -6148,9 +6239,17 @@ export const transferAssetRequest = async (data, isFromExtension) => {
|
||||
const assetInfo = await getAssetInfo(assetId);
|
||||
const resPermission = await getUserPermission(
|
||||
{
|
||||
text1: `Do you give this application permission to transfer the following asset?`,
|
||||
text2: `Asset: ${assetInfo?.name}`,
|
||||
highlightedText: `Amount: ${amount}`,
|
||||
text1: i18n.t('question:permission_transfer_asset', {
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
text2: i18n.t('question:asset_name', {
|
||||
asset: assetInfo?.name,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
highlightedText: i18n.t('question:amount_qty', {
|
||||
quantity: amount,
|
||||
postProcess: 'capitalizeFirstChar',
|
||||
}),
|
||||
fee: fee,
|
||||
},
|
||||
isFromExtension
|
||||
|
Loading…
x
Reference in New Issue
Block a user