From ef5ac7e30b401cca10cd8ef6d79618f305e24de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hampus=20Sj=C3=B6berg?= Date: Mon, 20 Nov 2023 00:42:44 +0100 Subject: [PATCH] LightningBox: add translation texts --- locales/en.json | 31 +++++++- src/i18n/i18n.constants.ts | 3 +- src/windows/LightningBox/LightningBoxInfo.tsx | 12 ++-- .../LightningBox/LightningBoxRegistration.tsx | 70 +++++++++---------- src/windows/LightningBox/index.tsx | 1 - 5 files changed, 73 insertions(+), 44 deletions(-) diff --git a/locales/en.json b/locales/en.json index b0b57c5e2..e5308f1cd 100644 --- a/locales/en.json +++ b/locales/en.json @@ -2,13 +2,15 @@ "common": { "generic": { "lightningAddress": "Lightning Address", + "lightningBox": "Lightning Box", "nodeAlias": "Node alias", "description": "Description", "amount": "Amount", "fee": "Fee", "search": "Search", "viewInBlockExplorer": "View in block explorer", - "blocks": "{{numBlocks}} blocks" + "blocks": "{{numBlocks}} blocks", + "reason": "Reason: {{reason}}" }, "buttons": { "ok": "Ok", @@ -1138,6 +1140,33 @@ "msg1": "To start using Lightning in Blixt Wallet", "msg2": "send bitcoins to the address above" }, + "lightningBox.registration": { + "info": { + "welcome": "Welcome to the Lightning Box registration.", + "whatIs": "Lightning Box is a Lightning Address service provider that forwards payment requests directly to the phone, giving you a self-custodial Lightning Address for mobile devices.", + "persistentMode":"This service is dependent on persistent mode, because the app must stay active to receive incoming payments. Please make sure that battery optimization is turned off on your device. Otherwise this service may not work.", + "currentRules": "The service is free to use. However, due to technical reasons it currently requires a channel with the Lightning Box provider. It's currently not possible to change your Lightning Address after you have chosen one." + }, + "prerequisites": { + "prerequisites": "Prerequisites", + "checkingEligibility": "Checking eligibility...", + "eligible": "Eligible", + "youHaveChannel": "You have a channel with the Lightning Box service.", + "notEligible": "Not eligible" + }, + "registration": { + "registration": "Registration", + "fields": { + "address": "Address", + "messageToPayer": "Message to the payer" + }, + "register": "Register" + } + }, + "lightningBox.info": { + "yourLightningAddress": "Your Lightning Address by Lightning Box is:", + "showQrCode": "Show QR code" + }, "welcome.almostDone": { "autopilot": { "title": "Auto-open channels", diff --git a/src/i18n/i18n.constants.ts b/src/i18n/i18n.constants.ts index 2c0200da2..be2b488fe 100755 --- a/src/i18n/i18n.constants.ts +++ b/src/i18n/i18n.constants.ts @@ -10,7 +10,8 @@ export const namespaces = { experiment: "keysend.experiment", }, lightningBox: { - manage: "lightningBox.manage", + registration: "lightningBox.registration", + info: "lightningBox.info", }, lightningInfo: { lightningInfo: "lightningInfo.lightningInfo", diff --git a/src/windows/LightningBox/LightningBoxInfo.tsx b/src/windows/LightningBox/LightningBoxInfo.tsx index cf261a064..77387fed9 100644 --- a/src/windows/LightningBox/LightningBoxInfo.tsx +++ b/src/windows/LightningBox/LightningBoxInfo.tsx @@ -18,7 +18,7 @@ interface ILightningBoxProps { navigation: StackNavigationProp; } export default function LightningBoxRegistration({ navigation }: ILightningBoxProps) { - const t = useTranslation(namespaces.lightningBox.manage).t; + const t = useTranslation(namespaces.lightningBox.info).t; const lightningBoxAddress = useStoreState((store) => store.settings.lightningBoxAddress); // const lightningBoxLnurlPayDesc = useStoreState( @@ -36,7 +36,7 @@ export default function LightningBoxRegistration({ navigation }: ILightningBoxPr useLayoutEffect(() => { navigation.setOptions({ - headerTitle: t("title"), + headerTitle: t("generic.lightningBox", { ns: namespaces.common }), headerBackTitle: t("buttons.back", { ns: namespaces.common }), headerShown: true, }); @@ -59,9 +59,11 @@ export default function LightningBoxRegistration({ navigation }: ILightningBoxPr return ( -

Lightning Address

+

+ {t("generic.lightningAddress", { ns: namespaces.common })} +

- Your Lightning Address by Lightning Box is: + {t("yourLightningAddress")} @@ -69,7 +71,7 @@ export default function LightningBoxRegistration({ navigation }: ILightningBoxPr {showQrCode && } {!showQrCode && ( )}
diff --git a/src/windows/LightningBox/LightningBoxRegistration.tsx b/src/windows/LightningBox/LightningBoxRegistration.tsx index 21057f8f0..905616d40 100644 --- a/src/windows/LightningBox/LightningBoxRegistration.tsx +++ b/src/windows/LightningBox/LightningBoxRegistration.tsx @@ -23,7 +23,7 @@ import Container from "../../components/Container"; import { StackNavigationProp } from "@react-navigation/stack"; import { signMessageNodePubkey } from "../../lndmobile/wallet"; import { getUnixTime } from "date-fns"; -import { bytesToHexString, stringToUint8Array, timeout, toast } from "../../utils"; +import { bytesToHexString, stringToUint8Array, toast } from "../../utils"; import { useTranslation } from "react-i18next"; import { namespaces } from "../../i18n/i18n.constants"; import { NativeModules, Platform, StyleSheet } from "react-native"; @@ -62,7 +62,7 @@ interface ILightningBoxProps { } export default function LightningBoxRegistration({ navigation }: ILightningBoxProps) { const lightningBoxServer = useStoreState((store) => store.settings.lightningBoxServer); - const t = useTranslation(namespaces.lightningBox.manage).t; + const t = useTranslation(namespaces.lightningBox.registration).t; const tSettings = useTranslation(namespaces.settings.settings).t; const [loading, setLoading] = useState(false); @@ -115,14 +115,18 @@ export default function LightningBoxRegistration({ navigation }: ILightningBoxPr } } } catch (error: any) { - toast("Error: " + error.message, undefined, "danger"); + toast( + t("msg.error", { ns: namespaces.common }) + ": " + error.message, + undefined, + "danger", + ); } })(); }, []); useLayoutEffect(() => { navigation.setOptions({ - headerTitle: t("title"), + headerTitle: t("generic.lightningBox", { ns: namespaces.common }), headerBackTitle: t("buttons.back", { ns: namespaces.common }), headerShown: true, }); @@ -159,7 +163,7 @@ export default function LightningBoxRegistration({ navigation }: ILightningBoxPr } } catch (error) { console.error(error); - toast("Error: " + error.message, undefined, "danger"); + toast(t("msg.error", { ns: namespaces.common }) + ": " + error.message, undefined, "danger"); setLoading(false); } }; @@ -204,53 +208,43 @@ export default function LightningBoxRegistration({ navigation }: ILightningBoxPr return ( -

📥 Lightning Box

+

📥 {t("generic.lightningBox", { ns: namespaces.common })}

- Welcome to the Lightning Box registration. - - Lightning Box is a Lightning Address service provider that forwards payment requests - directly to the phone, giving you a self-custodial Lightning Address for mobile devices. - - - This service is dependent on persistent mode, because the app must stay active to - receive incoming payments. Please make sure that battery optimization is turned off on - your device. Otherwise this service may not work. - - - The service is free to use. However, due to technical reasons it currently requires a - channel with the Lightning Box provider. It's currently not possible to change your - Lightning Address after you have chosen one. - + {t("info.welcome")} + {t("info.whatIs")} + {t("info.persistentMode")} + {t("info.currentRules")} {/* Follow the steps below in order to register your account. */} -

Prerequisites

+

{t("prerequisites.prerequisites")}

- {lnboxIsEligible == null && ( - {/*t("prerequisites.eligibility")*/}Checking eligibility... - )} + {lnboxIsEligible == null && {t("prerequisites.checkingEligibility")}} {lnboxIsEligible === true && ( <> - Eligible - You have a channel with the Lightning Box service. + {t("prerequisites.eligible")} + {t("prerequisites.youHaveChannel")} )} {lnboxIsEligible === false && ( <> - Not eligible - Reason: {lnboxNotEligibleReason} + {t("prerequisites.notEligible")} + + {t("generic.reason", { + ns: namespaces.common, + reason: lnboxNotEligibleReason, + })} + )} - {lnboxIsEligible !== null && ( - - )} + {lnboxIsEligible !== null && } @@ -277,9 +271,9 @@ export default function LightningBoxRegistration({ navigation }: ILightningBoxPr
-

Registration

+

{t("registration.registration")}

- + @blixtwallet.com - + @@ -306,7 +300,11 @@ export default function LightningBoxRegistration({ navigation }: ILightningBoxPr primary={true} disabled={!(lnboxIsEligible && name && !loading)} > - {loading ? : Register} + {loading ? ( + + ) : ( + {t("registration.register")} + )}
diff --git a/src/windows/LightningBox/index.tsx b/src/windows/LightningBox/index.tsx index c3f195f04..ce0631b01 100644 --- a/src/windows/LightningBox/index.tsx +++ b/src/windows/LightningBox/index.tsx @@ -21,7 +21,6 @@ export default function LightningBox() { // We use the setting in order to decide whether the user shuold go to the // registration screen or info screen. const lightningBoxAddress = useStoreState((store) => store.settings.lightningBoxAddress); - console.log("hej lnbox", lightningBoxAddress); const screenOptions: StackNavigationOptions = { ...useStackNavigationOptions(),