From 8c3e57293422d670b93c2f2a19cfc47f3aecc7b1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 23 Feb 2022 15:44:14 -0300 Subject: we are force to use i18n.Translate, otherwise pogen won't find the tag --- .../src/wallet/AddNewActionView.tsx | 18 ++-- .../src/wallet/BackupPage.tsx | 18 ++-- .../src/wallet/CreateManualWithdraw.tsx | 28 ++--- .../src/wallet/DepositPage.tsx | 26 ++--- .../src/wallet/ExchangeAddConfirm.tsx | 14 +-- .../src/wallet/ExchangeSetUrl.tsx | 32 +++--- .../src/wallet/History.tsx | 14 ++- .../src/wallet/ManualWithdrawPage.tsx | 6 +- .../src/wallet/ProviderAddPage.tsx | 48 +++++---- .../src/wallet/ProviderDetailPage.tsx | 58 ++++++----- .../src/wallet/ReserveCreated.tsx | 27 +++-- .../src/wallet/Settings.tsx | 34 +++---- .../src/wallet/Transaction.tsx | 113 +++++++++++---------- .../src/wallet/Welcome.tsx | 25 +++-- 14 files changed, 243 insertions(+), 218 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet') 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 Open reserve page; + return Open reserve page; case TalerUriType.TalerPay: - return Open pay page; + return Open pay page; case TalerUriType.TalerRefund: - return Open refund page; + return Open refund page; case TalerUriType.TalerTip: - return Open tip page; + return Open tip page; case TalerUriType.TalerWithdraw: - return Open withdraw page; + return Open withdraw page; } return ; } @@ -52,7 +48,7 @@ export function AddNewActionView({ onCancel }: Props): VNode {
{uriType !== TalerUriType.Unknown && ( Could not load backup providers} + title={Could not load backup providers} error={status} /> ); @@ -126,10 +126,10 @@ export function BackupView({ {!providers.length && ( - No backup providers configured + No backup providers configured - Add provider + Add provider )} @@ -140,13 +140,13 @@ export function BackupView({
{providers.length > 1 ? ( - Sync all backups + Sync all backups ) : ( - Sync now + Sync now )} - Add provider + Add provider
@@ -184,12 +184,12 @@ function BackupLayout(props: TransactionLayoutProps): VNode { {dateStr && ( - Last synced: {dateStr} + Last synced: {dateStr} )} {!dateStr && ( - Not synced + Not synced )} @@ -208,7 +208,7 @@ function ExpirationText({ until }: { until: Timestamp }): VNode { return ( - Expires in + Expires in {" "} 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 (

- Manual Withdrawal + Manual Withdrawal

- + 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. - + - No exchange configured + No exchange configured - Add exchange + Add exchange
@@ -126,24 +126,24 @@ export function CreateManualWithdraw({
{error && ( Can't create the reserve} + title={Can't create the reserve} description={error} /> )}

- Manual Withdrawal + Manual Withdrawal

- + 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. - +

Currency} + label={Currency} list={currencyMap} name="currency" value={currency} @@ -152,7 +152,7 @@ export function CreateManualWithdraw({ Exchange} + label={Exchange} list={exchangeMap} name="currency" value={exchange} @@ -161,13 +161,13 @@ export function CreateManualWithdraw({

- Add Exchange + Add Exchange
{currency && (
{currency} @@ -187,7 +187,7 @@ export function CreateManualWithdraw({ disabled={!parsedAmount || !exchange} onClick={() => onCreate(exchange, parsedAmount!)} > - Start withdrawal + Start withdrawal 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 (
- no balance + no balance
); } @@ -143,10 +143,12 @@ export function View({ return (

- There is no known bank account to send money to + + There is no known bank account to send money to +

- Withdraw + Withdraw
); @@ -172,12 +174,12 @@ export function View({ return (

- Send {currency} to your account + Send {currency} to your account

Bank account IBAN number} + label={Bank account IBAN number} list={accountMap} name="account" value={String(accountIdx)} @@ -186,7 +188,7 @@ export function View({
{currency} @@ -210,7 +212,7 @@ export function View({
{currency} @@ -224,7 +226,7 @@ export function View({
{currency} @@ -242,13 +244,13 @@ export function View({
{unableToDeposit ? ( - Deposit + Deposit ) : ( onSend(accountURI, amountStr)}> - + Deposit {Amounts.stringifyValue(totalToDeposit)} {currency} - + )} 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({

- Review terms of service + Review terms of service

- Exchange URL: + Exchange URL: {url} @@ -109,28 +109,28 @@ export function View({
{!terms && ( )} {terms && ( {needsReview && !reviewed && ( - Add exchange + Add exchange )} {(terms.status === "accepted" || (needsReview && reviewed)) && ( - Add exchange + Add exchange )} {terms.status === "notfound" && ( - Add exchange anyway + Add exchange anyway )} 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({
{!expectedCurrency ? (

- Add new exchange + Add new exchange

) : (

- Add exchange for {expectedCurrency} + Add exchange for {expectedCurrency}

)} {!result && ( - Enter the URL of an exchange you trust. + + Enter the URL of an exchange you trust. + )} {result && ( - + An exchange has been found! Review the information and click next - + )} {result && expectedCurrency && expectedCurrency !== result.currency && ( - + This exchange doesn't match the expected currency {expectedCurrency} - + )} {error && ( Unable to verify this exchange} + title={ + Unable to verify this exchange + } description={error} /> )} {confirmationError && ( Unable to add this exchange} + title={Unable to add this exchange} description={confirmationError} /> )} @@ -144,20 +148,20 @@ export function ExchangeSetUrlPage({ {loading && (
- loading... + loading...
)} {result && !loading && ( @@ -167,7 +171,7 @@ export function ExchangeSetUrlPage({
- Next + Next
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 ( Could not load the list of transactions} + title={ + + Could not load the list of transactions + + } error={transactionQuery} /> ); @@ -194,14 +198,14 @@ export function HistoryView({ style={{ marginLeft: 0, marginTop: 8 }} onClick={() => goToWalletManualWithdraw(selectedCurrency)} > - Withdraw + Withdraw {currencyAmount && Amounts.isNonZero(currencyAmount) && ( goToWalletDeposit(selectedCurrency)} > - Deposit + Deposit )}
@@ -209,7 +213,7 @@ export function HistoryView({
{datesWithTransaction.length === 0 ? (
- There is no history for this currency + There is no history for this currency
) : (
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 ( Could not load the list of known exchanges + + Could not load the list of known exchanges + } 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({

- Add backup provider + Add backup provider

{error && ( Could not get provider information} + title={ + + Could not get provider information + + } description={error} /> )} - Backup providers may charge for their service + + Backup providers may charge for their service +

- Next + Next
@@ -189,40 +195,42 @@ export function ConfirmProviderView({

- Review terms of service + Review terms of service

- Provider URL:{" "} + Provider URL:{" "} {url}
- + Please review and accept this provider's terms of service - +

- 1. Pricing + 1. Pricing

{Amounts.isZero(provider.annual_fee) ? ( - free of charge + free of charge ) : ( - {provider.annual_fee} per year of service + + {provider.annual_fee} per year of service + )}

- 2. Storage + 2. Storage

- + {provider.storage_limit_in_megabytes} megabytes of storage per year of service - +

Accept terms of service} + label={Accept terms of service} name="terms" onToggle={() => setAccepted((old) => !old)} enabled={accepted} @@ -230,10 +238,10 @@ export function ConfirmProviderView({
- Add provider + Add provider
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 */ -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 ( + There was an error loading the provider detail for "{providerURL}" - + } error={state} /> @@ -105,12 +105,14 @@ export function ProviderView({

- There is not known provider with url "{url}". + + There is not known provider with url "{url}". +

@@ -136,54 +138,54 @@ export function ProviderView({

- Last backup: + Last backup: {" "}

- Back up + Back up {info.terms && (

- Provider fee: + Provider fee: {" "} {info.terms && info.terms.annualFee}{" "} - per year + per year

)}

{descriptionByStatus(info.paymentStatus)}

- Extend + Extend {info.paymentStatus.type === ProviderPaymentType.TermsChanged && (

- + terms has changed, extending the service will imply accepting the new terms of service - +

@@ -191,7 +193,7 @@ export function ProviderView({ @@ -204,11 +206,11 @@ export function ProviderView({
- Remove provider + Remove provider
@@ -220,7 +222,9 @@ function Error({ info }: { info: ProviderInfo }): VNode { if (info.lastError) { return ( This provider has reported an error} + title={ + This provider has reported an error + } description={info.lastError.hint} /> ); @@ -232,26 +236,28 @@ function Error({ info }: { info: ProviderInfo }): VNode { - + There is conflict with another backup from{" "} {info.backupProblem.otherDeviceId} - + } /> ); case "backup-unreadable": return ( - Backup is not readable} /> + Backup is not readable} + /> ); default: return ( - + Unknown backup problem: {JSON.stringify(info.backupProblem)} - + } /> @@ -268,14 +274,14 @@ function descriptionByStatus(status: ProviderPaymentStatus): VNode { if (status.paidUntil.t_ms === "never") { return ( - service paid + service paid ); } return ( - Backup valid until: + Backup valid until: {" "} 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 (
- could not parse payto uri from exchange {payto} + + could not parse payto uri from exchange {payto} +
); } @@ -37,13 +34,13 @@ export function ReserveCreated({

- Exchange is ready for withdrawal + Exchange is ready for withdrawal

- + To complete the process you need to wire {amountToString(amount)} to the exchange bank account - +

- + Make sure to use the correct subject, otherwise the money will not arrive in this wallet. - +

- + Alternative, you can also scan this QR code or open this link if you have a banking app installed that supports RFC 8905 - +

- Cancel withdrawal + Cancel withdrawal
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({

- Permissions + Permissions

+ Automatically open wallet based on page content - + } name="perm" description={ - + Enabling this option below will make using the wallet faster, but requires more permissions from your browser. - + } enabled={permissionsEnabled} onToggle={togglePermissions} />

- Known exchanges + Known exchanges

{!knownExchanges || !knownExchanges.length ? (
- No exchange yet + No exchange yet
) : ( @@ -113,13 +113,13 @@ export function SettingsView({
@@ -135,20 +135,20 @@ export function SettingsView({ case "accepted": return ( - ok + ok ); case "changed": return ( - changed + changed ); case "new": case "notfound": return ( - not accepted + not accepted ); } @@ -172,18 +172,18 @@ export function SettingsView({
- Add an exchange + Add an exchange

Config

Developer mode} + label={Developer mode} name="devMode" description={ - + (More options and information useful for debugging) - + } 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 ( Could not load the transaction information + + Could not load the transaction information + } error={state} /> @@ -142,15 +143,15 @@ export function TransactionView({
+ There was an error trying to complete the transaction - + } error={transaction?.error} /> {transaction.pending && ( - This transaction is not completed + This transaction is not completed )}
@@ -159,16 +160,16 @@ export function TransactionView({
{showRetry ? ( - Retry + Retry ) : null} - Forget + Forget
@@ -193,28 +194,28 @@ export function TransactionView({
- Caution! + Caution!
- + If you have already wired money to the exchange you will loose the chance to get the coins form it. - +
- Confirm + Confirm
) : undefined}

- Withdrawal + Withdrawal

  - old + old -> - new + new
- fee + fee {info.paymentStatus.oldTerms.annualFee} ->
- storage + storage {info.paymentStatus.oldTerms.storageLimitInMegabytes} ->
- Currency + Currency - URL + URL - Term of Service + Term of Service