diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-09 11:03:30 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-09 11:03:30 -0300 |
commit | 7d07f752eb4e6606c83cba6d2bf84369b6fab32f (patch) | |
tree | 77264d98358a4ad965d3da78098b304f0359de62 /packages/demobank-ui/src/pages | |
parent | 1665cf4f72b831412e5d704d02be5887be090e50 (diff) | |
download | wallet-core-7d07f752eb4e6606c83cba6d2bf84369b6fab32f.tar.xz |
new string added to i18n
Diffstat (limited to 'packages/demobank-ui/src/pages')
5 files changed, 52 insertions, 27 deletions
diff --git a/packages/demobank-ui/src/pages/home/PaytoWireTransferForm.tsx b/packages/demobank-ui/src/pages/home/PaytoWireTransferForm.tsx index 6abcebcd8..fb2ae3196 100644 --- a/packages/demobank-ui/src/pages/home/PaytoWireTransferForm.tsx +++ b/packages/demobank-ui/src/pages/home/PaytoWireTransferForm.tsx @@ -20,7 +20,10 @@ import { h, VNode } from "preact"; import { StateUpdater, useEffect, useRef, useState } from "preact/hooks"; import { useBackendContext } from "../../context/backend.js"; import { PageStateType, usePageContext } from "../../context/pageState.js"; -import { useTranslationContext } from "../../context/translation.js"; +import { + InternationalizationAPI, + useTranslationContext, +} from "../../context/translation.js"; import { BackendState } from "../../hooks/backend.js"; import { prepareHeaders, undefinedIfEmpty } from "../../utils.js"; import { ShowInputErrorLabel } from "./ShowInputErrorLabel.js"; @@ -192,6 +195,7 @@ export function PaytoWireTransferForm({ iban: undefined, subject: undefined, })), + i18n, ); }} /> @@ -291,6 +295,7 @@ export function PaytoWireTransferForm({ backend.state, pageStateSetter, () => rawPaytoInputSetter(undefined), + i18n, ); }} /> @@ -357,6 +362,7 @@ async function createTransactionCall( * a stateful management of the input data yet. */ cleanUpForm: () => void, + i18n: InternationalizationAPI, ): Promise<void> { if (backendState.status === "loggedOut") { logger.error("No credentials found."); @@ -364,7 +370,7 @@ async function createTransactionCall( ...prevState, error: { - title: "No credentials found.", + title: i18n.str`No credentials found.`, }, })); return; @@ -388,7 +394,7 @@ async function createTransactionCall( ...prevState, error: { - title: `Could not create the wire transfer`, + title: i18n.str`Could not create the wire transfer`, description: (error as any).error.description, debug: JSON.stringify(error), }, @@ -405,7 +411,7 @@ async function createTransactionCall( ...prevState, error: { - title: `Transfer creation gave response error`, + title: i18n.str`Transfer creation gave response error`, description: response.error.description, debug: JSON.stringify(response), }, @@ -417,7 +423,7 @@ async function createTransactionCall( pageStateSetter((prevState) => ({ ...prevState, - info: "Wire transfer created!", + info: i18n.str`Wire transfer created!`, })); // Only at this point the input data can diff --git a/packages/demobank-ui/src/pages/home/QrCodeSection.tsx b/packages/demobank-ui/src/pages/home/QrCodeSection.tsx index 7c262fdc6..4199ead86 100644 --- a/packages/demobank-ui/src/pages/home/QrCodeSection.tsx +++ b/packages/demobank-ui/src/pages/home/QrCodeSection.tsx @@ -44,9 +44,11 @@ export function QrCodeSection({ <p>{i18n.str`Use this QR code to withdraw to your mobile wallet:`}</p> {QR({ text: talerWithdrawUri })} <p> - Click{" "} - <a id="linkqr" href={talerWithdrawUri}>{i18n.str`this link`}</a> to - open your Taler wallet! + <i18n.Translate> + Click{" "} + <a id="linkqr" href={talerWithdrawUri}>{i18n.str`this link`}</a>{" "} + to open your Taler wallet! + </i18n.Translate> </p> <br /> {abortButton} diff --git a/packages/demobank-ui/src/pages/home/RegistrationPage.tsx b/packages/demobank-ui/src/pages/home/RegistrationPage.tsx index ecec5793c..fb7e975fb 100644 --- a/packages/demobank-ui/src/pages/home/RegistrationPage.tsx +++ b/packages/demobank-ui/src/pages/home/RegistrationPage.tsx @@ -19,7 +19,10 @@ import { route } from "preact-router"; import { StateUpdater, useState } from "preact/hooks"; import { useBackendContext } from "../../context/backend.js"; import { PageStateType, usePageContext } from "../../context/pageState.js"; -import { useTranslationContext } from "../../context/translation.js"; +import { + InternationalizationAPI, + useTranslationContext, +} from "../../context/translation.js"; import { BackendStateHandler } from "../../hooks/backend.js"; import { bankUiSettings } from "../../settings.js"; import { getBankBackendBaseUrl, undefinedIfEmpty } from "../../utils.js"; @@ -148,6 +151,7 @@ function RegistrationForm(): VNode { { username, password }, backend, // will store BE URL, if OK. pageStateSetter, + i18n, ); setUsername(undefined); @@ -193,6 +197,7 @@ async function registrationCall( */ backend: BackendStateHandler, pageStateSetter: StateUpdater<PageStateType>, + i18n: InternationalizationAPI, ): Promise<void> { const url = getBankBackendBaseUrl(); @@ -218,7 +223,7 @@ async function registrationCall( ...prevState, error: { - title: `Registration failed, please report`, + title: i18n.str`Registration failed, please report`, debug: JSON.stringify(error), }, })); @@ -231,7 +236,7 @@ async function registrationCall( ...prevState, error: { - title: `That username is already taken`, + title: i18n.str`That username is already taken`, debug: JSON.stringify(response), }, })); @@ -240,7 +245,7 @@ async function registrationCall( ...prevState, error: { - title: `New registration gave response error`, + title: i18n.str`New registration gave response error`, debug: JSON.stringify(response), }, })); diff --git a/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx b/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx index bc3880ee2..5304b6273 100644 --- a/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx +++ b/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx @@ -19,7 +19,10 @@ import { h, VNode } from "preact"; import { StateUpdater, useEffect, useRef } from "preact/hooks"; import { useBackendContext } from "../../context/backend.js"; import { PageStateType, usePageContext } from "../../context/pageState.js"; -import { useTranslationContext } from "../../context/translation.js"; +import { + InternationalizationAPI, + useTranslationContext, +} from "../../context/translation.js"; import { BackendState } from "../../hooks/backend.js"; import { prepareHeaders, validateAmount } from "../../utils.js"; @@ -91,6 +94,7 @@ export function WalletWithdrawForm({ `${currency}:${submitAmount}`, backend.state, pageStateSetter, + i18n, ); }} /> @@ -113,6 +117,7 @@ async function createWithdrawalCall( amount: string, backendState: BackendState, pageStateSetter: StateUpdater<PageStateType>, + i18n: InternationalizationAPI, ): Promise<void> { if (backendState?.status === "loggedOut") { logger.error("Page has a problem: no credentials found in the state."); @@ -120,7 +125,7 @@ async function createWithdrawalCall( ...prevState, error: { - title: "No credentials given.", + title: i18n.str`No credentials given.`, }, })); return; @@ -147,7 +152,7 @@ async function createWithdrawalCall( ...prevState, error: { - title: `Could not create withdrawal operation`, + title: i18n.str`Could not create withdrawal operation`, description: (error as any).error.description, debug: JSON.stringify(error), }, @@ -163,7 +168,7 @@ async function createWithdrawalCall( ...prevState, error: { - title: `Withdrawal creation gave response error`, + title: i18n.str`Withdrawal creation gave response error`, description: response.error.description, debug: JSON.stringify(response), }, diff --git a/packages/demobank-ui/src/pages/home/WithdrawalConfirmationQuestion.tsx b/packages/demobank-ui/src/pages/home/WithdrawalConfirmationQuestion.tsx index 26c3b22fd..ad6980f55 100644 --- a/packages/demobank-ui/src/pages/home/WithdrawalConfirmationQuestion.tsx +++ b/packages/demobank-ui/src/pages/home/WithdrawalConfirmationQuestion.tsx @@ -19,7 +19,10 @@ import { Fragment, h, VNode } from "preact"; import { StateUpdater } from "preact/hooks"; import { useBackendContext } from "../../context/backend.js"; import { PageStateType, usePageContext } from "../../context/pageState.js"; -import { useTranslationContext } from "../../context/translation.js"; +import { + InternationalizationAPI, + useTranslationContext, +} from "../../context/translation.js"; import { BackendState } from "../../hooks/backend.js"; import { prepareHeaders } from "../../utils.js"; @@ -80,6 +83,7 @@ export function WithdrawalConfirmationQuestion(): VNode { backend.state, pageState.withdrawalId, pageStateSetter, + i18n, ); return; } @@ -102,6 +106,7 @@ export function WithdrawalConfirmationQuestion(): VNode { backend.state, pageState.withdrawalId, pageStateSetter, + i18n, ) } > @@ -139,6 +144,7 @@ async function confirmWithdrawalCall( backendState: BackendState, withdrawalId: string | undefined, pageStateSetter: StateUpdater<PageStateType>, + i18n: InternationalizationAPI, ): Promise<void> { if (backendState.status === "loggedOut") { logger.error("No credentials found."); @@ -146,7 +152,7 @@ async function confirmWithdrawalCall( ...prevState, error: { - title: "No credentials found.", + title: i18n.str`"No credentials found.`, }, })); return; @@ -157,7 +163,7 @@ async function confirmWithdrawalCall( ...prevState, error: { - title: "No withdrawal ID found.", + title: i18n.str`No withdrawal ID found.`, }, })); return; @@ -192,7 +198,7 @@ async function confirmWithdrawalCall( ...prevState, error: { - title: `Could not confirm the withdrawal`, + title: i18n.str`Could not confirm the withdrawal`, description: (error as any).error.description, debug: JSON.stringify(error), }, @@ -210,7 +216,7 @@ async function confirmWithdrawalCall( ...prevState, error: { - title: `Withdrawal confirmation gave response error`, + title: i18n.str`Withdrawal confirmation gave response error`, debug: JSON.stringify(response), }, })); @@ -222,7 +228,7 @@ async function confirmWithdrawalCall( return { ...rest, - info: "Withdrawal confirmed!", + info: i18n.str`Withdrawal confirmed!`, }; }); } @@ -234,6 +240,7 @@ async function abortWithdrawalCall( backendState: BackendState, withdrawalId: string | undefined, pageStateSetter: StateUpdater<PageStateType>, + i18n: InternationalizationAPI, ): Promise<void> { if (backendState.status === "loggedOut") { logger.error("No credentials found."); @@ -241,7 +248,7 @@ async function abortWithdrawalCall( ...prevState, error: { - title: `No credentials found.`, + title: i18n.str`No credentials found.`, }, })); return; @@ -252,7 +259,7 @@ async function abortWithdrawalCall( ...prevState, error: { - title: `No withdrawal ID found.`, + title: i18n.str`No withdrawal ID found.`, }, })); return; @@ -284,7 +291,7 @@ async function abortWithdrawalCall( ...prevState, error: { - title: `Could not abort the withdrawal.`, + title: i18n.str`Could not abort the withdrawal.`, description: (error as any).error.description, debug: JSON.stringify(error), }, @@ -301,7 +308,7 @@ async function abortWithdrawalCall( ...prevState, error: { - title: `Withdrawal abortion failed.`, + title: i18n.str`Withdrawal abortion failed.`, description: response.error.description, debug: JSON.stringify(response), }, @@ -314,7 +321,7 @@ async function abortWithdrawalCall( return { ...rest, - info: "Withdrawal aborted!", + info: i18n.str`Withdrawal aborted!`, }; }); } |