Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lang): Update copy after review by PM #1920

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/FactsWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const FactsWidget = ({
showToast({
type: 'warning',
title: t('widget_error_drive'),
description: `An error occurred: ${error.message}`,
description: t('other:try_again'),
});
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/HeadlinesWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const HeadlinesWidget = ({
showToast({
type: 'warning',
title: t('widget_error_drive'),
description: `An error occurred: ${error.message}`,
description: t('other:try_again'),
});
}
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/SlashtagsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { seedHashSelector } from '../store/reselect/wallet';
import { showToast } from '../utils/notifications';
import { useAppSelector } from '../hooks/redux';
import { webRelaySelector } from '../store/reselect/settings';
import i18n from '../utils/i18n';

class Store {
location: string;
Expand Down Expand Up @@ -128,9 +129,8 @@ export const SlashtagsProvider = ({
) {
showToast({
type: 'warning',
title: 'Data Connection Issue',
description:
'An error occurred: Could not load primary key from keychain.',
title: i18n.t('other:error_keychain'),
description: i18n.t('other:error_keychain_msg'),
});
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/navigation/bottom-sheet/ForceTransfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const ForceTransfer = (): ReactElement => {
showToast({
type: 'warning',
title: t('close_error'),
description: closeResponse.error.message,
description: t('close_error_msg'),
});
setIsPending(false);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Contacts/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const Contact = ({
showToast({
type: 'warning',
title: t('contact_pay_error'),
description: `An error occurred: ${res.error.message}`,
description: t('other:try_again'),
});
}
};
Expand Down
4 changes: 3 additions & 1 deletion src/screens/Lightning/CustomConfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ const CustomConfirm = ({
showToast({
type: 'warning',
title: t('error_channel_purchase'),
description: purchaseResponse.error.message,
description: t('error_channel_setup_msg', {
raw: purchaseResponse.error.message,
}),
});
return;
}
Expand Down
9 changes: 3 additions & 6 deletions src/screens/Lightning/CustomSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -435,15 +435,12 @@ const CustomSetup = ({
setLoading(false);
if (purchaseResponse.isErr()) {
let msg = purchaseResponse.error.message;
if (msg.includes('Local channel balance is too small')) {
t('error_channel_receiving', {
usdValue: maxChannelSizeSat,
});
}
showToast({
type: 'warning',
title: t('error_channel_purchase'),
description: msg,
description: msg.includes('Local channel balance is too small')
? t('error_channel_receiving', { usdValue: maxChannelSizeSat })
: t('error_channel_setup_msg', { raw: msg }),
});
}
if (purchaseResponse.isOk()) {
Expand Down
4 changes: 3 additions & 1 deletion src/screens/Lightning/QuickSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ const QuickSetup = ({
showToast({
type: 'warning',
title: t('error_channel_purchase'),
description: purchaseResponse.error.message,
description: t('error_channel_setup_msg', {
raw: purchaseResponse.error.message,
}),
});
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Settings/Bitcoin/BitcoinNetworkSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const BitcoinNetworkSelection = ({
showToast({
type: 'error',
title: 'Error Switching Networks',
description: switchNetworkRes.error.message,
description: 'Please try again.',
});
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Settings/Lightning/CloseConnection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const CloseConnection = ({
showToast({
type: 'warning',
title: t('close_error'),
description: closeResponse.error.message,
description: t('close_error_msg'),
});
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Settings/WebRelay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const WebRelay = ({
showToast({
type: 'warning',
title: t('slashtags:error_saving_profile'),
description: res.error.message,
description: t('other:try_again'),
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/screens/Wallets/Send/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const Error = ({
showToast({
type: 'warning',
title: t('send_error_contact'),
description: res.error.message,
description: t('other:try_again'),
});

return;
Expand Down
4 changes: 2 additions & 2 deletions src/screens/Wallets/Send/FeeCustom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ const FeeCustom = ({
showToast({
type: 'info',
title: t('max_possible_fee_rate'),
description: `${maxFee} ${t('sats_per_vbyte')}`,
description: t('max_possible_fee_rate_msg'),
});
return;
}
if (Number(feeRate) < minFee) {
showToast({
type: 'info',
title: t('min_possible_fee_rate'),
description: `${minFee} ${t('sats_per_vbyte')}`,
description: t('min_possible_fee_rate_msg'),
});
return;
}
Expand Down
23 changes: 7 additions & 16 deletions src/screens/Wallets/Send/ReviewAndSend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ const ReviewAndSend = ({

const createLightningTransaction = useCallback(async () => {
if (!transaction.lightningInvoice || !decodedInvoice) {
onError(`${t('send_error_create_tx')}. ${t('error_no_invoice')}`);
setIsLoading(false);
onError(t('send_error_create_tx'));
return;
}

Expand Down Expand Up @@ -230,9 +230,8 @@ const ReviewAndSend = ({
return;
}

onError(
`${t('send_error_create_tx')}. ${payInvoiceResponse.error.message}`,
);
console.error(errorMessage);
onError(t('send_error_create_tx'));
return;
}

Expand All @@ -259,25 +258,17 @@ const ReviewAndSend = ({
setIsLoading(true);
const transactionIsValid = validateTransaction(transaction);
if (transactionIsValid.isErr()) {
setIsLoading(false);
onError(
`${t('send_error_create_tx')}. ${transactionIsValid.error.message}`,
);
return;
throw Error(transactionIsValid.error.message);
}
const response = await createTransaction({});
if (response.isErr()) {
setIsLoading(false);
onError(`${t('send_error_create_tx')}. ${response.error.message}`);
return;
}
if (__DEV__) {
console.log(response.value);
throw Error(response.error.message);
}
setRawTx(response.value);
} catch (error) {
onError(`${t('send_error_create_tx')}. ${(error as Error).message}`);
setIsLoading(false);
console.error(error.message);
onError(t('send_error_create_tx'));
}
}, [transaction, onError, t]);

Expand Down
14 changes: 7 additions & 7 deletions src/store/utils/blocktank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ export const startChannelPurchase = async ({
showToast({
type: 'warning',
title: i18n.t('other:bt_error_retrieve'),
description: `An error occurred: ${orderData.error.message}`,
description: i18n.t('other:bt_error_retrieve_msg', {
raw: orderData.error.message,
}),
});
return err(orderData.error.message);
}
Expand Down Expand Up @@ -336,11 +338,7 @@ export const confirmChannelPurchase = async ({
}): Promise<Result<{ txid: string; useUnconfirmedInputs: boolean }>> => {
const rawTx = await createTransaction();
if (rawTx.isErr()) {
showToast({
type: 'warning',
title: i18n.t('wallet:error_create_tx'),
description: rawTx.error.message,
});
// toast shown from createTransaction
return err(rawTx.error.message);
}

Expand All @@ -356,7 +354,9 @@ export const confirmChannelPurchase = async ({
showToast({
type: 'warning',
title: i18n.t('wallet:error_broadcast_tx'),
description: broadcastResponse.error.message,
description: i18n.t('wallet:error_broadcast_tx', {
raw: broadcastResponse.error.message,
}),
});
return err(broadcastResponse.error.message);
}
Expand Down
7 changes: 4 additions & 3 deletions src/utils/blocktank/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { updateUser } from '../../store/slices/user';
import { setGeoBlock } from '../../store/utils/user';
import { refreshWallet } from '../wallet';
import { __BLOCKTANK_HOST__ } from '../../constants/env';
import i18n from '../i18n';

const bt = new BlocktankClient();

Expand Down Expand Up @@ -86,7 +87,7 @@ export const createOrder = async ({
// Ensure we're properly connected to the Blocktank node prior to buying a channel.
const addPeersRes = await addPeers();
if (addPeersRes.isErr()) {
return err('Unable to add Blocktank node as a peer at this time.');
return err(i18n.t('other:bt_error_connect'));
}
const buyRes = await bt.createOrder(lspBalance, channelExpiryWeeks, {
...options,
Expand Down Expand Up @@ -156,7 +157,7 @@ export const createCJitEntry = async ({
// Ensure we're properly connected to the Blocktank node prior to buying a channel.
const addPeersRes = await addPeers();
if (addPeersRes.isErr()) {
return err('Unable to add Blocktank node as a peer at this time.');
return err(i18n.t('other:bt_error_connect'));
}

const createRes = await bt.createCJitEntry(
Expand All @@ -171,7 +172,7 @@ export const createCJitEntry = async ({
return ok(createRes);
} catch (e) {
console.log(e);
return err(e);
return err(i18n.t('wallet:receive_cjit_error_msg', { raw: e }));
}
};

Expand Down
4 changes: 4 additions & 0 deletions src/utils/i18n/locales/en/lightning.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"continue": "Try Again"
},
"error_channel_purchase": "Instant Payments Setup Failed",
"error_channel_setup_msg": "An error occurred when setting up your instant balance. {raw}",
"error_channel_receiving": "Receiving amount needs to be greater than ${usdValue}",
"enter_money": "Enter the amount of bitcoin you want to be able to spend instantly.",
"spending": "Spending",
Expand Down Expand Up @@ -96,6 +97,8 @@
"error_invoice": "Failed to Create Invoice",
"error_add_title": "Unable To Add Lightning Peer",
"error_add": "Bitkit could not add the Lightning peer.",
"error_add_raw": "An error occured while we added lightning peer: {raw}",
"error_add_uri": "The URI appears to be invalid.",
"error_add_tor": "Bitkit cannot add tor nodes.",
"error_save_title": "Unable To Save Lightning Peer",
"error_save": "Unable to save lightning peer",
Expand Down Expand Up @@ -126,6 +129,7 @@
},
"close_conn": "Close Connection",
"close_error": "Transfer Failed",
"close_error_msg": "Unable to transfer your funds back to savings. Please try again.",
"close_success_title": "Transfer Initiated",
"close_success_msg": "Your funds are being transferred back to your savings.",
"close_text": "The fee to close this Lightning Connection and transfer your funds back to your savings depends on network conditions.\n\nFunds transfer to savings is usually instant, but settlement may take up to <accent>14 days</accent> under certain network conditions.",
Expand Down
9 changes: 8 additions & 1 deletion src/utils/i18n/locales/en/other.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"buy_header": "Buy some\n<accent>Bitcoin</accent>",
"buy_text": "Don’t have any Bitcoin or need more?",
"buy_button": "Choose exchange",
"error_keychain": "Data Connection Issue",
"error_keychain_msg": "An error occured: Could not load primaryKey.",
"connection_restored_title": "Electrum Connection Restored",
"connection_restored_message": "Bitkit successfully reconnected to Electrum.",
"connection_issue": "Internet Connectivity Issues",
Expand Down Expand Up @@ -54,6 +56,7 @@
"lnurl_ln_error_msg": "Could not start local Lightning node. Please try again or restart Bitkit.",
"lnurl_pay_error_no_capacity": "Not enough outbound/sending capacity to complete lnurl-pay request.",
"lnurl_channel_error": "Unable To Open Channel (LNURL)",
"lnurl_channel_error_raw": "An error occured when you tried paying: {raw}",
"lnurl_channel_header": "Lightning Connection",
"lnurl_channel_title": "New\nlightning\n<accent>connection</accent>",
"lnurl_channel_message": "Do you want open a Lightning connection with this Lightning Service Provider?",
Expand All @@ -68,6 +71,7 @@
"lnurl_channel_success_msg_peer": "Successfully requested channel from: {peer}",
"lnurl_channel_success_msg_no_peer": "Successfully requested channel.",
"lnurl_auth_error": "Sign In Failed (LNURL)",
"lnurl_auth_error_msg": "An error occurred when you attempted to sign in. {raw}",
"lnurl_auth_success_title": "Signed In",
"lnurl_auth_success_msg_domain": "You successfully signed in to {domain}.",
"lnurl_auth_success_msg_no_domain": "You successfully signed in.",
Expand All @@ -80,10 +84,13 @@
"lnurl_withdr_success_msg": "Your withdraw was successfully requested.",
"phone_settings": "Open Phone Settings",
"bt_error_retrieve": "Transfer Failed",
"bt_error_connect": "Unable to add LSP node as a peer at this time.",
"bt_error_retrieve_msg": "An error occurred when moving funds. {raw}",
"bt_channel_purchase_cost_error": "You need {delta} more to complete this transaction.",
"earlier": "EARLIER",
"update_nav_title": "Update Available",
"update_title": "Update\n<accent>Bitkit</accent>",
"update_text": "Please update Bitkit to the latest version for new features and bug fixes!",
"update_button": "Update"
"update_button": "Update",
"try_again" : "Please try again."
}
2 changes: 1 addition & 1 deletion src/utils/i18n/locales/en/slashtags.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"error_saving_contact": "Unable To Save Contact",
"error_saving_profile": "Unable To Save Profile",
"error_pay_title": "Unable To Pay Contact",
"error_pay_empty_msg": "There is no payment data available for this contact.",
"error_pay_empty_msg": "This contact has no payment data.",
"auth_depricated_title": "Deprecated",
"auth_depricated_msg": "Slashauth is deprecated. Please use Bitkit Beta."
}
Loading
Loading