diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-09 11:03:30 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-09 11:03:30 -0300 |
commit | 7d07f752eb4e6606c83cba6d2bf84369b6fab32f (patch) | |
tree | 77264d98358a4ad965d3da78098b304f0359de62 | |
parent | 1665cf4f72b831412e5d704d02be5887be090e50 (diff) |
new string added to i18n
7 files changed, 183 insertions, 74 deletions
diff --git a/packages/demobank-ui/src/context/translation.ts b/packages/demobank-ui/src/context/translation.ts index 12e4eda2b..4d24d3f5a 100644 --- a/packages/demobank-ui/src/context/translation.ts +++ b/packages/demobank-ui/src/context/translation.ts @@ -14,36 +14,30 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - import { i18n, setupI18n } from "@gnu-taler/taler-util"; import { ComponentChildren, createContext, h, VNode } from "preact"; import { useContext, useEffect } from "preact/hooks"; import { hooks } from "@gnu-taler/web-util/lib/index.browser"; import { strings } from "../i18n/strings.js"; + +export type InternationalizationAPI = typeof i18n + interface Type { lang: string; supportedLang: { [id in keyof typeof supportedLang]: string }; changeLanguage: (l: string) => void; - i18n: typeof i18n; + i18n: InternationalizationAPI; isSaved: boolean; } const supportedLang = { - es: "Español [es]", - ja: "日本語 [ja]", + es: "Espanol [es]", en: "English [en]", - fr: "Français [fr]", + fr: "Francais [fr]", de: "Deutsch [de]", sv: "Svenska [sv]", - it: "Italiano [it]", - // ko: "한국어 [ko]", - // ru: "Ру́сский язы́к [ru]", - tr: "Türk [tr]", + it: "Italiane [it]", navigator: "Defined by navigator", }; diff --git a/packages/demobank-ui/src/i18n/bank.pot b/packages/demobank-ui/src/i18n/bank.pot index a89dd67d2..d02f03df8 100644 --- a/packages/demobank-ui/src/i18n/bank.pot +++ b/packages/demobank-ui/src/i18n/bank.pot @@ -82,106 +82,141 @@ msgstr "" msgid "Register" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:57 +#: src/pages/home/PaytoWireTransferForm.tsx:60 #, c-format msgid "Missing IBAN" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:59 +#: src/pages/home/PaytoWireTransferForm.tsx:62 #, c-format msgid "IBAN should have just uppercased letters and numbers" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:61 +#: src/pages/home/PaytoWireTransferForm.tsx:64 #, c-format msgid "Missing subject" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:63 +#: src/pages/home/PaytoWireTransferForm.tsx:66 #, c-format msgid "Missing amount" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:65 +#: src/pages/home/PaytoWireTransferForm.tsx:68 #, c-format msgid "Amount is not valid" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:67 +#: src/pages/home/PaytoWireTransferForm.tsx:70 #, c-format msgid "Should be greater than 0" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:76 +#: src/pages/home/PaytoWireTransferForm.tsx:79 #, c-format msgid "Receiver IBAN:" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:99 +#: src/pages/home/PaytoWireTransferForm.tsx:102 #, c-format msgid "Transfer subject:" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:120 +#: src/pages/home/PaytoWireTransferForm.tsx:123 #, c-format msgid "Amount:" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:174 +#: src/pages/home/PaytoWireTransferForm.tsx:177 #, c-format msgid "Field(s) missing." msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:223 +#: src/pages/home/PaytoWireTransferForm.tsx:227 #, c-format msgid "Want to try the raw payto://-format?" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:231 +#: src/pages/home/PaytoWireTransferForm.tsx:235 #, c-format msgid "Missing payto address" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:233 +#: src/pages/home/PaytoWireTransferForm.tsx:237 #, c-format msgid "Payto does not follow the pattern" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:239 +#: src/pages/home/PaytoWireTransferForm.tsx:243 #, c-format msgid "Transfer money to account identified by payto:// URI:" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:242 +#: src/pages/home/PaytoWireTransferForm.tsx:246 #, c-format msgid "payto URI:" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:251 +#: src/pages/home/PaytoWireTransferForm.tsx:255 #, c-format msgid "payto address" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:275 +#: src/pages/home/PaytoWireTransferForm.tsx:279 #, c-format msgid "Send" msgstr "" -#: src/pages/home/PaytoWireTransferForm.tsx:309 +#: src/pages/home/PaytoWireTransferForm.tsx:314 #, c-format msgid "Use wire-transfer form?" msgstr "" -#: src/pages/home/WalletWithdrawForm.tsx:47 +#: src/pages/home/PaytoWireTransferForm.tsx:373 +#, c-format +msgid "No credentials found." +msgstr "" + +#: src/pages/home/PaytoWireTransferForm.tsx:397 +#, c-format +msgid "Could not create the wire transfer" +msgstr "" + +#: src/pages/home/PaytoWireTransferForm.tsx:414 +#, c-format +msgid "Transfer creation gave response error" +msgstr "" + +#: src/pages/home/PaytoWireTransferForm.tsx:426 +#, c-format +msgid "Wire transfer created!" +msgstr "" + +#: src/pages/home/WalletWithdrawForm.tsx:50 #, c-format msgid "Amount to withdraw:" msgstr "" -#: src/pages/home/WalletWithdrawForm.tsx:81 +#: src/pages/home/WalletWithdrawForm.tsx:84 #, c-format msgid "Withdraw" msgstr "" +#: src/pages/home/WalletWithdrawForm.tsx:128 +#, c-format +msgid "No credentials given." +msgstr "" + +#: src/pages/home/WalletWithdrawForm.tsx:155 +#, c-format +msgid "Could not create withdrawal operation" +msgstr "" + +#: src/pages/home/WalletWithdrawForm.tsx:171 +#, c-format +msgid "Withdrawal creation gave response error" +msgstr "" + #: src/pages/home/PaymentOptions.tsx:44 #, c-format msgid "Obtain digital cash" @@ -222,48 +257,88 @@ msgstr "" msgid "Use this QR code to withdraw to your mobile wallet:" msgstr "" -#: src/pages/home/QrCodeSection.tsx:48 +#: src/pages/home/QrCodeSection.tsx:47 #, c-format -msgid "this link" +msgid "Click %1$s to open your Taler wallet!" msgstr "" -#: src/pages/home/WithdrawalConfirmationQuestion.tsx:44 +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:47 #, c-format msgid "Confirm Withdrawal" msgstr "" -#: src/pages/home/WithdrawalConfirmationQuestion.tsx:49 +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:52 #, c-format msgid "Authorize withdrawal by solving challenge" msgstr "" -#: src/pages/home/WithdrawalConfirmationQuestion.tsx:52 +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:55 #, c-format msgid "What is" msgstr "" -#: src/pages/home/WithdrawalConfirmationQuestion.tsx:90 +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:94 #, c-format msgid "Answer is wrong." msgstr "" -#: src/pages/home/WithdrawalConfirmationQuestion.tsx:95 +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:99 #, c-format msgid "Confirm" msgstr "" -#: src/pages/home/WithdrawalConfirmationQuestion.tsx:108 +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:113 #, c-format msgid "Cancel" msgstr "" -#: src/pages/home/WithdrawalConfirmationQuestion.tsx:115 +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:120 #, c-format msgid "" "A this point, a %1$s bank would ask for an additional authentication proof " "(PIN/TAN, one time password, ..), instead of a simple calculation." msgstr "" +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:155 +#, c-format +msgid "\\"No credentials found." +msgstr "" + +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:166 +#, c-format +msgid "No withdrawal ID found." +msgstr "" + +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:201 +#, c-format +msgid "Could not confirm the withdrawal" +msgstr "" + +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:219 +#, c-format +msgid "Withdrawal confirmation gave response error" +msgstr "" + +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:231 +#, c-format +msgid "Withdrawal confirmed!" +msgstr "" + +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:294 +#, c-format +msgid "Could not abort the withdrawal." +msgstr "" + +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:311 +#, c-format +msgid "Withdrawal abortion failed." +msgstr "" + +#: src/pages/home/WithdrawalConfirmationQuestion.tsx:324 +#, c-format +msgid "Withdrawal aborted!" +msgstr "" + #: src/pages/home/WithdrawalQRCode.tsx:54 #, c-format msgid "Abort" @@ -339,31 +414,46 @@ msgstr "" msgid "History of public accounts" msgstr "" -#: src/pages/home/RegistrationPage.tsx:36 +#: src/pages/home/RegistrationPage.tsx:39 #, c-format msgid "Currently, the bank is not accepting new registrations!" msgstr "" -#: src/pages/home/RegistrationPage.tsx:65 +#: src/pages/home/RegistrationPage.tsx:68 #, c-format msgid "Use only letter and numbers starting with a lower case letter" msgstr "" -#: src/pages/home/RegistrationPage.tsx:75 +#: src/pages/home/RegistrationPage.tsx:78 #, c-format msgid "Password don't match" msgstr "" -#: src/pages/home/RegistrationPage.tsx:86 +#: src/pages/home/RegistrationPage.tsx:89 #, c-format msgid "Please register!" msgstr "" -#: src/pages/home/RegistrationPage.tsx:123 +#: src/pages/home/RegistrationPage.tsx:126 #, c-format msgid "Repeat Password:" msgstr "" +#: src/pages/home/RegistrationPage.tsx:226 +#, c-format +msgid "Registration failed, please report" +msgstr "" + +#: src/pages/home/RegistrationPage.tsx:239 +#, c-format +msgid "That username is already taken" +msgstr "" + +#: src/pages/home/RegistrationPage.tsx:248 +#, c-format +msgid "New registration gave response error" +msgstr "" + #: src/components/menu/SideBar.tsx:53 #, c-format msgid "Bank menu" diff --git a/packages/demobank-ui/src/pages/home/PaytoWireTransferForm.tsx b/packages/demobank-ui/src/pages/home/PaytoWireTransferForm.tsx index 6abcebcd8..fb2ae3196 100644 --- a/packages/demobank-ui/src/pages/home/PaytoWireTransferForm.tsx +++ b/packages/demobank-ui/src/pages/home/PaytoWireTransferForm.tsx @@ -20,7 +20,10 @@ import { h, VNode } from "preact"; import { StateUpdater, useEffect, useRef, useState } from "preact/hooks"; import { useBackendContext } from "../../context/backend.js"; import { PageStateType, usePageContext } from "../../context/pageState.js"; -import { useTranslationContext } from "../../context/translation.js"; +import { + InternationalizationAPI, + useTranslationContext, +} from "../../context/translation.js"; import { BackendState } from "../../hooks/backend.js"; import { prepareHeaders, undefinedIfEmpty } from "../../utils.js"; import { ShowInputErrorLabel } from "./ShowInputErrorLabel.js"; @@ -192,6 +195,7 @@ export function PaytoWireTransferForm({ iban: undefined, subject: undefined, })), + i18n, ); }} /> @@ -291,6 +295,7 @@ export function PaytoWireTransferForm({ backend.state, pageStateSetter, () => rawPaytoInputSetter(undefined), + i18n, ); }} /> @@ -357,6 +362,7 @@ async function createTransactionCall( * a stateful management of the input data yet. */ cleanUpForm: () => void, + i18n: InternationalizationAPI, ): Promise<void> { if (backendState.status === "loggedOut") { logger.error("No credentials found."); @@ -364,7 +370,7 @@ async function createTransactionCall( ...prevState, error: { - title: "No credentials found.", + title: i18n.str`No credentials found.`, }, })); return; @@ -388,7 +394,7 @@ async function createTransactionCall( ...prevState, error: { - title: `Could not create the wire transfer`, + title: i18n.str`Could not create the wire transfer`, description: (error as any).error.description, debug: JSON.stringify(error), }, @@ -405,7 +411,7 @@ async function createTransactionCall( ...prevState, error: { - title: `Transfer creation gave response error`, + title: i18n.str`Transfer creation gave response error`, description: response.error.description, debug: JSON.stringify(response), }, @@ -417,7 +423,7 @@ async function createTransactionCall( pageStateSetter((prevState) => ({ ...prevState, - info: "Wire transfer created!", + info: i18n.str`Wire transfer created!`, })); // Only at this point the input data can diff --git a/packages/demobank-ui/src/pages/home/QrCodeSection.tsx b/packages/demobank-ui/src/pages/home/QrCodeSection.tsx index 7c262fdc6..4199ead86 100644 --- a/packages/demobank-ui/src/pages/home/QrCodeSection.tsx +++ b/packages/demobank-ui/src/pages/home/QrCodeSection.tsx @@ -44,9 +44,11 @@ export function QrCodeSection({ <p>{i18n.str`Use this QR code to withdraw to your mobile wallet:`}</p> {QR({ text: talerWithdrawUri })} <p> - Click{" "} - <a id="linkqr" href={talerWithdrawUri}>{i18n.str`this link`}</a> to - open your Taler wallet! + <i18n.Translate> + Click{" "} + <a id="linkqr" href={talerWithdrawUri}>{i18n.str`this link`}</a>{" "} + to open your Taler wallet! + </i18n.Translate> </p> <br /> {abortButton} diff --git a/packages/demobank-ui/src/pages/home/RegistrationPage.tsx b/packages/demobank-ui/src/pages/home/RegistrationPage.tsx index ecec5793c..fb7e975fb 100644 --- a/packages/demobank-ui/src/pages/home/RegistrationPage.tsx +++ b/packages/demobank-ui/src/pages/home/RegistrationPage.tsx @@ -19,7 +19,10 @@ import { route } from "preact-router"; import { StateUpdater, useState } from "preact/hooks"; import { useBackendContext } from "../../context/backend.js"; import { PageStateType, usePageContext } from "../../context/pageState.js"; -import { useTranslationContext } from "../../context/translation.js"; +import { + InternationalizationAPI, + useTranslationContext, +} from "../../context/translation.js"; import { BackendStateHandler } from "../../hooks/backend.js"; import { bankUiSettings } from "../../settings.js"; import { getBankBackendBaseUrl, undefinedIfEmpty } from "../../utils.js"; @@ -148,6 +151,7 @@ function RegistrationForm(): VNode { { username, password }, backend, // will store BE URL, if OK. pageStateSetter, + i18n, ); setUsername(undefined); @@ -193,6 +197,7 @@ async function registrationCall( */ backend: BackendStateHandler, pageStateSetter: StateUpdater<PageStateType>, + i18n: InternationalizationAPI, ): Promise<void> { const url = getBankBackendBaseUrl(); @@ -218,7 +223,7 @@ async function registrationCall( ...prevState, error: { - title: `Registration failed, please report`, + title: i18n.str`Registration failed, please report`, debug: JSON.stringify(error), }, })); @@ -231,7 +236,7 @@ async function registrationCall( ...prevState, error: { - title: `That username is already taken`, + title: i18n.str`That username is already taken`, debug: JSON.stringify(response), }, })); @@ -240,7 +245,7 @@ async function registrationCall( ...prevState, error: { - title: `New registration gave response error`, + title: i18n.str`New registration gave response error`, debug: JSON.stringify(response), }, })); diff --git a/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx b/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx index bc3880ee2..5304b6273 100644 --- a/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx +++ b/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx @@ -19,7 +19,10 @@ import { h, VNode } from "preact"; import { StateUpdater, useEffect, useRef } from "preact/hooks"; import { useBackendContext } from "../../context/backend.js"; import { PageStateType, usePageContext } from "../../context/pageState.js"; -import { useTranslationContext } from "../../context/translation.js"; +import { + InternationalizationAPI, + useTranslationContext, +} from "../../context/translation.js"; import { BackendState } from "../../hooks/backend.js"; import { prepareHeaders, validateAmount } from "../../utils.js"; @@ -91,6 +94,7 @@ export function WalletWithdrawForm({ `${currency}:${submitAmount}`, backend.state, pageStateSetter, + i18n, ); }} /> @@ -113,6 +117,7 @@ async function createWithdrawalCall( amount: string, backendState: BackendState, pageStateSetter: StateUpdater<PageStateType>, + i18n: InternationalizationAPI, ): Promise<void> { if (backendState?.status === "loggedOut") { logger.error("Page has a problem: no credentials found in the state."); @@ -120,7 +125,7 @@ async function createWithdrawalCall( ...prevState, error: { - title: "No credentials given.", + title: i18n.str`No credentials given.`, }, })); return; @@ -147,7 +152,7 @@ async function createWithdrawalCall( ...prevState, error: { - title: `Could not create withdrawal operation`, + title: i18n.str`Could not create withdrawal operation`, description: (error as any).error.description, debug: JSON.stringify(error), }, @@ -163,7 +168,7 @@ async function createWithdrawalCall( ...prevState, error: { - title: `Withdrawal creation gave response error`, + title: i18n.str`Withdrawal creation gave response error`, description: response.error.description, debug: JSON.stringify(response), }, diff --git a/packages/demobank-ui/src/pages/home/WithdrawalConfirmationQuestion.tsx b/packages/demobank-ui/src/pages/home/WithdrawalConfirmationQuestion.tsx index 26c3b22fd..ad6980f55 100644 --- a/packages/demobank-ui/src/pages/home/WithdrawalConfirmationQuestion.tsx +++ b/packages/demobank-ui/src/pages/home/WithdrawalConfirmationQuestion.tsx @@ -19,7 +19,10 @@ import { Fragment, h, VNode } from "preact"; import { StateUpdater } from "preact/hooks"; import { useBackendContext } from "../../context/backend.js"; import { PageStateType, usePageContext } from "../../context/pageState.js"; -import { useTranslationContext } from "../../context/translation.js"; +import { + InternationalizationAPI, + useTranslationContext, +} from "../../context/translation.js"; import { BackendState } from "../../hooks/backend.js"; import { prepareHeaders } from "../../utils.js"; @@ -80,6 +83,7 @@ export function WithdrawalConfirmationQuestion(): VNode { backend.state, pageState.withdrawalId, pageStateSetter, + i18n, ); return; } @@ -102,6 +106,7 @@ export function WithdrawalConfirmationQuestion(): VNode { backend.state, pageState.withdrawalId, pageStateSetter, + i18n, ) } > @@ -139,6 +144,7 @@ async function confirmWithdrawalCall( backendState: BackendState, withdrawalId: string | undefined, pageStateSetter: StateUpdater<PageStateType>, + i18n: InternationalizationAPI, ): Promise<void> { if (backendState.status === "loggedOut") { logger.error("No credentials found."); @@ -146,7 +152,7 @@ async function confirmWithdrawalCall( ...prevState, error: { - title: "No credentials found.", + title: i18n.str`"No credentials found.`, }, })); return; @@ -157,7 +163,7 @@ async function confirmWithdrawalCall( ...prevState, error: { - title: "No withdrawal ID found.", + title: i18n.str`No withdrawal ID found.`, }, })); return; @@ -192,7 +198,7 @@ async function confirmWithdrawalCall( ...prevState, error: { - title: `Could not confirm the withdrawal`, + title: i18n.str`Could not confirm the withdrawal`, description: (error as any).error.description, debug: JSON.stringify(error), }, @@ -210,7 +216,7 @@ async function confirmWithdrawalCall( ...prevState, error: { - title: `Withdrawal confirmation gave response error`, + title: i18n.str`Withdrawal confirmation gave response error`, debug: JSON.stringify(response), }, })); @@ -222,7 +228,7 @@ async function confirmWithdrawalCall( return { ...rest, - info: "Withdrawal confirmed!", + info: i18n.str`Withdrawal confirmed!`, }; }); } @@ -234,6 +240,7 @@ async function abortWithdrawalCall( backendState: BackendState, withdrawalId: string | undefined, pageStateSetter: StateUpdater<PageStateType>, + i18n: InternationalizationAPI, ): Promise<void> { if (backendState.status === "loggedOut") { logger.error("No credentials found."); @@ -241,7 +248,7 @@ async function abortWithdrawalCall( ...prevState, error: { - title: `No credentials found.`, + title: i18n.str`No credentials found.`, }, })); return; @@ -252,7 +259,7 @@ async function abortWithdrawalCall( ...prevState, error: { - title: `No withdrawal ID found.`, + title: i18n.str`No withdrawal ID found.`, }, })); return; @@ -284,7 +291,7 @@ async function abortWithdrawalCall( ...prevState, error: { - title: `Could not abort the withdrawal.`, + title: i18n.str`Could not abort the withdrawal.`, description: (error as any).error.description, debug: JSON.stringify(error), }, @@ -301,7 +308,7 @@ async function abortWithdrawalCall( ...prevState, error: { - title: `Withdrawal abortion failed.`, + title: i18n.str`Withdrawal abortion failed.`, description: response.error.description, debug: JSON.stringify(response), }, @@ -314,7 +321,7 @@ async function abortWithdrawalCall( return { ...rest, - info: "Withdrawal aborted!", + info: i18n.str`Withdrawal aborted!`, }; }); } |