Skip to content

Commit 162d751

Browse files
committed
chore(lang): Update copy
1 parent 6c75bd0 commit 162d751

File tree

27 files changed

+100
-69
lines changed

27 files changed

+100
-69
lines changed

src/components/FactsWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const FactsWidget = ({
4646
showToast({
4747
type: 'warning',
4848
title: t('widget_error_drive'),
49-
description: `An error occurred: ${error.message}`,
49+
description: t('other:try_again'),
5050
});
5151
}
5252
};

src/components/HeadlinesWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const HeadlinesWidget = ({
7878
showToast({
7979
type: 'warning',
8080
title: t('widget_error_drive'),
81-
description: `An error occurred: ${error.message}`,
81+
description: t('other:try_again'),
8282
});
8383
}
8484
};

src/components/SlashtagsProvider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { seedHashSelector } from '../store/reselect/wallet';
1313
import { showToast } from '../utils/notifications';
1414
import { useAppSelector } from '../hooks/redux';
1515
import { webRelaySelector } from '../store/reselect/settings';
16+
import i18n from '../utils/i18n';
1617

1718
class Store {
1819
location: string;
@@ -128,9 +129,8 @@ export const SlashtagsProvider = ({
128129
) {
129130
showToast({
130131
type: 'warning',
131-
title: 'Data Connection Issue',
132-
description:
133-
'An error occurred: Could not load primary key from keychain.',
132+
title: i18n.t('other:error_keychain'),
133+
description: i18n.t('other:error_keychain_msg'),
134134
});
135135
return;
136136
}

src/navigation/bottom-sheet/ForceTransfer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const ForceTransfer = (): ReactElement => {
9494
showToast({
9595
type: 'warning',
9696
title: t('close_error'),
97-
description: closeResponse.error.message,
97+
description: t('close_error_msg'),
9898
});
9999
setIsPending(false);
100100
return;

src/screens/Contacts/Contact.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const Contact = ({
9494
showToast({
9595
type: 'warning',
9696
title: t('contact_pay_error'),
97-
description: `An error occurred: ${res.error.message}`,
97+
description: t('other:try_again'),
9898
});
9999
}
100100
};

src/screens/Lightning/CustomConfirm.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ const CustomConfirm = ({
8282
showToast({
8383
type: 'warning',
8484
title: t('error_channel_purchase'),
85-
description: purchaseResponse.error.message,
85+
description: t('error_channel_setup_msg', {
86+
raw: purchaseResponse.error.message,
87+
}),
8688
});
8789
return;
8890
}

src/screens/Lightning/CustomSetup.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,12 @@ const CustomSetup = ({
435435
setLoading(false);
436436
if (purchaseResponse.isErr()) {
437437
let msg = purchaseResponse.error.message;
438-
if (msg.includes('Local channel balance is too small')) {
439-
t('error_channel_receiving', {
440-
usdValue: maxChannelSizeSat,
441-
});
442-
}
443438
showToast({
444439
type: 'warning',
445440
title: t('error_channel_purchase'),
446-
description: msg,
441+
description: msg.includes('Local channel balance is too small')
442+
? t('error_channel_receiving', { usdValue: maxChannelSizeSat })
443+
: t('error_channel_setup_msg', { raw: msg }),
447444
});
448445
}
449446
if (purchaseResponse.isOk()) {

src/screens/Lightning/QuickSetup.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ const QuickSetup = ({
172172
showToast({
173173
type: 'warning',
174174
title: t('error_channel_purchase'),
175-
description: purchaseResponse.error.message,
175+
description: t('error_channel_setup_msg', {
176+
raw: purchaseResponse.error.message,
177+
}),
176178
});
177179
return;
178180
}

src/screens/Settings/Bitcoin/BitcoinNetworkSelection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const BitcoinNetworkSelection = ({
3535
showToast({
3636
type: 'error',
3737
title: 'Error Switching Networks',
38-
description: switchNetworkRes.error.message,
38+
description: 'Please try again.',
3939
});
4040
return;
4141
}

src/screens/Settings/Lightning/CloseConnection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const CloseConnection = ({
4949
showToast({
5050
type: 'warning',
5151
title: t('close_error'),
52-
description: closeResponse.error.message,
52+
description: t('close_error_msg'),
5353
});
5454
return;
5555
}

src/screens/Settings/WebRelay/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const WebRelay = ({
109109
showToast({
110110
type: 'warning',
111111
title: t('slashtags:error_saving_profile'),
112-
description: res.error.message,
112+
description: t('other:try_again'),
113113
});
114114
});
115115

src/screens/Wallets/Send/Error.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const Error = ({
7878
showToast({
7979
type: 'warning',
8080
title: t('send_error_contact'),
81-
description: res.error.message,
81+
description: t('other:try_again'),
8282
});
8383

8484
return;

src/screens/Wallets/Send/FeeCustom.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ const FeeCustom = ({
6767
showToast({
6868
type: 'info',
6969
title: t('max_possible_fee_rate'),
70-
description: `${maxFee} ${t('sats_per_vbyte')}`,
70+
description: t('max_possible_fee_rate_msg'),
7171
});
7272
return;
7373
}
7474
if (Number(feeRate) < minFee) {
7575
showToast({
7676
type: 'info',
7777
title: t('min_possible_fee_rate'),
78-
description: `${minFee} ${t('sats_per_vbyte')}`,
78+
description: t('min_possible_fee_rate_msg'),
7979
});
8080
return;
8181
}

src/screens/Wallets/Send/ReviewAndSend.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ const ReviewAndSend = ({
182182

183183
const createLightningTransaction = useCallback(async () => {
184184
if (!transaction.lightningInvoice || !decodedInvoice) {
185-
onError(`${t('send_error_create_tx')}. ${t('error_no_invoice')}`);
186185
setIsLoading(false);
186+
onError(t('send_error_create_tx'));
187187
return;
188188
}
189189

@@ -230,9 +230,8 @@ const ReviewAndSend = ({
230230
return;
231231
}
232232

233-
onError(
234-
`${t('send_error_create_tx')}. ${payInvoiceResponse.error.message}`,
235-
);
233+
console.error(errorMessage);
234+
onError(t('send_error_create_tx'));
236235
return;
237236
}
238237

@@ -259,25 +258,17 @@ const ReviewAndSend = ({
259258
setIsLoading(true);
260259
const transactionIsValid = validateTransaction(transaction);
261260
if (transactionIsValid.isErr()) {
262-
setIsLoading(false);
263-
onError(
264-
`${t('send_error_create_tx')}. ${transactionIsValid.error.message}`,
265-
);
266-
return;
261+
throw Error(transactionIsValid.error.message);
267262
}
268263
const response = await createTransaction({});
269264
if (response.isErr()) {
270-
setIsLoading(false);
271-
onError(`${t('send_error_create_tx')}. ${response.error.message}`);
272-
return;
273-
}
274-
if (__DEV__) {
275-
console.log(response.value);
265+
throw Error(response.error.message);
276266
}
277267
setRawTx(response.value);
278268
} catch (error) {
279-
onError(`${t('send_error_create_tx')}. ${(error as Error).message}`);
280269
setIsLoading(false);
270+
console.error(error.message);
271+
onError(t('send_error_create_tx'));
281272
}
282273
}, [transaction, onError, t]);
283274

src/store/utils/blocktank.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ export const startChannelPurchase = async ({
265265
showToast({
266266
type: 'warning',
267267
title: i18n.t('other:bt_error_retrieve'),
268-
description: `An error occurred: ${orderData.error.message}`,
268+
description: i18n.t('other:bt_error_retrieve_msg', {
269+
raw: orderData.error.message,
270+
}),
269271
});
270272
return err(orderData.error.message);
271273
}
@@ -336,11 +338,7 @@ export const confirmChannelPurchase = async ({
336338
}): Promise<Result<{ txid: string; useUnconfirmedInputs: boolean }>> => {
337339
const rawTx = await createTransaction();
338340
if (rawTx.isErr()) {
339-
showToast({
340-
type: 'warning',
341-
title: i18n.t('wallet:error_create_tx'),
342-
description: rawTx.error.message,
343-
});
341+
// toast shown from createTransaction
344342
return err(rawTx.error.message);
345343
}
346344

@@ -356,7 +354,9 @@ export const confirmChannelPurchase = async ({
356354
showToast({
357355
type: 'warning',
358356
title: i18n.t('wallet:error_broadcast_tx'),
359-
description: broadcastResponse.error.message,
357+
description: i18n.t('wallet:error_broadcast_tx', {
358+
raw: broadcastResponse.error.message,
359+
}),
360360
});
361361
return err(broadcastResponse.error.message);
362362
}

src/utils/blocktank/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { updateUser } from '../../store/slices/user';
2424
import { setGeoBlock } from '../../store/utils/user';
2525
import { refreshWallet } from '../wallet';
2626
import { __BLOCKTANK_HOST__ } from '../../constants/env';
27+
import i18n from '../i18n';
2728

2829
const bt = new BlocktankClient();
2930

@@ -86,7 +87,7 @@ export const createOrder = async ({
8687
// Ensure we're properly connected to the Blocktank node prior to buying a channel.
8788
const addPeersRes = await addPeers();
8889
if (addPeersRes.isErr()) {
89-
return err('Unable to add Blocktank node as a peer at this time.');
90+
return err(i18n.t('other:bt_error_connect'));
9091
}
9192
const buyRes = await bt.createOrder(lspBalance, channelExpiryWeeks, {
9293
...options,
@@ -156,7 +157,7 @@ export const createCJitEntry = async ({
156157
// Ensure we're properly connected to the Blocktank node prior to buying a channel.
157158
const addPeersRes = await addPeers();
158159
if (addPeersRes.isErr()) {
159-
return err('Unable to add Blocktank node as a peer at this time.');
160+
return err(i18n.t('other:bt_error_connect'));
160161
}
161162

162163
const createRes = await bt.createCJitEntry(
@@ -171,7 +172,7 @@ export const createCJitEntry = async ({
171172
return ok(createRes);
172173
} catch (e) {
173174
console.log(e);
174-
return err(e);
175+
return err(i18n.t('wallet:receive_cjit_error_msg', { raw: e }));
175176
}
176177
};
177178

src/utils/i18n/locales/en/lightning.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"continue": "Try Again"
3939
},
4040
"error_channel_purchase": "Instant Payments Setup Failed",
41+
"error_channel_setup_msg": "An error occurred when setting up your instant balance. {raw}",
4142
"error_channel_receiving": "Receiving amount needs to be greater than ${usdValue}",
4243
"enter_money": "Enter the amount of bitcoin you want to be able to spend instantly.",
4344
"spending": "Spending",
@@ -96,6 +97,8 @@
9697
"error_invoice": "Failed to Create Invoice",
9798
"error_add_title": "Unable To Add Lightning Peer",
9899
"error_add": "Bitkit could not add the Lightning peer.",
100+
"error_add_raw": "An error occured while we added lightning peer: {raw}",
101+
"error_add_uri": "The URI appears to be invalid.",
99102
"error_add_tor": "Bitkit cannot add tor nodes.",
100103
"error_save_title": "Unable To Save Lightning Peer",
101104
"error_save": "Unable to save lightning peer",
@@ -126,6 +129,7 @@
126129
},
127130
"close_conn": "Close Connection",
128131
"close_error": "Transfer Failed",
132+
"close_error_msg": "Unable to transfer your funds back to savings. Please try again.",
129133
"close_success_title": "Transfer Initiated",
130134
"close_success_msg": "Your funds are being transferred back to your savings.",
131135
"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.",

src/utils/i18n/locales/en/other.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"buy_header": "Buy some\n<accent>Bitcoin</accent>",
1414
"buy_text": "Don’t have any Bitcoin or need more?",
1515
"buy_button": "Choose exchange",
16+
"error_keychain": "Data Connection Issue",
17+
"error_keychain_msg": "An error occured: Could not load primaryKey.",
1618
"connection_restored_title": "Electrum Connection Restored",
1719
"connection_restored_message": "Bitkit successfully reconnected to Electrum.",
1820
"connection_issue": "Internet Connectivity Issues",
@@ -54,6 +56,7 @@
5456
"lnurl_ln_error_msg": "Could not start local Lightning node. Please try again or restart Bitkit.",
5557
"lnurl_pay_error_no_capacity": "Not enough outbound/sending capacity to complete lnurl-pay request.",
5658
"lnurl_channel_error": "Unable To Open Channel (LNURL)",
59+
"lnurl_channel_error_raw": "An error occured when you tried paying: {raw}",
5760
"lnurl_channel_header": "Lightning Connection",
5861
"lnurl_channel_title": "New\nlightning\n<accent>connection</accent>",
5962
"lnurl_channel_message": "Do you want open a Lightning connection with this Lightning Service Provider?",
@@ -68,6 +71,7 @@
6871
"lnurl_channel_success_msg_peer": "Successfully requested channel from: {peer}",
6972
"lnurl_channel_success_msg_no_peer": "Successfully requested channel.",
7073
"lnurl_auth_error": "Sign In Failed (LNURL)",
74+
"lnurl_auth_error_msg": "An error occurred when you attempted to sign in. {raw}",
7175
"lnurl_auth_success_title": "Signed In",
7276
"lnurl_auth_success_msg_domain": "You successfully signed in to {domain}.",
7377
"lnurl_auth_success_msg_no_domain": "You successfully signed in.",
@@ -80,10 +84,13 @@
8084
"lnurl_withdr_success_msg": "Your withdraw was successfully requested.",
8185
"phone_settings": "Open Phone Settings",
8286
"bt_error_retrieve": "Transfer Failed",
87+
"bt_error_connect": "Unable to add LSP node as a peer at this time.",
88+
"bt_error_retrieve_msg": "An error occurred when moving funds. {raw}",
8389
"bt_channel_purchase_cost_error": "You need {delta} more to complete this transaction.",
8490
"earlier": "EARLIER",
8591
"update_nav_title": "Update Available",
8692
"update_title": "Update\n<accent>Bitkit</accent>",
8793
"update_text": "Please update Bitkit to the latest version for new features and bug fixes!",
88-
"update_button": "Update"
94+
"update_button": "Update",
95+
"try_again" : "Please try again."
8996
}

src/utils/i18n/locales/en/slashtags.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"error_saving_contact": "Unable To Save Contact",
8080
"error_saving_profile": "Unable To Save Profile",
8181
"error_pay_title": "Unable To Pay Contact",
82-
"error_pay_empty_msg": "There is no payment data available for this contact.",
82+
"error_pay_empty_msg": "This contact has no payment data.",
8383
"auth_depricated_title": "Deprecated",
8484
"auth_depricated_msg": "Slashauth is deprecated. Please use Bitkit Beta."
8585
}

0 commit comments

Comments
 (0)