diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src')
37 files changed, 496 insertions, 424 deletions
diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx b/packages/taler-wallet-webextension/src/NavigationBar.tsx index f0fc3da28..f72d54ef1 100644 --- a/packages/taler-wallet-webextension/src/NavigationBar.tsx +++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx @@ -67,10 +67,10 @@ export function PopupNavBar({ path = "" }: { path?: string }): VNode { return ( <NavigationHeader> <a href="/balance" class={path.startsWith("/balance") ? "active" : ""}> - <Translate>Balance</Translate> + <i18n.Translate>Balance</i18n.Translate> </a> <a href="/backup" class={path.startsWith("/backup") ? "active" : ""}> - <Translate>Backup</Translate> + <i18n.Translate>Backup</i18n.Translate> </a> <a /> <a href={innerUrl} target="_blank" rel="noreferrer"> @@ -85,15 +85,15 @@ export function WalletNavBar({ path = "" }: { path?: string }): VNode { <NavigationHeaderHolder> <NavigationHeader> <a href="/balance" class={path.startsWith("/balance") ? "active" : ""}> - <Translate>Balance</Translate> + <i18n.Translate>Balance</i18n.Translate> </a> <a href="/backup" class={path.startsWith("/backup") ? "active" : ""}> - <Translate>Backup</Translate> + <i18n.Translate>Backup</i18n.Translate> </a> <JustInDevMode> <a href="/dev" class={path.startsWith("/dev") ? "active" : ""}> - <Translate>Dev</Translate> + <i18n.Translate>Dev</i18n.Translate> </a> </JustInDevMode> @@ -102,7 +102,7 @@ export function WalletNavBar({ path = "" }: { path?: string }): VNode { href="/settings" class={path.startsWith("/settings") ? "active" : ""} > - <Translate>Settings</Translate> + <i18n.Translate>Settings</i18n.Translate> </a> </NavigationHeader> </NavigationHeaderHolder> diff --git a/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx b/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx index 205413007..e9a32ebf7 100644 --- a/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx +++ b/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { PaytoUri, Translate } from "@gnu-taler/taler-util"; +import { PaytoUri, i18n } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; import { CopiedIcon, CopyIcon } from "../svg"; @@ -34,23 +34,42 @@ export function BankDetailsByPaytoType({ amount, }: BankDetailsProps): VNode { const firstPart = !payto ? undefined : !payto.isKnown ? ( - <Row name={<Translate>Account</Translate>} value={payto.targetPath} /> + <Row + name={<i18n.Translate>Account</i18n.Translate>} + value={payto.targetPath} + /> ) : payto.targetType === "x-taler-bank" ? ( <Fragment> - <Row name={<Translate>Bank host</Translate>} value={payto.host} /> - <Row name={<Translate>Bank account</Translate>} value={payto.account} /> + <Row + name={<i18n.Translate>Bank host</i18n.Translate>} + value={payto.host} + /> + <Row + name={<i18n.Translate>Bank account</i18n.Translate>} + value={payto.account} + /> </Fragment> ) : payto.targetType === "iban" ? ( - <Row name={<Translate>IBAN</Translate>} value={payto.iban} /> + <Row name={<i18n.Translate>IBAN</i18n.Translate>} value={payto.iban} /> ) : undefined; return ( <div style={{ textAlign: "left" }}> <p>Bank transfer details</p> <table> {firstPart} - <Row name={<Translate>Exchange</Translate>} value={exchangeBaseUrl} /> - <Row name={<Translate>Chosen amount</Translate>} value={amount} /> - <Row name={<Translate>Subject</Translate>} value={subject} literal /> + <Row + name={<i18n.Translate>Exchange</i18n.Translate>} + value={exchangeBaseUrl} + /> + <Row + name={<i18n.Translate>Chosen amount</i18n.Translate>} + value={amount} + /> + <Row + name={<i18n.Translate>Subject</i18n.Translate>} + value={subject} + literal + /> </table> </div> ); diff --git a/packages/taler-wallet-webextension/src/components/DebugCheckbox.tsx b/packages/taler-wallet-webextension/src/components/DebugCheckbox.tsx index 522fbce98..b5ad7cda7 100644 --- a/packages/taler-wallet-webextension/src/components/DebugCheckbox.tsx +++ b/packages/taler-wallet-webextension/src/components/DebugCheckbox.tsx @@ -14,7 +14,7 @@ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Translate } from "@gnu-taler/taler-util"; +import { i18n } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; export function DebugCheckbox({ @@ -37,7 +37,9 @@ export function DebugCheckbox({ htmlFor="checkbox-perm" style={{ marginLeft: "0.5em", fontWeight: "bold" }} > - <Translate>Automatically open wallet based on page content</Translate> + <i18n.Translate> + Automatically open wallet based on page content + </i18n.Translate> </label> <span style={{ @@ -48,10 +50,10 @@ export function DebugCheckbox({ }} > ( - <Translate> + <i18n.Translate> Enabling this option below will make using the wallet faster, but requires more permissions from your browser. - </Translate> + </i18n.Translate> ) </span> </div> diff --git a/packages/taler-wallet-webextension/src/components/Diagnostics.tsx b/packages/taler-wallet-webextension/src/components/Diagnostics.tsx index 04b6abb55..b136ebc24 100644 --- a/packages/taler-wallet-webextension/src/components/Diagnostics.tsx +++ b/packages/taler-wallet-webextension/src/components/Diagnostics.tsx @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Translate, WalletDiagnostics } from "@gnu-taler/taler-util"; +import { i18n, WalletDiagnostics } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { PageLink } from "../renderHtml"; @@ -27,9 +27,9 @@ export function Diagnostics({ timedOut, diagnostics }: Props): VNode { if (timedOut) { return ( <p> - <Translate> + <i18n.Translate> Diagnostics timed out. Could not talk to the wallet backend. - </Translate> + </i18n.Translate> </p> ); } @@ -48,7 +48,7 @@ export function Diagnostics({ timedOut, diagnostics }: Props): VNode { }} > <p> - <Translate>Problems detected:</Translate> + <i18n.Translate>Problems detected:</i18n.Translate> </p> <ol> {diagnostics.errors.map((errMsg) => ( @@ -57,23 +57,23 @@ export function Diagnostics({ timedOut, diagnostics }: Props): VNode { </ol> {diagnostics.firefoxIdbProblem ? ( <p> - <Translate> + <i18n.Translate> Please check in your <code>about:config</code> settings that you have IndexedDB enabled (check the preference name{" "} <code>dom.indexedDB.enabled</code>). - </Translate> + </i18n.Translate> </p> ) : null} {diagnostics.dbOutdated ? ( <p> - <Translate> + <i18n.Translate> Your wallet database is outdated. Currently automatic migration is not supported. Please go{" "} <PageLink pageName="/reset-required"> - <Translate>here</Translate> + <i18n.Translate>here</i18n.Translate> </PageLink>{" "} to reset the wallet database. - </Translate> + </i18n.Translate> </p> ) : null} </div> @@ -82,7 +82,7 @@ export function Diagnostics({ timedOut, diagnostics }: Props): VNode { return ( <p> - <Translate>Running diagnostics</Translate> ... + <i18n.Translate>Running diagnostics</i18n.Translate> ... </p> ); } diff --git a/packages/taler-wallet-webextension/src/components/EditableText.tsx b/packages/taler-wallet-webextension/src/components/EditableText.tsx index c5d6e397e..8d45cae90 100644 --- a/packages/taler-wallet-webextension/src/components/EditableText.tsx +++ b/packages/taler-wallet-webextension/src/components/EditableText.tsx @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Translate } from "@gnu-taler/taler-util"; +import { i18n } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import { useRef, useState } from "preact/hooks"; @@ -41,7 +41,7 @@ export function EditableText({ <div style={{ display: "flex", justifyContent: "space-between" }}> <p>{value}</p> <button onClick={() => setEditing(true)}> - <Translate>Edit</Translate> + <i18n.Translate>Edit</i18n.Translate> </button> </div> ); @@ -57,7 +57,7 @@ export function EditableText({ onChange(ref.current.value).then(() => setEditing(false)); }} > - <Translate>Confirm</Translate> + <i18n.Translate>Confirm</i18n.Translate> </button> </div> ); diff --git a/packages/taler-wallet-webextension/src/components/Loading.tsx b/packages/taler-wallet-webextension/src/components/Loading.tsx index ff6d21376..7504034a0 100644 --- a/packages/taler-wallet-webextension/src/components/Loading.tsx +++ b/packages/taler-wallet-webextension/src/components/Loading.tsx @@ -13,13 +13,13 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Translate } from "@gnu-taler/taler-util"; +import { i18n } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; export function Loading(): VNode { return ( <div> - <Translate>Loading</Translate>... + <i18n.Translate>Loading</i18n.Translate>... </div> ); } diff --git a/packages/taler-wallet-webextension/src/components/SelectList.tsx b/packages/taler-wallet-webextension/src/components/SelectList.tsx index a5f182d77..676fd672f 100644 --- a/packages/taler-wallet-webextension/src/components/SelectList.tsx +++ b/packages/taler-wallet-webextension/src/components/SelectList.tsx @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Translate } from "@gnu-taler/taler-util"; +import { i18n } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { NiceSelect } from "./styled"; @@ -59,7 +59,7 @@ export function SelectList({ {value === undefined || (canBeNull && ( <option selected disabled> - <Translate>Select one option</Translate> + <i18n.Translate>Select one option</i18n.Translate> </option> // ) : ( // <option selected>{list[value]}</option> diff --git a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx index 5c8897006..abcca9c26 100644 --- a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx +++ b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx @@ -21,7 +21,7 @@ import { Timestamp, Transaction, TransactionType, - Translate, + i18n, } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import imageBank from "../../static/img/ri-bank-line.svg"; @@ -134,7 +134,7 @@ function TransactionLayout(props: TransactionLayoutProps): VNode { </LargeText> {props.pending && ( <LightText style={{ marginTop: 5, marginBottom: 5 }}> - <Translate>Waiting for confirmation</Translate> + <i18n.Translate>Waiting for confirmation</i18n.Translate> </LightText> )} <SmallLightText style={{ marginTop: 5 }}> @@ -198,7 +198,7 @@ function TransactionAmount(props: TransactionAmountProps): VNode { </ExtraLargeText> {props.pending && ( <div> - <Translate>PENDING</Translate> + <i18n.Translate>PENDING</i18n.Translate> </div> )} </Column> diff --git a/packages/taler-wallet-webextension/src/cta/Deposit.tsx b/packages/taler-wallet-webextension/src/cta/Deposit.tsx index 5adc641f4..82d898d77 100644 --- a/packages/taler-wallet-webextension/src/cta/Deposit.tsx +++ b/packages/taler-wallet-webextension/src/cta/Deposit.tsx @@ -111,7 +111,7 @@ export function DepositPage({ talerPayUri, goBack }: Props): VNode { if (!talerPayUri) { return ( <span> - <Translate>missing pay uri</Translate> + <i18n.Translate>missing pay uri</i18n.Translate> </span> ); } @@ -122,14 +122,14 @@ export function DepositPage({ talerPayUri, goBack }: Props): VNode { <WalletAction> <LogoHeader /> <h2> - <Translate>Digital cash payment</Translate> + <i18n.Translate>Digital cash payment</i18n.Translate> </h2> <section> <ErrorTalerOperation title={ - <Translate> + <i18n.Translate> Could not get the payment information for this order - </Translate> + </i18n.Translate> } error={payErrMsg?.operationError} /> @@ -142,13 +142,13 @@ export function DepositPage({ talerPayUri, goBack }: Props): VNode { <WalletAction> <LogoHeader /> <h2> - <Translate>Digital cash payment</Translate> + <i18n.Translate>Digital cash payment</i18n.Translate> </h2> <section> <p> - <Translate> + <i18n.Translate> Could not get the payment information for this order - </Translate> + </i18n.Translate> </p> <ErrorBox>{payErrMsg}</ErrorBox> </section> @@ -157,7 +157,7 @@ export function DepositPage({ talerPayUri, goBack }: Props): VNode { } return ( <span> - <Translate>Loading payment information</Translate> ... + <i18n.Translate>Loading payment information</i18n.Translate> ... </span> ); } @@ -205,28 +205,28 @@ export function PaymentRequestView({ <LogoHeader /> <h2> - <Translate>Digital cash deposit</Translate> + <i18n.Translate>Digital cash deposit</i18n.Translate> </h2> {payStatus.status === PreparePayResultType.AlreadyConfirmed && (payStatus.paid ? ( <SuccessBox> - <Translate>Already paid</Translate> + <i18n.Translate>Already paid</i18n.Translate> </SuccessBox> ) : ( <WarningBox> - <Translate>Already claimed</Translate> + <i18n.Translate>Already claimed</i18n.Translate> </WarningBox> ))} {payResult && payResult.type === ConfirmPayResultType.Done && ( <SuccessBox> <h3> - <Translate>Payment complete</Translate> + <i18n.Translate>Payment complete</i18n.Translate> </h3> <p> {!payResult.contractTerms.fulfillment_message ? ( - <Translate> + <i18n.Translate> You will now be sent back to the merchant you came from. - </Translate> + </i18n.Translate> ) : ( payResult.contractTerms.fulfillment_message )} @@ -238,7 +238,7 @@ export function PaymentRequestView({ Amounts.isNonZero(totalFees) && ( <Part big - title={<Translate>Total to pay</Translate>} + title={<i18n.Translate>Total to pay</i18n.Translate>} text={amountToPretty( Amounts.parseOrThrow(payStatus.amountEffective), )} @@ -247,7 +247,7 @@ export function PaymentRequestView({ )} <Part big - title={<Translate>Purchase amount</Translate>} + title={<i18n.Translate>Purchase amount</i18n.Translate>} text={amountToPretty(Amounts.parseOrThrow(payStatus.amountRaw))} kind="neutral" /> @@ -255,25 +255,25 @@ export function PaymentRequestView({ <Fragment> <Part big - title={<Translate>Fee</Translate>} + title={<i18n.Translate>Fee</i18n.Translate>} text={amountToPretty(totalFees)} kind="negative" /> </Fragment> )} <Part - title={<Translate>Merchant</Translate>} + title={<i18n.Translate>Merchant</i18n.Translate>} text={contractTerms.merchant.name} kind="neutral" /> <Part - title={<Translate>Purchase</Translate>} + title={<i18n.Translate>Purchase</i18n.Translate>} text={contractTerms.summary} kind="neutral" /> {contractTerms.order_id && ( <Part - title={<Translate>Receipt</Translate>} + title={<i18n.Translate>Receipt</i18n.Translate>} text={`#${contractTerms.order_id}`} kind="neutral" /> diff --git a/packages/taler-wallet-webextension/src/cta/Pay.tsx b/packages/taler-wallet-webextension/src/cta/Pay.tsx index 7ed0d072f..4fe44dcff 100644 --- a/packages/taler-wallet-webextension/src/cta/Pay.tsx +++ b/packages/taler-wallet-webextension/src/cta/Pay.tsx @@ -110,7 +110,7 @@ export function PayPage({ if (hook.hasError) { return ( <LoadingError - title={<Translate>Could not load pay status</Translate>} + title={<i18n.Translate>Could not load pay status</i18n.Translate>} error={hook} /> ); @@ -187,9 +187,9 @@ export function PaymentRequestView({ return ( <ErrorMessage title={ - <Translate> + <i18n.Translate> Could not load contract terms from merchant or wallet backend. - </Translate> + </i18n.Translate> } /> ); @@ -214,20 +214,20 @@ export function PaymentRequestView({ <section> <LinkSuccess upperCased onClick={() => setShowQR((qr) => !qr)}> {!showQR ? ( - <Translate>Pay with a mobile phone</Translate> + <i18n.Translate>Pay with a mobile phone</i18n.Translate> ) : ( - <Translate>Hide QR</Translate> + <i18n.Translate>Hide QR</i18n.Translate> )} </LinkSuccess> {showQR && ( <div> <QR text={privateUri} /> - <Translate> + <i18n.Translate> Scan the QR code or <a href={privateUri}> - <Translate>click here</Translate> + <i18n.Translate>click here</i18n.Translate> </a> - </Translate> + </i18n.Translate> </div> )} </section> @@ -241,7 +241,7 @@ export function PaymentRequestView({ <section> <div> <p> - <Translate>Processing</Translate>... + <i18n.Translate>Processing</i18n.Translate>... </p> </div> </section> @@ -254,9 +254,9 @@ export function PaymentRequestView({ <Fragment> <section> <ButtonSuccess upperCased onClick={onClick}> - <Translate> + <i18n.Translate> Pay {amountToString(payStatus.amountEffective)} - </Translate> + </i18n.Translate> </ButtonSuccess> </section> <Alternative /> @@ -269,22 +269,22 @@ export function PaymentRequestView({ <section> {balance ? ( <WarningBox> - <Translate> + <i18n.Translate> Your balance of {amountToString(balance)} is not enough to pay for this purchase - </Translate> + </i18n.Translate> </WarningBox> ) : ( <WarningBox> - <Translate> + <i18n.Translate> Your balance is not enough to pay for this purchase. - </Translate> + </i18n.Translate> </WarningBox> )} </section> <section> <ButtonSuccess upperCased onClick={goToWalletManualWithdraw}> - <Translate>Withdraw digital cash</Translate> + <i18n.Translate>Withdraw digital cash</i18n.Translate> </ButtonSuccess> </section> <Alternative /> @@ -297,7 +297,7 @@ export function PaymentRequestView({ <section> {payStatus.paid && contractTerms.fulfillment_message && ( <Part - title={<Translate>Merchant message</Translate>} + title={<i18n.Translate>Merchant message</i18n.Translate>} text={contractTerms.fulfillment_message} kind="neutral" /> @@ -315,43 +315,43 @@ export function PaymentRequestView({ <LogoHeader /> <h2> - <Translate>Digital cash payment</Translate> + <i18n.Translate>Digital cash payment</i18n.Translate> </h2> {payStatus.status === PreparePayResultType.AlreadyConfirmed && (payStatus.paid ? ( payStatus.contractTerms.fulfillment_url ? ( <SuccessBox> - <Translate> + <i18n.Translate> Already paid, you are going to be redirected to{" "} <a href={payStatus.contractTerms.fulfillment_url}> {payStatus.contractTerms.fulfillment_url} </a> - </Translate> + </i18n.Translate> </SuccessBox> ) : ( <SuccessBox> - <Translate>Already paid</Translate> + <i18n.Translate>Already paid</i18n.Translate> </SuccessBox> ) ) : ( <WarningBox> - <Translate>Already claimed</Translate> + <i18n.Translate>Already claimed</i18n.Translate> </WarningBox> ))} {payResult && payResult.type === ConfirmPayResultType.Done && ( <SuccessBox> <h3> - <Translate>Payment complete</Translate> + <i18n.Translate>Payment complete</i18n.Translate> </h3> <p> {!payResult.contractTerms.fulfillment_message ? ( payResult.contractTerms.fulfillment_url ? ( - <Translate> + <i18n.Translate> You are going to be redirected to $ {payResult.contractTerms.fulfillment_url} - </Translate> + </i18n.Translate> ) : ( - <Translate>You can close this page.</Translate> + <i18n.Translate>You can close this page.</i18n.Translate> ) ) : ( payResult.contractTerms.fulfillment_message @@ -364,14 +364,14 @@ export function PaymentRequestView({ Amounts.isNonZero(totalFees) && ( <Part big - title={<Translate>Total to pay</Translate>} + title={<i18n.Translate>Total to pay</i18n.Translate>} text={amountToString(payStatus.amountEffective)} kind="negative" /> )} <Part big - title={<Translate>Purchase amount</Translate>} + title={<i18n.Translate>Purchase amount</i18n.Translate>} text={amountToString(payStatus.amountRaw)} kind="neutral" /> @@ -379,25 +379,25 @@ export function PaymentRequestView({ <Fragment> <Part big - title={<Translate>Fee</Translate>} + title={<i18n.Translate>Fee</i18n.Translate>} text={amountToString(totalFees)} kind="negative" /> </Fragment> )} <Part - title={<Translate>Merchant</Translate>} + title={<i18n.Translate>Merchant</i18n.Translate>} text={contractTerms.merchant.name} kind="neutral" /> <Part - title={<Translate>Purchase</Translate>} + title={<i18n.Translate>Purchase</i18n.Translate>} text={contractTerms.summary} kind="neutral" /> {contractTerms.order_id && ( <Part - title={<Translate>Receipt</Translate>} + title={<i18n.Translate>Receipt</i18n.Translate>} text={`#${contractTerms.order_id}`} kind="neutral" /> @@ -415,7 +415,7 @@ function ProductList({ products }: { products: Product[] }): VNode { return ( <Fragment> <SmallLightText style={{ margin: ".5em" }}> - <Translate>List of products</Translate> + <i18n.Translate>List of products</i18n.Translate> </SmallLightText> <dl> {products.map((p, i) => { @@ -457,7 +457,7 @@ function ProductList({ products }: { products: Product[] }): VNode { {p.quantity ?? 1} x {p.description} </dt> <dd> - <Translate>Total</Translate> + <i18n.Translate>Total</i18n.Translate> {` `} {p.price ? ( `${Amounts.stringifyValue( @@ -467,7 +467,7 @@ function ProductList({ products }: { products: Product[] }): VNode { ).amount, )} ${p}` ) : ( - <Translate>free</Translate> + <i18n.Translate>free</i18n.Translate> )} </dd> </div> diff --git a/packages/taler-wallet-webextension/src/cta/Refund.tsx b/packages/taler-wallet-webextension/src/cta/Refund.tsx index ec32cc37a..8ce008bcd 100644 --- a/packages/taler-wallet-webextension/src/cta/Refund.tsx +++ b/packages/taler-wallet-webextension/src/cta/Refund.tsx @@ -20,7 +20,7 @@ * @author sebasjm */ -import { Amounts, ApplyRefundResponse, Translate } from "@gnu-taler/taler-util"; +import { Amounts, ApplyRefundResponse, i18n } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; import { AmountView } from "../renderHtml"; @@ -38,27 +38,29 @@ export function View({ applyResult }: ViewProps): VNode { <h1>GNU Taler Wallet</h1> <article class="fade"> <h2> - <Translate>Refund Status</Translate> + <i18n.Translate>Refund Status</i18n.Translate> </h2> <p> - <Translate> + <i18n.Translate> The product <em>{applyResult.info.summary}</em> has received a total effective refund of{" "} - </Translate> + </i18n.Translate> <AmountView amount={applyResult.amountRefundGranted} />. </p> {applyResult.pendingAtExchange ? ( <p> - <Translate>Refund processing is still in progress.</Translate> + <i18n.Translate> + Refund processing is still in progress. + </i18n.Translate> </p> ) : null} {!Amounts.isZero(applyResult.amountRefundGone) ? ( <p> - <Translate> + <i18n.Translate> The refund amount of{" "} <AmountView amount={applyResult.amountRefundGone} /> could not be applied. - </Translate> + </i18n.Translate> </p> ) : null} </article> @@ -92,7 +94,7 @@ export function RefundPage({ talerRefundUri }: Props): VNode { if (!talerRefundUri) { return ( <span> - <Translate>missing taler refund uri</Translate> + <i18n.Translate>missing taler refund uri</i18n.Translate> </span> ); } @@ -100,7 +102,7 @@ export function RefundPage({ talerRefundUri }: Props): VNode { if (errMsg) { return ( <span> - <Translate>Error: {errMsg}</Translate> + <i18n.Translate>Error: {errMsg}</i18n.Translate> </span> ); } @@ -108,7 +110,7 @@ export function RefundPage({ talerRefundUri }: Props): VNode { if (!applyResult) { return ( <span> - <Translate>Updating refund status</Translate> + <i18n.Translate>Updating refund status</i18n.Translate> </span> ); } diff --git a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx index 00f7bd211..1244b7915 100644 --- a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx +++ b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx @@ -34,7 +34,9 @@ export function TermsOfServiceSection({ {terms.status === "notfound" && ( <section> <WarningText> - <Translate>Exchange doesn't have terms of service</Translate> + <i18n.Translate> + Exchange doesn't have terms of service + </i18n.Translate> </WarningText> </section> )} @@ -46,21 +48,27 @@ export function TermsOfServiceSection({ {terms.status === "notfound" && ( <section> <WarningText> - <Translate>Exchange doesn't have terms of service</Translate> + <i18n.Translate> + Exchange doesn't have terms of service + </i18n.Translate> </WarningText> </section> )} {terms.status === "new" && ( <section> <ButtonSuccess upperCased onClick={() => onReview(true)}> - <Translate>Review exchange terms of service</Translate> + <i18n.Translate> + Review exchange terms of service + </i18n.Translate> </ButtonSuccess> </section> )} {terms.status === "changed" && ( <section> <ButtonWarning upperCased onClick={() => onReview(true)}> - <Translate>Review new version of terms of service</Translate> + <i18n.Translate> + Review new version of terms of service + </i18n.Translate> </ButtonWarning> </section> )} @@ -72,7 +80,7 @@ export function TermsOfServiceSection({ {onReview && ( <section> <LinkSuccess upperCased onClick={() => onReview(true)}> - <Translate>Show terms of service</Translate> + <i18n.Translate>Show terms of service</i18n.Translate> </LinkSuccess> </section> )} @@ -81,7 +89,9 @@ export function TermsOfServiceSection({ name="terms" enabled={reviewed} label={ - <Translate>I accept the exchange terms of service</Translate> + <i18n.Translate> + I accept the exchange terms of service + </i18n.Translate> } onToggle={() => { onAccept(!reviewed); @@ -97,9 +107,9 @@ export function TermsOfServiceSection({ {terms.status !== "notfound" && !terms.content && ( <section> <WarningBox> - <Translate> + <i18n.Translate> The exchange reply with a empty terms of service - </Translate> + </i18n.Translate> </WarningBox> </section> )} @@ -120,7 +130,7 @@ export function TermsOfServiceSection({ )} {terms.content.type === "pdf" && ( <a href={terms.content.location.toString()} download="tos.pdf"> - <Translate>Download Terms of Service</Translate> + <i18n.Translate>Download Terms of Service</i18n.Translate> </a> )} </section> @@ -128,7 +138,7 @@ export function TermsOfServiceSection({ {reviewed && onReview && ( <section> <LinkSuccess upperCased onClick={() => onReview(false)}> - <Translate>Hide terms of service</Translate> + <i18n.Translate>Hide terms of service</i18n.Translate> </LinkSuccess> </section> )} @@ -138,7 +148,9 @@ export function TermsOfServiceSection({ name="terms" enabled={reviewed} label={ - <Translate>I accept the exchange terms of service</Translate> + <i18n.Translate> + I accept the exchange terms of service + </i18n.Translate> } onToggle={() => { onAccept(!reviewed); diff --git a/packages/taler-wallet-webextension/src/cta/Tip.tsx b/packages/taler-wallet-webextension/src/cta/Tip.tsx index 9bb03b7ac..ff86ce8c7 100644 --- a/packages/taler-wallet-webextension/src/cta/Tip.tsx +++ b/packages/taler-wallet-webextension/src/cta/Tip.tsx @@ -20,7 +20,7 @@ * @author sebasjm <dold@taler.net> */ -import { PrepareTipResult, Translate } from "@gnu-taler/taler-util"; +import { PrepareTipResult, i18n } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; import { Loading } from "../components/Loading"; @@ -46,28 +46,28 @@ export function View({ <article class="fade"> {prepareTipResult.accepted ? ( <span> - <Translate> + <i18n.Translate> Tip from <code>{prepareTipResult.merchantBaseUrl}</code> accepted. Check your transactions list for more details. - </Translate> + </i18n.Translate> </span> ) : ( <div> <p> - <Translate> + <i18n.Translate> The merchant <code>{prepareTipResult.merchantBaseUrl}</code> is offering you a tip of{" "} <strong> <AmountView amount={prepareTipResult.tipAmountEffective} /> </strong>{" "} via the exchange <code>{prepareTipResult.exchangeBaseUrl}</code> - </Translate> + </i18n.Translate> </p> <button onClick={onAccept}> - <Translate>Accept tip</Translate> + <i18n.Translate>Accept tip</i18n.Translate> </button> <button onClick={onIgnore}> - <Translate>Ignore</Translate> + <i18n.Translate>Ignore</i18n.Translate> </button> </div> )} @@ -108,7 +108,7 @@ export function TipPage({ talerTipUri }: Props): VNode { if (!talerTipUri) { return ( <span> - <Translate>missing tip uri</Translate> + <i18n.Translate>missing tip uri</i18n.Translate> </span> ); } @@ -116,7 +116,7 @@ export function TipPage({ talerTipUri }: Props): VNode { if (tipIgnored) { return ( <span> - <Translate>You've ignored the tip.</Translate> + <i18n.Translate>You've ignored the tip.</i18n.Translate> </span> ); } diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx index 7d36a6084..7c9745ddc 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx +++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx @@ -119,13 +119,15 @@ export function View({ <WalletAction> <LogoHeader /> <h2> - <Translate>Digital cash withdrawal</Translate> + <i18n.Translate>Digital cash withdrawal</i18n.Translate> </h2> {withdrawError && ( <ErrorTalerOperation title={ - <Translate>Could not finish the withdrawal operation</Translate> + <i18n.Translate> + Could not finish the withdrawal operation + </i18n.Translate> } error={withdrawError.operationError} /> @@ -133,19 +135,19 @@ export function View({ <section> <Part - title={<Translate>Total to withdraw</Translate>} + title={<i18n.Translate>Total to withdraw</i18n.Translate>} text={amountToString(Amounts.sub(amount, withdrawalFee).amount)} kind="positive" /> {Amounts.isNonZero(withdrawalFee) && ( <Fragment> <Part - title={<Translate>Chosen amount</Translate>} + title={<i18n.Translate>Chosen amount</i18n.Translate>} text={amountToString(amount)} kind="neutral" /> <Part - title={<Translate>Exchange fee</Translate>} + title={<i18n.Translate>Exchange fee</i18n.Translate>} text={amountToString(withdrawalFee)} kind="negative" /> @@ -153,7 +155,7 @@ export function View({ )} {exchangeBaseUrl && ( <Part - title={<Translate>Exchange</Translate>} + title={<i18n.Translate>Exchange</i18n.Translate>} text={exchangeBaseUrl} kind="neutral" big @@ -166,7 +168,7 @@ export function View({ <Fragment> <div> <SelectList - label={<Translate>Known exchanges</Translate>} + label={<i18n.Translate>Known exchanges</i18n.Translate>} list={exchanges} value={nextExchange} name="switchingExchange" @@ -183,15 +185,15 @@ export function View({ }} > {nextExchange === undefined ? ( - <Translate>Cancel exchange selection</Translate> + <i18n.Translate>Cancel exchange selection</i18n.Translate> ) : ( - <Translate>Confirm exchange selection</Translate> + <i18n.Translate>Confirm exchange selection</i18n.Translate> )} </LinkSuccess> </Fragment> ) : ( <LinkSuccess upperCased onClick={() => setSwitchingExchange(true)}> - <Translate>Switch exchange</Translate> + <i18n.Translate>Switch exchange</i18n.Translate> </LinkSuccess> )} </section> @@ -210,7 +212,7 @@ export function View({ disabled={!exchangeBaseUrl || confirmDisabled} onClick={doWithdrawAndCheckError} > - <Translate>Confirm withdrawal</Translate> + <i18n.Translate>Confirm withdrawal</i18n.Translate> </ButtonSuccess> )} {terms.status === "notfound" && ( @@ -219,7 +221,7 @@ export function View({ disabled={!exchangeBaseUrl} onClick={doWithdrawAndCheckError} > - <Translate>Withdraw anyway</Translate> + <i18n.Translate>Withdraw anyway</i18n.Translate> </ButtonWarning> )} </section> @@ -282,7 +284,9 @@ export function WithdrawPageWithParsedURI({ if (detailsHook.hasError) { return ( <LoadingError - title={<Translate>Could not load the withdrawal details</Translate>} + title={ + <i18n.Translate>Could not load the withdrawal details</i18n.Translate> + } error={detailsHook} /> ); @@ -337,7 +341,7 @@ export function WithdrawPage({ talerWithdrawUri }: Props): VNode { if (!talerWithdrawUri) { return ( <span> - <Translate>missing withdraw uri</Translate> + <i18n.Translate>missing withdraw uri</i18n.Translate> </span> ); } @@ -347,7 +351,9 @@ export function WithdrawPage({ talerWithdrawUri }: Props): VNode { if (uriInfoHook.hasError) { return ( <LoadingError - title={<Translate>Could not get the info from the URI</Translate>} + title={ + <i18n.Translate>Could not get the info from the URI</i18n.Translate> + } error={uriInfoHook} /> ); diff --git a/packages/taler-wallet-webextension/src/cta/reset-required.tsx b/packages/taler-wallet-webextension/src/cta/reset-required.tsx index e8c5a0dff..350c32d76 100644 --- a/packages/taler-wallet-webextension/src/cta/reset-required.tsx +++ b/packages/taler-wallet-webextension/src/cta/reset-required.tsx @@ -20,7 +20,7 @@ * @author sebasjm */ -import { Translate } from "@gnu-taler/taler-util"; +import { i18n } from "@gnu-taler/taler-util"; import { Component, h, VNode } from "preact"; import * as wxApi from "../wxApi"; @@ -51,19 +51,19 @@ class ResetNotification extends Component<any, State> { return ( <div> <h1> - <Translate>Manual Reset Required</Translate> + <i18n.Translate>Manual Reset Required</i18n.Translate> </h1> <p> - <Translate> + <i18n.Translate> The wallet's database in your browser is incompatible with the currently installed wallet. Please reset manually. - </Translate> + </i18n.Translate> </p> <p> - <Translate> + <i18n.Translate> Once the database format has stabilized, we will provide automatic upgrades. - </Translate> + </i18n.Translate> </p> <input id="check" @@ -74,7 +74,9 @@ class ResetNotification extends Component<any, State> { }} />{" "} <label htmlFor="check"> - <Translate>I understand that I will lose all my data</Translate> + <i18n.Translate> + I understand that I will lose all my data + </i18n.Translate> </label> <br /> <button @@ -82,7 +84,7 @@ class ResetNotification extends Component<any, State> { disabled={!this.state.checked} onClick={() => wxApi.resetDb()} > - <Translate>Reset</Translate> + <i18n.Translate>Reset</i18n.Translate> </button> </div> ); @@ -90,12 +92,12 @@ class ResetNotification extends Component<any, State> { return ( <div> <h1> - <Translate>Everything is fine!</Translate> + <i18n.Translate>Everything is fine!</i18n.Translate> </h1> <p> - <Translate> + <i18n.Translate> A reset is not required anymore, you can close this page. - </Translate> + </i18n.Translate> </p> </div> ); diff --git a/packages/taler-wallet-webextension/src/cta/return-coins.tsx b/packages/taler-wallet-webextension/src/cta/return-coins.tsx index 22b373899..1d688fa06 100644 --- a/packages/taler-wallet-webextension/src/cta/return-coins.tsx +++ b/packages/taler-wallet-webextension/src/cta/return-coins.tsx @@ -14,7 +14,7 @@ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Translate } from "@gnu-taler/taler-util"; +import { i18n } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; /** * Return coins to own bank account. @@ -28,7 +28,7 @@ import { h, VNode } from "preact"; export function createReturnCoinsPage(): VNode { return ( <span> - <Translate>Not implemented yet.</Translate> + <i18n.Translate>Not implemented yet.</i18n.Translate> </span> ); } diff --git a/packages/taler-wallet-webextension/src/i18n/strings.ts b/packages/taler-wallet-webextension/src/i18n/strings.ts index 1e02a1b9e..5593f529a 100644 --- a/packages/taler-wallet-webextension/src/i18n/strings.ts +++ b/packages/taler-wallet-webextension/src/i18n/strings.ts @@ -1,3 +1,5 @@ +export const strings: any = {} + strings['de'] = { "domain": "messages", "locale_data": { diff --git a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx index f81929b21..46fe027c9 100644 --- a/packages/taler-wallet-webextension/src/popup/BalancePage.tsx +++ b/packages/taler-wallet-webextension/src/popup/BalancePage.tsx @@ -14,7 +14,7 @@ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Amounts, Balance, Translate } from "@gnu-taler/taler-util"; +import { Amounts, Balance, i18n } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { useState } from "preact/hooks"; import { BalanceTable } from "../components/BalanceTable"; @@ -49,7 +49,7 @@ export function BalancePage({ if (state.hasError) { return ( <LoadingError - title={<Translate>Could not load balance page</Translate>} + title={<i18n.Translate>Could not load balance page</i18n.Translate>} error={state} /> ); @@ -104,18 +104,18 @@ export function BalanceView({ </section> <footer style={{ justifyContent: "space-between" }}> <ButtonPrimary onClick={goToWalletManualWithdraw}> - <Translate>Withdraw</Translate> + <i18n.Translate>Withdraw</i18n.Translate> </ButtonPrimary> {currencyWithNonZeroAmount.length > 0 && ( <MultiActionButton - label={(s) => <Translate>Deposit {s}</Translate>} + label={(s) => <i18n.Translate>Deposit {s}</i18n.Translate>} actions={currencyWithNonZeroAmount} onClick={(c) => goToWalletDeposit(c)} /> )} <JustInDevMode> <ButtonBoxPrimary onClick={goToAddAction}> - <Translate>Enter URI</Translate> + <i18n.Translate>Enter URI</i18n.Translate> </ButtonBoxPrimary> </JustInDevMode> </footer> diff --git a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx index b3da48a93..228c3cdfd 100644 --- a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx +++ b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx @@ -151,14 +151,14 @@ export function View({ return ( <div> <p> - <Translate>Debug tools</Translate>: + <i18n.Translate>Debug tools</i18n.Translate>: </p> <button onClick={confirmReset}> - <Translate>reset</Translate> + <i18n.Translate>reset</i18n.Translate> </button> <br /> <button onClick={() => fileRef?.current?.click()}> - <Translate>import database</Translate> + <i18n.Translate>import database</i18n.Translate> </button> <input ref={fileRef} @@ -179,11 +179,11 @@ export function View({ /> <br /> <button onClick={onExportDatabase}> - <Translate>export database</Translate> + <i18n.Translate>export database</i18n.Translate> </button> {downloadedDatabase && ( <div> - <Translate> + <i18n.Translate> Database exported at <Time timestamp={{ t_ms: downloadedDatabase.time.getTime() }} @@ -198,15 +198,15 @@ export function View({ "yyyy/MM/dd_HH:mm", )}.json`} > - <Translate>click here</Translate> + <i18n.Translate>click here</i18n.Translate> </a> to download - </Translate> + </i18n.Translate> </div> )} <br /> <p> - <Translate>Coins</Translate>: + <i18n.Translate>Coins</i18n.Translate>: </p> {Object.keys(money_by_exchange).map((ex) => { const allcoins = money_by_exchange[ex]; @@ -233,7 +233,7 @@ export function View({ {operations && operations.length > 0 && ( <Fragment> <p> - <Translate>Pending operations</Translate> + <i18n.Translate>Pending operations</i18n.Translate> </p> <dl> {operations.reverse().map((o) => { @@ -272,7 +272,7 @@ function ShowAllCoins({ </p> <p> <b> - <Translate>usable coins</Translate> + <i18n.Translate>usable coins</i18n.Translate> </b> </p> {collapsedUnspent ? ( @@ -281,19 +281,19 @@ function ShowAllCoins({ <table onClick={() => setCollapsedUnspent(true)}> <tr> <td> - <Translate>id</Translate> + <i18n.Translate>id</i18n.Translate> </td> <td> - <Translate>denom</Translate> + <i18n.Translate>denom</i18n.Translate> </td> <td> - <Translate>value</Translate> + <i18n.Translate>value</i18n.Translate> </td> <td> - <Translate>status</Translate> + <i18n.Translate>status</i18n.Translate> </td> <td> - <Translate>from refresh?</Translate> + <i18n.Translate>from refresh?</i18n.Translate> </td> </tr> {coins.usable.map((c) => { @@ -310,29 +310,29 @@ function ShowAllCoins({ </table> )} <p> - <Translate>spent coins</Translate> + <i18n.Translate>spent coins</i18n.Translate> </p> {collapsedSpent ? ( <div onClick={() => setCollapsedSpent(false)}> - <Translate>click to show</Translate> + <i18n.Translate>click to show</i18n.Translate> </div> ) : ( <table onClick={() => setCollapsedSpent(true)}> <tr> <td> - <Translate>id</Translate> + <i18n.Translate>id</i18n.Translate> </td> <td> - <Translate>denom</Translate> + <i18n.Translate>denom</i18n.Translate> </td> <td> - <Translate>value</Translate> + <i18n.Translate>value</i18n.Translate> </td> <td> - <Translate>status</Translate> + <i18n.Translate>status</i18n.Translate> </td> <td> - <Translate>from refresh?</Translate> + <i18n.Translate>from refresh?</i18n.Translate> </td> </tr> {coins.spent.map((c) => { diff --git a/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx b/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx index 6e2bf1e63..b8b21b24c 100644 --- a/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx +++ b/packages/taler-wallet-webextension/src/popup/NoBalanceHelp.tsx @@ -1,4 +1,4 @@ -import { Translate } from "@gnu-taler/taler-util"; +import { i18n } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import { ButtonBoxWarning, WarningBox } from "../components/styled"; @@ -11,16 +11,16 @@ export function NoBalanceHelp({ <WarningBox> <p> <b> - <Translate>You have no balance to show.</Translate> + <i18n.Translate>You have no balance to show.</i18n.Translate> </b> <br /> - <Translate> + <i18n.Translate> To withdraw money you can start from your bank site or click the "withdraw" button to use a known exchange. - </Translate> + </i18n.Translate> </p> <ButtonBoxWarning onClick={() => goToWalletManualWithdraw()}> - <Translate>Withdraw</Translate> + <i18n.Translate>Withdraw</i18n.Translate> </ButtonBoxWarning> </WarningBox> ); diff --git a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx index a69352c9f..6410ae40e 100644 --- a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx +++ b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx @@ -19,11 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { - classifyTalerUri, - TalerUriType, - Translate, -} from "@gnu-taler/taler-util"; +import { classifyTalerUri, TalerUriType, i18n } from "@gnu-taler/taler-util"; import { Fragment, h } from "preact"; import { ButtonPrimary, ButtonSuccess } from "../components/styled"; import { actionForTalerUri } from "../utils/index"; @@ -57,54 +53,58 @@ export function TalerActionFound({ url, onDismiss }: Props) { <Fragment> <section> <h1> - <Translate>Taler Action</Translate> + <i18n.Translate>Taler Action</i18n.Translate> </h1> {uriType === TalerUriType.TalerPay && ( <div> <p> - <Translate>This page has pay action.</Translate> + <i18n.Translate>This page has pay action.</i18n.Translate> </p> <ButtonSuccess onClick={() => { navigateTo(actionForTalerUri(uriType, url)); }} > - <Translate>Open pay page</Translate> + <i18n.Translate>Open pay page</i18n.Translate> </ButtonSuccess> </div> )} {uriType === TalerUriType.TalerWithdraw && ( <div> <p> - <Translate>This page has a withdrawal action.</Translate> + <i18n.Translate> + This page has a withdrawal action. + </i18n.Translate> </p> <ButtonSuccess onClick={() => { navigateTo(actionForTalerUri(uriType, url)); }} > - <Translate>Open withdraw page</Translate> + <i18n.Translate>Open withdraw page</i18n.Translate> </ButtonSuccess> </div> )} {uriType === TalerUriType.TalerTip && ( <div> <p> - <Translate>This page has a tip action.</Translate> + <i18n.Translate>This page has a tip action.</i18n.Translate> </p> <ButtonSuccess onClick={() => { navigateTo(actionForTalerUri(uriType, url)); }} > - <Translate>Open tip page</Translate> + <i18n.Translate>Open tip page</i18n.Translate> </ButtonSuccess> </div> )} {uriType === TalerUriType.TalerNotifyReserve && ( <div> <p> - <Translate>This page has a notify reserve action.</Translate> + <i18n.Translate> + This page has a notify reserve action. + </i18n.Translate> </p> <ButtonSuccess onClick={() => { @@ -118,21 +118,23 @@ export function TalerActionFound({ url, onDismiss }: Props) { {uriType === TalerUriType.TalerRefund && ( <div> <p> - <Translate>This page has a refund action.</Translate> + <i18n.Translate>This page has a refund action.</i18n.Translate> </p> <ButtonSuccess onClick={() => { navigateTo(actionForTalerUri(uriType, url)); }} > - <Translate>Open refund page</Translate> + <i18n.Translate>Open refund page</i18n.Translate> </ButtonSuccess> </div> )} {uriType === TalerUriType.Unknown && ( <div> <p> - <Translate>This page has a malformed taler uri.</Translate> + <i18n.Translate> + This page has a malformed taler uri. + </i18n.Translate> </p> <p>{url}</p> </div> @@ -142,7 +144,7 @@ export function TalerActionFound({ url, onDismiss }: Props) { <div /> <ButtonPrimary onClick={() => onDismiss()}> {" "} - <Translate>Dismiss</Translate>{" "} + <i18n.Translate>Dismiss</i18n.Translate>{" "} </ButtonPrimary> </footer> </Fragment> diff --git a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx index 6e270f676..e37ea9ccb 100644 --- a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx +++ b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx @@ -20,7 +20,7 @@ * @author sebasjm <dold@taler.net> */ -import { setupI18n, Translate } from "@gnu-taler/taler-util"; +import { setupI18n, i18n } from "@gnu-taler/taler-util"; import { createHashHistory } from "history"; import { Fragment, h, render, VNode } from "preact"; import Router, { route, Route } from "preact-router"; @@ -181,9 +181,9 @@ function RedirectToWalletPage(): VNode { }); return ( <span> - <Translate> + <i18n.Translate> this popup is being closed and you are being redirected to {page} - </Translate> + </i18n.Translate> </span> ); } diff --git a/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx b/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx index d47803212..229fab7be 100644 --- a/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx +++ b/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx @@ -1,8 +1,4 @@ -import { - classifyTalerUri, - TalerUriType, - Translate, -} from "@gnu-taler/taler-util"; +import { classifyTalerUri, TalerUriType, i18n } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { useState } from "preact/hooks"; import { Button, ButtonSuccess, InputWithLabel } from "../components/styled"; @@ -15,15 +11,15 @@ export interface Props { function buttonLabelByTalerType(type: TalerUriType): VNode { switch (type) { case TalerUriType.TalerNotifyReserve: - return <Translate>Open reserve page</Translate>; + return <i18n.Translate>Open reserve page</i18n.Translate>; case TalerUriType.TalerPay: - return <Translate>Open pay page</Translate>; + return <i18n.Translate>Open pay page</i18n.Translate>; case TalerUriType.TalerRefund: - return <Translate>Open refund page</Translate>; + return <i18n.Translate>Open refund page</i18n.Translate>; case TalerUriType.TalerTip: - return <Translate>Open tip page</Translate>; + return <i18n.Translate>Open tip page</i18n.Translate>; case TalerUriType.TalerWithdraw: - return <Translate>Open withdraw page</Translate>; + return <i18n.Translate>Open withdraw page</i18n.Translate>; } return <Fragment />; } @@ -52,7 +48,7 @@ export function AddNewActionView({ onCancel }: Props): VNode { </section> <footer> <Button onClick={onCancel}> - <Translate>Back</Translate> + <i18n.Translate>Back</i18n.Translate> </Button> {uriType !== TalerUriType.Unknown && ( <ButtonSuccess diff --git a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx index 73fff6e85..a5821d48b 100644 --- a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx @@ -72,7 +72,7 @@ export function BackupPage({ onAddProvider }: Props): VNode { if (status.hasError) { return ( <LoadingError - title={<Translate>Could not load backup providers</Translate>} + title={<i18n.Translate>Could not load backup providers</i18n.Translate>} error={status} /> ); @@ -126,10 +126,10 @@ export function BackupView({ {!providers.length && ( <Centered style={{ marginTop: 100 }}> <BoldLight> - <Translate>No backup providers configured</Translate> + <i18n.Translate>No backup providers configured</i18n.Translate> </BoldLight> <ButtonSuccess onClick={onAddProvider}> - <Translate>Add provider</Translate> + <i18n.Translate>Add provider</i18n.Translate> </ButtonSuccess> </Centered> )} @@ -140,13 +140,13 @@ export function BackupView({ <div> <ButtonPrimary onClick={onSyncAll}> {providers.length > 1 ? ( - <Translate>Sync all backups</Translate> + <i18n.Translate>Sync all backups</i18n.Translate> ) : ( - <Translate>Sync now</Translate> + <i18n.Translate>Sync now</i18n.Translate> )} </ButtonPrimary> <ButtonSuccess onClick={onAddProvider}> - <Translate>Add provider</Translate> + <i18n.Translate>Add provider</i18n.Translate> </ButtonSuccess> </div> </footer> @@ -184,12 +184,12 @@ function BackupLayout(props: TransactionLayoutProps): VNode { {dateStr && ( <SmallText style={{ marginTop: 5 }}> - <Translate>Last synced</Translate>: {dateStr} + <i18n.Translate>Last synced</i18n.Translate>: {dateStr} </SmallText> )} {!dateStr && ( <SmallLightText style={{ marginTop: 5 }}> - <Translate>Not synced</Translate> + <i18n.Translate>Not synced</i18n.Translate> </SmallLightText> )} </div> @@ -208,7 +208,7 @@ function ExpirationText({ until }: { until: Timestamp }): VNode { return ( <Fragment> <CenteredText> - <Translate>Expires in</Translate> + <i18n.Translate>Expires in</i18n.Translate> </CenteredText> <CenteredBoldText {...{ color: colorByTimeToExpire(until) }}> {" "} diff --git a/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx b/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx index b0eddeda5..96644be28 100644 --- a/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx +++ b/packages/taler-wallet-webextension/src/wallet/CreateManualWithdraw.tsx @@ -100,21 +100,21 @@ export function CreateManualWithdraw({ return ( <section> <h2> - <Translate>Manual Withdrawal</Translate> + <i18n.Translate>Manual Withdrawal</i18n.Translate> </h2> <LightText> - <Translate> + <i18n.Translate> Choose a exchange from where the coins will be withdrawn. The exchange will send the coins to this wallet after receiving a wire transfer with the correct subject. - </Translate> + </i18n.Translate> </LightText> <Centered style={{ marginTop: 100 }}> <BoldLight> - <Translate>No exchange configured</Translate> + <i18n.Translate>No exchange configured</i18n.Translate> </BoldLight> <ButtonSuccess onClick={onAddExchange}> - <Translate>Add exchange</Translate> + <i18n.Translate>Add exchange</i18n.Translate> </ButtonSuccess> </Centered> </section> @@ -126,24 +126,24 @@ export function CreateManualWithdraw({ <section> {error && ( <ErrorMessage - title={<Translate>Can't create the reserve</Translate>} + title={<i18n.Translate>Can't create the reserve</i18n.Translate>} description={error} /> )} <h2> - <Translate>Manual Withdrawal</Translate> + <i18n.Translate>Manual Withdrawal</i18n.Translate> </h2> <LightText> - <Translate> + <i18n.Translate> Choose a exchange from where the coins will be withdrawn. The exchange will send the coins to this wallet after receiving a wire transfer with the correct subject. - </Translate> + </i18n.Translate> </LightText> <p> <Input> <SelectList - label={<Translate>Currency</Translate>} + label={<i18n.Translate>Currency</i18n.Translate>} list={currencyMap} name="currency" value={currency} @@ -152,7 +152,7 @@ export function CreateManualWithdraw({ </Input> <Input> <SelectList - label={<Translate>Exchange</Translate>} + label={<i18n.Translate>Exchange</i18n.Translate>} list={exchangeMap} name="currency" value={exchange} @@ -161,13 +161,13 @@ export function CreateManualWithdraw({ </Input> <div style={{ display: "flex", justifyContent: "space-between" }}> <LinkPrimary onClick={onAddExchange} style={{ marginLeft: "auto" }}> - <Translate>Add Exchange</Translate> + <i18n.Translate>Add Exchange</i18n.Translate> </LinkPrimary> </div> {currency && ( <InputWithLabel invalid={!!amount && !parsedAmount}> <label> - <Translate>Amount</Translate> + <i18n.Translate>Amount</i18n.Translate> </label> <div> <span>{currency}</span> @@ -187,7 +187,7 @@ export function CreateManualWithdraw({ disabled={!parsedAmount || !exchange} onClick={() => onCreate(exchange, parsedAmount!)} > - <Translate>Start withdrawal</Translate> + <i18n.Translate>Start withdrawal</i18n.Translate> </ButtonPrimary> </footer> </Fragment> diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage.tsx b/packages/taler-wallet-webextension/src/wallet/DepositPage.tsx index 7a5e02d3b..d1d618e9f 100644 --- a/packages/taler-wallet-webextension/src/wallet/DepositPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/DepositPage.tsx @@ -19,7 +19,7 @@ import { Amounts, AmountString, PaytoUri, - Translate, + i18n, } from "@gnu-taler/taler-util"; import { DepositFee } from "@gnu-taler/taler-wallet-core/src/operations/deposits"; import { Fragment, h, VNode } from "preact"; @@ -135,7 +135,7 @@ export function View({ if (!balance) { return ( <div> - <Translate>no balance</Translate> + <i18n.Translate>no balance</i18n.Translate> </div> ); } @@ -143,10 +143,12 @@ export function View({ return ( <WarningBox> <p> - <Translate>There is no known bank account to send money to</Translate> + <i18n.Translate> + There is no known bank account to send money to + </i18n.Translate> </p> <ButtonBoxWarning> - <Translate>Withdraw</Translate> + <i18n.Translate>Withdraw</i18n.Translate> </ButtonBoxWarning> </WarningBox> ); @@ -172,12 +174,12 @@ export function View({ return ( <Fragment> <h2> - <Translate>Send {currency} to your account</Translate> + <i18n.Translate>Send {currency} to your account</i18n.Translate> </h2> <section> <Input> <SelectList - label={<Translate>Bank account IBAN number</Translate>} + label={<i18n.Translate>Bank account IBAN number</i18n.Translate>} list={accountMap} name="account" value={String(accountIdx)} @@ -186,7 +188,7 @@ export function View({ </Input> <InputWithLabel invalid={!!error}> <label> - <Translate>Amount</Translate> + <i18n.Translate>Amount</i18n.Translate> </label> <div> <span>{currency}</span> @@ -210,7 +212,7 @@ export function View({ <Fragment> <InputWithLabel> <label> - <Translate>Deposit fee</Translate> + <i18n.Translate>Deposit fee</i18n.Translate> </label> <div> <span>{currency}</span> @@ -224,7 +226,7 @@ export function View({ <InputWithLabel> <label> - <Translate>Total deposit</Translate> + <i18n.Translate>Total deposit</i18n.Translate> </label> <div> <span>{currency}</span> @@ -242,13 +244,13 @@ export function View({ <div /> {unableToDeposit ? ( <ButtonPrimary disabled> - <Translate>Deposit</Translate> + <i18n.Translate>Deposit</i18n.Translate> </ButtonPrimary> ) : ( <ButtonPrimary onClick={() => onSend(accountURI, amountStr)}> - <Translate> + <i18n.Translate> Deposit {Amounts.stringifyValue(totalToDeposit)} {currency} - </Translate> + </i18n.Translate> </ButtonPrimary> )} </footer> diff --git a/packages/taler-wallet-webextension/src/wallet/ExchangeAddConfirm.tsx b/packages/taler-wallet-webextension/src/wallet/ExchangeAddConfirm.tsx index 06d8abd2b..1ffca827b 100644 --- a/packages/taler-wallet-webextension/src/wallet/ExchangeAddConfirm.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ExchangeAddConfirm.tsx @@ -85,10 +85,10 @@ export function View({ <Fragment> <section> <h1> - <Translate>Review terms of service</Translate> + <i18n.Translate>Review terms of service</i18n.Translate> </h1> <div> - <Translate>Exchange URL</Translate>: + <i18n.Translate>Exchange URL</i18n.Translate>: <a href={url} target="_blank" rel="noreferrer"> {url} </a> @@ -109,28 +109,28 @@ export function View({ <footer> <Button onClick={onCancel}> - <Translate>Cancel</Translate> + <i18n.Translate>Cancel</i18n.Translate> </Button> {!terms && ( <Button disabled> - <Translate>Loading terms..</Translate> + <i18n.Translate>Loading terms..</i18n.Translate> </Button> )} {terms && ( <Fragment> {needsReview && !reviewed && ( <ButtonSuccess disabled upperCased onClick={onConfirm}> - <Translate>Add exchange</Translate> + <i18n.Translate>Add exchange</i18n.Translate> </ButtonSuccess> )} {(terms.status === "accepted" || (needsReview && reviewed)) && ( <ButtonSuccess upperCased onClick={onConfirm}> - <Translate>Add exchange</Translate> + <i18n.Translate>Add exchange</i18n.Translate> </ButtonSuccess> )} {terms.status === "notfound" && ( <ButtonWarning upperCased onClick={onConfirm}> - <Translate>Add exchange anyway</Translate> + <i18n.Translate>Add exchange anyway</i18n.Translate> </ButtonWarning> )} </Fragment> diff --git a/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx b/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx index 909afc4b7..7199ce90c 100644 --- a/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx @@ -93,42 +93,46 @@ export function ExchangeSetUrlPage({ <section> {!expectedCurrency ? ( <h1> - <Translate>Add new exchange</Translate> + <i18n.Translate>Add new exchange</i18n.Translate> </h1> ) : ( <h2> - <Translate>Add exchange for {expectedCurrency}</Translate> + <i18n.Translate>Add exchange for {expectedCurrency}</i18n.Translate> </h2> )} {!result && ( <LightText> - <Translate>Enter the URL of an exchange you trust.</Translate> + <i18n.Translate> + Enter the URL of an exchange you trust. + </i18n.Translate> </LightText> )} {result && ( <LightText> - <Translate> + <i18n.Translate> An exchange has been found! Review the information and click next - </Translate> + </i18n.Translate> </LightText> )} {result && expectedCurrency && expectedCurrency !== result.currency && ( <WarningBox> - <Translate> + <i18n.Translate> This exchange doesn't match the expected currency <b>{expectedCurrency}</b> - </Translate> + </i18n.Translate> </WarningBox> )} {error && ( <ErrorMessage - title={<Translate>Unable to verify this exchange</Translate>} + title={ + <i18n.Translate>Unable to verify this exchange</i18n.Translate> + } description={error} /> )} {confirmationError && ( <ErrorMessage - title={<Translate>Unable to add this exchange</Translate>} + title={<i18n.Translate>Unable to add this exchange</i18n.Translate>} description={confirmationError} /> )} @@ -144,20 +148,20 @@ export function ExchangeSetUrlPage({ </Input> {loading && ( <div> - <Translate>loading</Translate>... + <i18n.Translate>loading</i18n.Translate>... </div> )} {result && !loading && ( <Fragment> <Input> <label> - <Translate>Version</Translate> + <i18n.Translate>Version</i18n.Translate> </label> <input type="text" disabled value={result.version} /> </Input> <Input> <label> - <Translate>Currency</Translate> + <i18n.Translate>Currency</i18n.Translate> </label> <input type="text" disabled value={result.currency} /> </Input> @@ -167,7 +171,7 @@ export function ExchangeSetUrlPage({ </section> <footer> <Button onClick={onCancel}> - <Translate>Cancel</Translate> + <i18n.Translate>Cancel</i18n.Translate> </Button> <ButtonPrimary disabled={ @@ -183,7 +187,7 @@ export function ExchangeSetUrlPage({ ); }} > - <Translate>Next</Translate> + <i18n.Translate>Next</i18n.Translate> </ButtonPrimary> </footer> </Fragment> diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx index a3e8ecc67..e0a1c588e 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -19,7 +19,7 @@ import { Balance, NotificationType, Transaction, - Translate, + i18n, } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { useState } from "preact/hooks"; @@ -67,7 +67,11 @@ export function HistoryPage({ if (transactionQuery.hasError) { return ( <LoadingError - title={<Translate>Could not load the list of transactions</Translate>} + title={ + <i18n.Translate> + Could not load the list of transactions + </i18n.Translate> + } error={transactionQuery} /> ); @@ -194,14 +198,14 @@ export function HistoryView({ style={{ marginLeft: 0, marginTop: 8 }} onClick={() => goToWalletManualWithdraw(selectedCurrency)} > - <Translate>Withdraw</Translate> + <i18n.Translate>Withdraw</i18n.Translate> </ButtonPrimary> {currencyAmount && Amounts.isNonZero(currencyAmount) && ( <ButtonBoxPrimary style={{ marginLeft: 0, marginTop: 8 }} onClick={() => goToWalletDeposit(selectedCurrency)} > - <Translate>Deposit</Translate> + <i18n.Translate>Deposit</i18n.Translate> </ButtonBoxPrimary> )} </div> @@ -209,7 +213,7 @@ export function HistoryView({ </section> {datesWithTransaction.length === 0 ? ( <section> - <Translate>There is no history for this currency</Translate> + <i18n.Translate>There is no history for this currency</i18n.Translate> </section> ) : ( <section> diff --git a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx index 8eca733d4..d9a1544a7 100644 --- a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx @@ -19,7 +19,7 @@ import { AmountJson, Amounts, NotificationType, - Translate, + i18n, } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import { useState } from "preact/hooks"; @@ -97,7 +97,9 @@ export function ManualWithdrawPage({ currency, onCancel }: Props): VNode { return ( <LoadingError title={ - <Translate>Could not load the list of known exchanges</Translate> + <i18n.Translate> + Could not load the list of known exchanges + </i18n.Translate> } error={state} /> diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx index 55e2b62fb..6bb5b6836 100644 --- a/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx @@ -115,21 +115,27 @@ export function SetUrlView({ <Fragment> <section> <h1> - <Translate>Add backup provider</Translate> + <i18n.Translate>Add backup provider</i18n.Translate> </h1> {error && ( <ErrorMessage - title={<Translate>Could not get provider information</Translate>} + title={ + <i18n.Translate> + Could not get provider information + </i18n.Translate> + } description={error} /> )} <LightText> - <Translate>Backup providers may charge for their service</Translate> + <i18n.Translate> + Backup providers may charge for their service + </i18n.Translate> </LightText> <p> <Input invalid={urlError}> <label> - <Translate>URL</Translate> + <i18n.Translate>URL</i18n.Translate> </label> <input type="text" @@ -140,7 +146,7 @@ export function SetUrlView({ </Input> <Input> <label> - <Translate>Name</Translate> + <i18n.Translate>Name</i18n.Translate> </label> <input type="text" @@ -153,7 +159,7 @@ export function SetUrlView({ </section> <footer> <Button onClick={onCancel}> - < <Translate>Back</Translate> + < <i18n.Translate>Back</i18n.Translate> </Button> <ButtonPrimary disabled={!value && !urlError} @@ -164,7 +170,7 @@ export function SetUrlView({ ); }} > - <Translate>Next</Translate> + <i18n.Translate>Next</i18n.Translate> </ButtonPrimary> </footer> </Fragment> @@ -189,40 +195,42 @@ export function ConfirmProviderView({ <Fragment> <section> <h1> - <Translate>Review terms of service</Translate> + <i18n.Translate>Review terms of service</i18n.Translate> </h1> <div> - <Translate>Provider URL</Translate>:{" "} + <i18n.Translate>Provider URL</i18n.Translate>:{" "} <a href={url} target="_blank"> {url} </a> </div> <SmallLightText> - <Translate> + <i18n.Translate> Please review and accept this provider's terms of service - </Translate> + </i18n.Translate> </SmallLightText> <h2> - 1. <Translate>Pricing</Translate> + 1. <i18n.Translate>Pricing</i18n.Translate> </h2> <p> {Amounts.isZero(provider.annual_fee) ? ( - <Translate>free of charge</Translate> + <i18n.Translate>free of charge</i18n.Translate> ) : ( - <Translate>{provider.annual_fee} per year of service</Translate> + <i18n.Translate> + {provider.annual_fee} per year of service + </i18n.Translate> )} </p> <h2> - 2. <Translate>Storage</Translate> + 2. <i18n.Translate>Storage</i18n.Translate> </h2> <p> - <Translate> + <i18n.Translate> {provider.storage_limit_in_megabytes} megabytes of storage per year of service - </Translate> + </i18n.Translate> </p> <Checkbox - label={<Translate>Accept terms of service</Translate>} + label={<i18n.Translate>Accept terms of service</i18n.Translate>} name="terms" onToggle={() => setAccepted((old) => !old)} enabled={accepted} @@ -230,10 +238,10 @@ export function ConfirmProviderView({ </section> <footer> <Button onClick={onCancel}> - < <Translate>Back</Translate> + < <i18n.Translate>Back</i18n.Translate> </Button> <ButtonPrimary disabled={!accepted} onClick={onConfirm}> - <Translate>Add provider</Translate> + <i18n.Translate>Add provider</i18n.Translate> </ButtonPrimary> </footer> </Fragment> diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx index beeedcda7..65049d6b6 100644 --- a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx @@ -14,7 +14,7 @@ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Translate } from "@gnu-taler/taler-util"; +import { i18n } from "@gnu-taler/taler-util"; import { ProviderInfo, ProviderPaymentStatus, @@ -60,9 +60,9 @@ export function ProviderDetailPage({ pid: providerURL, onBack }: Props): VNode { return ( <LoadingError title={ - <Translate> + <i18n.Translate> There was an error loading the provider detail for "{providerURL}" - </Translate> + </i18n.Translate> } error={state} /> @@ -105,12 +105,14 @@ export function ProviderView({ <Fragment> <section> <p> - <Translate>There is not known provider with url "{url}".</Translate> + <i18n.Translate> + There is not known provider with url "{url}". + </i18n.Translate> </p> </section> <footer> <Button onClick={onBack}> - < <Translate>Back</Translate> + < <i18n.Translate>Back</i18n.Translate> </Button> <div /> </footer> @@ -136,54 +138,54 @@ export function ProviderView({ <section> <p> <b> - <Translate>Last backup</Translate>: + <i18n.Translate>Last backup</i18n.Translate>: </b>{" "} <Time timestamp={lb} format="dd MMMM yyyy" /> </p> <ButtonPrimary onClick={onSync}> - <Translate>Back up</Translate> + <i18n.Translate>Back up</i18n.Translate> </ButtonPrimary> {info.terms && ( <Fragment> <p> <b> - <Translate>Provider fee</Translate>: + <i18n.Translate>Provider fee</i18n.Translate>: </b>{" "} {info.terms && info.terms.annualFee}{" "} - <Translate>per year</Translate> + <i18n.Translate>per year</i18n.Translate> </p> </Fragment> )} <p>{descriptionByStatus(info.paymentStatus)}</p> <ButtonPrimary disabled onClick={onExtend}> - <Translate>Extend</Translate> + <i18n.Translate>Extend</i18n.Translate> </ButtonPrimary> {info.paymentStatus.type === ProviderPaymentType.TermsChanged && ( <div> <p> - <Translate> + <i18n.Translate> terms has changed, extending the service will imply accepting the new terms of service - </Translate> + </i18n.Translate> </p> <table> <thead> <tr> <td> </td> <td> - <Translate>old</Translate> + <i18n.Translate>old</i18n.Translate> </td> <td> -></td> <td> - <Translate>new</Translate> + <i18n.Translate>new</i18n.Translate> </td> </tr> </thead> <tbody> <tr> <td> - <Translate>fee</Translate> + <i18n.Translate>fee</i18n.Translate> </td> <td>{info.paymentStatus.oldTerms.annualFee}</td> <td>-></td> @@ -191,7 +193,7 @@ export function ProviderView({ </tr> <tr> <td> - <Translate>storage</Translate> + <i18n.Translate>storage</i18n.Translate> </td> <td>{info.paymentStatus.oldTerms.storageLimitInMegabytes}</td> <td>-></td> @@ -204,11 +206,11 @@ export function ProviderView({ </section> <footer> <Button onClick={onBack}> - < <Translate>back</Translate> + < <i18n.Translate>back</i18n.Translate> </Button> <div> <ButtonDestructive onClick={onDelete}> - <Translate>Remove provider</Translate> + <i18n.Translate>Remove provider</i18n.Translate> </ButtonDestructive> </div> </footer> @@ -220,7 +222,9 @@ function Error({ info }: { info: ProviderInfo }): VNode { if (info.lastError) { return ( <ErrorMessage - title={<Translate>This provider has reported an error</Translate>} + title={ + <i18n.Translate>This provider has reported an error</i18n.Translate> + } description={info.lastError.hint} /> ); @@ -232,26 +236,28 @@ function Error({ info }: { info: ProviderInfo }): VNode { <ErrorMessage title={ <Fragment> - <Translate> + <i18n.Translate> There is conflict with another backup from{" "} <b>{info.backupProblem.otherDeviceId}</b> - </Translate> + </i18n.Translate> </Fragment> } /> ); case "backup-unreadable": return ( - <ErrorMessage title={<Translate>Backup is not readable</Translate>} /> + <ErrorMessage + title={<i18n.Translate>Backup is not readable</i18n.Translate>} + /> ); default: return ( <ErrorMessage title={ <Fragment> - <Translate> + <i18n.Translate> Unknown backup problem: {JSON.stringify(info.backupProblem)} - </Translate> + </i18n.Translate> </Fragment> } /> @@ -268,14 +274,14 @@ function descriptionByStatus(status: ProviderPaymentStatus): VNode { if (status.paidUntil.t_ms === "never") { return ( <span> - <Translate>service paid</Translate> + <i18n.Translate>service paid</i18n.Translate> </span> ); } return ( <Fragment> <b> - <Translate>Backup valid until</Translate>: + <i18n.Translate>Backup valid until</i18n.Translate>: </b>{" "} <Time timestamp={status.paidUntil} format="dd MMM yyyy" /> </Fragment> diff --git a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx index 7de719fc6..2c0e2fd31 100644 --- a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx @@ -1,9 +1,4 @@ -import { - AmountJson, - Amounts, - parsePaytoUri, - Translate, -} from "@gnu-taler/taler-util"; +import { AmountJson, parsePaytoUri, i18n } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType"; import { QR } from "../components/QR"; @@ -29,7 +24,9 @@ export function ReserveCreated({ if (!paytoURI) { return ( <div> - <Translate>could not parse payto uri from exchange {payto}</Translate> + <i18n.Translate> + could not parse payto uri from exchange {payto} + </i18n.Translate> </div> ); } @@ -37,13 +34,13 @@ export function ReserveCreated({ <Fragment> <section> <h1> - <Translate>Exchange is ready for withdrawal</Translate> + <i18n.Translate>Exchange is ready for withdrawal</i18n.Translate> </h1> <p> - <Translate> + <i18n.Translate> To complete the process you need to wire <b>{amountToString(amount)}</b> to the exchange bank account - </Translate> + </i18n.Translate> </p> <BankDetailsByPaytoType amount={amountToString(amount)} @@ -53,27 +50,27 @@ export function ReserveCreated({ /> <p> <WarningBox> - <Translate> + <i18n.Translate> Make sure to use the correct subject, otherwise the money will not arrive in this wallet. - </Translate> + </i18n.Translate> </WarningBox> </p> </section> <section> <p> - <Translate> + <i18n.Translate> Alternative, you can also scan this QR code or open <a href={payto}>this link</a> if you have a banking app installed that supports RFC 8905 - </Translate> + </i18n.Translate> </p> <QR text={payto} /> </section> <footer> <div /> <ButtonDestructive onClick={onCancel}> - <Translate>Cancel withdrawal</Translate> + <i18n.Translate>Cancel withdrawal</i18n.Translate> </ButtonDestructive> </footer> </Fragment> diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.tsx b/packages/taler-wallet-webextension/src/wallet/Settings.tsx index bac884247..3bb3fa865 100644 --- a/packages/taler-wallet-webextension/src/wallet/Settings.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Settings.tsx @@ -81,31 +81,31 @@ export function SettingsView({ <Fragment> <section> <h2> - <Translate>Permissions</Translate> + <i18n.Translate>Permissions</i18n.Translate> </h2> <Checkbox label={ - <Translate> + <i18n.Translate> Automatically open wallet based on page content - </Translate> + </i18n.Translate> } name="perm" description={ - <Translate> + <i18n.Translate> Enabling this option below will make using the wallet faster, but requires more permissions from your browser. - </Translate> + </i18n.Translate> } enabled={permissionsEnabled} onToggle={togglePermissions} /> <h2> - <Translate>Known exchanges</Translate> + <i18n.Translate>Known exchanges</i18n.Translate> </h2> {!knownExchanges || !knownExchanges.length ? ( <div> - <Translate>No exchange yet</Translate> + <i18n.Translate>No exchange yet</i18n.Translate> </div> ) : ( <Fragment> @@ -113,13 +113,13 @@ export function SettingsView({ <thead> <tr> <th> - <Translate>Currency</Translate> + <i18n.Translate>Currency</i18n.Translate> </th> <th> - <Translate>URL</Translate> + <i18n.Translate>URL</i18n.Translate> </th> <th> - <Translate>Term of Service</Translate> + <i18n.Translate>Term of Service</i18n.Translate> </th> </tr> </thead> @@ -135,20 +135,20 @@ export function SettingsView({ case "accepted": return ( <SuccessText> - <Translate>ok</Translate> + <i18n.Translate>ok</i18n.Translate> </SuccessText> ); case "changed": return ( <WarningText> - <Translate>changed</Translate> + <i18n.Translate>changed</i18n.Translate> </WarningText> ); case "new": case "notfound": return ( <DestructiveText> - <Translate>not accepted</Translate> + <i18n.Translate>not accepted</i18n.Translate> </DestructiveText> ); } @@ -172,18 +172,18 @@ export function SettingsView({ <div style={{ display: "flex", justifyContent: "space-between" }}> <div /> <LinkPrimary href={Pages.settings_exchange_add}> - <Translate>Add an exchange</Translate> + <i18n.Translate>Add an exchange</i18n.Translate> </LinkPrimary> </div> <h2>Config</h2> <Checkbox - label={<Translate>Developer mode</Translate>} + label={<i18n.Translate>Developer mode</i18n.Translate>} name="devMode" description={ - <Translate> + <i18n.Translate> (More options and information useful for debugging) - </Translate> + </i18n.Translate> } enabled={developerMode} onToggle={toggleDeveloperMode} diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index a43e9b4a0..cae70d60d 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -22,7 +22,6 @@ import { parsePaytoUri, Transaction, TransactionType, - Translate, WithdrawalType, } from "@gnu-taler/taler-util"; import { differenceInSeconds } from "date-fns"; @@ -77,7 +76,9 @@ export function TransactionPage({ tid, goToWalletHistory }: Props): VNode { return ( <LoadingError title={ - <Translate>Could not load the transaction information</Translate> + <i18n.Translate> + Could not load the transaction information + </i18n.Translate> } error={state} /> @@ -142,15 +143,15 @@ export function TransactionView({ <section style={{ padding: 8, textAlign: "center" }}> <ErrorTalerOperation title={ - <Translate> + <i18n.Translate> There was an error trying to complete the transaction - </Translate> + </i18n.Translate> } error={transaction?.error} /> {transaction.pending && ( <WarningBox> - <Translate>This transaction is not completed</Translate> + <i18n.Translate>This transaction is not completed</i18n.Translate> </WarningBox> )} </section> @@ -159,16 +160,16 @@ export function TransactionView({ </section> <footer> <Button onClick={onBack}> - < <Translate> Back </Translate> + < <i18n.Translate> Back </i18n.Translate> </Button> <div> {showRetry ? ( <ButtonPrimary onClick={onRetry}> - <Translate>Retry</Translate> + <i18n.Translate>Retry</i18n.Translate> </ButtonPrimary> ) : null} <ButtonDestructive onClick={doCheckBeforeForget}> - <Translate>Forget</Translate> + <i18n.Translate>Forget</i18n.Translate> </ButtonDestructive> </div> </footer> @@ -193,28 +194,28 @@ export function TransactionView({ <Overlay> <CenteredDialog> <header> - <Translate>Caution!</Translate> + <i18n.Translate>Caution!</i18n.Translate> </header> <section> - <Translate> + <i18n.Translate> If you have already wired money to the exchange you will loose the chance to get the coins form it. - </Translate> + </i18n.Translate> </section> <footer> <Button onClick={() => setConfirmBeforeForget(false)}> - <Translate>Cancel</Translate> + <i18n.Translate>Cancel</i18n.Translate> </Button> <ButtonDestructive onClick={onDelete}> - <Translate>Confirm</Translate> + <i18n.Translate>Confirm</i18n.Translate> </ButtonDestructive> </footer> </CenteredDialog> </Overlay> ) : undefined} <h2> - <Translate>Withdrawal</Translate> + <i18n.Translate>Withdrawal</i18n.Translate> </h2> <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" /> {transaction.pending ? ( @@ -231,21 +232,21 @@ export function TransactionView({ /> <p> <WarningBox> - <Translate> + <i18n.Translate> Make sure to use the correct subject, otherwise the money will not arrive in this wallet. - </Translate> + </i18n.Translate> </WarningBox> </p> <Part big - title={<Translate>Total withdrawn</Translate>} + title={<i18n.Translate>Total withdrawn</i18n.Translate>} text={amountToString(transaction.amountEffective)} kind="positive" /> <Part big - title={<Translate>Exchange fee</Translate>} + title={<i18n.Translate>Exchange fee</i18n.Translate>} text={amountToString(fee)} kind="negative" /> @@ -255,38 +256,40 @@ export function TransactionView({ {!transaction.withdrawalDetails.confirmed && transaction.withdrawalDetails.bankConfirmationUrl ? ( <InfoBox> - <Translate> + <i18n.Translate> The bank is waiting for confirmation. Go to the <a href={transaction.withdrawalDetails.bankConfirmationUrl} target="_blank" rel="noreferrer" > - <Translate>bank site</Translate> + <i18n.Translate>bank site</i18n.Translate> </a> - </Translate> + </i18n.Translate> </InfoBox> ) : undefined} {transaction.withdrawalDetails.confirmed && ( <InfoBox> - <Translate>Waiting for the coins to arrive</Translate> + <i18n.Translate> + Waiting for the coins to arrive + </i18n.Translate> </InfoBox> )} <Part big - title={<Translate>Total withdrawn</Translate>} + title={<i18n.Translate>Total withdrawn</i18n.Translate>} text={amountToString(transaction.amountEffective)} kind="positive" /> <Part big - title={<Translate>Chosen amount</Translate>} + title={<i18n.Translate>Chosen amount</i18n.Translate>} text={amountToString(transaction.amountRaw)} kind="neutral" /> <Part big - title={<Translate>Exchange fee</Translate>} + title={<i18n.Translate>Exchange fee</i18n.Translate>} text={amountToString(fee)} kind="negative" /> @@ -296,26 +299,26 @@ export function TransactionView({ <Fragment> <Part big - title={<Translate>Total withdrawn</Translate>} + title={<i18n.Translate>Total withdrawn</i18n.Translate>} text={amountToString(transaction.amountEffective)} kind="positive" /> <Part big - title={<Translate>Chosen amount</Translate>} + title={<i18n.Translate>Chosen amount</i18n.Translate>} text={amountToString(transaction.amountRaw)} kind="neutral" /> <Part big - title={<Translate>Exchange fee</Translate>} + title={<i18n.Translate>Exchange fee</i18n.Translate>} text={amountToString(fee)} kind="negative" /> </Fragment> )} <Part - title={<Translate>Exchange</Translate>} + title={<i18n.Translate>Exchange</i18n.Translate>} text={new URL(transaction.exchangeBaseUrl).hostname} kind="neutral" /> @@ -336,40 +339,40 @@ export function TransactionView({ return ( <TransactionTemplate> <h2> - <Translate>Payment</Translate> + <i18n.Translate>Payment</i18n.Translate> </h2> <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" /> <br /> <Part big - title={<Translate>Total paid</Translate>} + title={<i18n.Translate>Total paid</i18n.Translate>} text={amountToString(transaction.amountEffective)} kind="negative" /> <Part big - title={<Translate>Purchase amount</Translate>} + title={<i18n.Translate>Purchase amount</i18n.Translate>} text={amountToString(transaction.amountRaw)} kind="neutral" /> <Part big - title={<Translate>Fee</Translate>} + title={<i18n.Translate>Fee</i18n.Translate>} text={amountToString(fee)} kind="negative" /> <Part - title={<Translate>Merchant</Translate>} + title={<i18n.Translate>Merchant</i18n.Translate>} text={transaction.info.merchant.name} kind="neutral" /> <Part - title={<Translate>Purchase</Translate>} + title={<i18n.Translate>Purchase</i18n.Translate>} text={transaction.info.summary} kind="neutral" /> <Part - title={<Translate>Receipt</Translate>} + title={<i18n.Translate>Receipt</i18n.Translate>} text={`#${transaction.info.orderId}`} kind="neutral" /> @@ -407,25 +410,25 @@ export function TransactionView({ return ( <TransactionTemplate> <h2> - <Translate>Deposit</Translate> + <i18n.Translate>Deposit</i18n.Translate> </h2> <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" /> <br /> <Part big - title={<Translate>Total send</Translate>} + title={<i18n.Translate>Total send</i18n.Translate>} text={amountToString(transaction.amountEffective)} kind="neutral" /> <Part big - title={<Translate>Deposit amount</Translate>} + title={<i18n.Translate>Deposit amount</i18n.Translate>} text={amountToString(transaction.amountRaw)} kind="positive" /> <Part big - title={<Translate>Fee</Translate>} + title={<i18n.Translate>Fee</i18n.Translate>} text={amountToString(fee)} kind="negative" /> @@ -441,25 +444,25 @@ export function TransactionView({ return ( <TransactionTemplate> <h2> - <Translate>Refresh</Translate> + <i18n.Translate>Refresh</i18n.Translate> </h2> <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" /> <br /> <Part big - title={<Translate>Total refresh</Translate>} + title={<i18n.Translate>Total refresh</i18n.Translate>} text={amountToString(transaction.amountEffective)} kind="negative" /> <Part big - title={<Translate>Refresh amount</Translate>} + title={<i18n.Translate>Refresh amount</i18n.Translate>} text={amountToString(transaction.amountRaw)} kind="neutral" /> <Part big - title={<Translate>Fee</Translate>} + title={<i18n.Translate>Fee</i18n.Translate>} text={amountToString(fee)} kind="negative" /> @@ -475,25 +478,25 @@ export function TransactionView({ return ( <TransactionTemplate> <h2> - <Translate>Tip</Translate> + <i18n.Translate>Tip</i18n.Translate> </h2> <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" /> <br /> <Part big - title={<Translate>Total tip</Translate>} + title={<i18n.Translate>Total tip</i18n.Translate>} text={amountToString(transaction.amountEffective)} kind="positive" /> <Part big - title={<Translate>Received amount</Translate>} + title={<i18n.Translate>Received amount</i18n.Translate>} text={amountToString(transaction.amountRaw)} kind="neutral" /> <Part big - title={<Translate>Fee</Translate>} + title={<i18n.Translate>Fee</i18n.Translate>} text={amountToString(fee)} kind="negative" /> @@ -509,40 +512,40 @@ export function TransactionView({ return ( <TransactionTemplate> <h2> - <Translate>Refund</Translate> + <i18n.Translate>Refund</i18n.Translate> </h2> <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" /> <br /> <Part big - title={<Translate>Total refund</Translate>} + title={<i18n.Translate>Total refund</i18n.Translate>} text={amountToString(transaction.amountEffective)} kind="positive" /> <Part big - title={<Translate>Refund amount</Translate>} + title={<i18n.Translate>Refund amount</i18n.Translate>} text={amountToString(transaction.amountRaw)} kind="neutral" /> <Part big - title={<Translate>Fee</Translate>} + title={<i18n.Translate>Fee</i18n.Translate>} text={amountToString(fee)} kind="negative" /> <Part - title={<Translate>Merchant</Translate>} + title={<i18n.Translate>Merchant</i18n.Translate>} text={transaction.info.merchant.name} kind="neutral" /> <Part - title={<Translate>Purchase</Translate>} + title={<i18n.Translate>Purchase</i18n.Translate>} text={transaction.info.summary} kind="neutral" /> <Part - title={<Translate>Receipt</Translate>} + title={<i18n.Translate>Receipt</i18n.Translate>} text={`#${transaction.info.orderId}`} kind="neutral" /> diff --git a/packages/taler-wallet-webextension/src/wallet/Welcome.tsx b/packages/taler-wallet-webextension/src/wallet/Welcome.tsx index a251c4254..37ad97afd 100644 --- a/packages/taler-wallet-webextension/src/wallet/Welcome.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Welcome.tsx @@ -20,7 +20,7 @@ * @author sebasjm */ -import { Translate, WalletDiagnostics } from "@gnu-taler/taler-util"; +import { i18n, WalletDiagnostics } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { Checkbox } from "../components/Checkbox"; import { Diagnostics } from "../components/Diagnostics"; @@ -55,40 +55,43 @@ export function View({ return ( <Fragment> <h1> - <Translate>Browser Extension Installed!</Translate> + <i18n.Translate>Browser Extension Installed!</i18n.Translate> </h1> <div> <p> - <Translate>Thank you for installing the wallet.</Translate> + <i18n.Translate>Thank you for installing the wallet.</i18n.Translate> </p> <Diagnostics diagnostics={diagnostics} timedOut={timedOut} /> <h2> - <Translate>Permissions</Translate> + <i18n.Translate>Permissions</i18n.Translate> </h2> <Checkbox label={ - <Translate> + <i18n.Translate> Automatically open wallet based on page content - </Translate> + </i18n.Translate> } name="perm" description={ - <Translate> + <i18n.Translate> (Enabling this option below will make using the wallet faster, but requires more permissions from your browser.) - </Translate> + </i18n.Translate> } enabled={permissionsEnabled} onToggle={togglePermissions} /> <h2> - <Translate>Next Steps</Translate> + <i18n.Translate>Next Steps</i18n.Translate> </h2> <a href="https://demo.taler.net/" style={{ display: "block" }}> - <Translate>Try the demo</Translate> » + <i18n.Translate>Try the demo</i18n.Translate> » </a> <a href="https://demo.taler.net/" style={{ display: "block" }}> - <Translate>Learn how to top up your wallet balance</Translate> » + <i18n.Translate> + Learn how to top up your wallet balance + </i18n.Translate>{" "} + » </a> </div> </Fragment> diff --git a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx index b0ff0d186..9d8d92863 100644 --- a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx +++ b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx @@ -20,7 +20,7 @@ * @author sebasjm <dold@taler.net> */ -import { i18n, setupI18n, Translate } from "@gnu-taler/taler-util"; +import { i18n, setupI18n } from "@gnu-taler/taler-util"; import { createHashHistory } from "history"; import { Fragment, h, render, VNode } from "preact"; import Router, { route, Route } from "preact-router"; @@ -169,9 +169,9 @@ function Application(): VNode { onSuccess={(currency: string) => { route(Pages.balance_history.replace(":currency", currency)); setGlobalNotification( - <Translate> + <i18n.Translate> All done, your transaction is in progress - </Translate>, + </i18n.Translate>, ); }} /> |