diff options
author | Sebastian <sebasjm@gmail.com> | 2022-03-14 15:20:32 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-03-14 15:21:24 -0300 |
commit | 08959f83bc9f6d5df93cb6c2d34b671bf419d05a (patch) | |
tree | 1a366b05453de18b598c9a587caea7ba6d1c93e7 /packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx | |
parent | 1d7c8f7083f2aa98295f1ad28399c8e19a9e7754 (diff) | |
download | wallet-core-08959f83bc9f6d5df93cb6c2d34b671bf419d05a.tar.xz |
take translator from transaltion context
Diffstat (limited to 'packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx index 228c3cdfd..3144a9ce3 100644 --- a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx +++ b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx @@ -21,7 +21,6 @@ import { ExchangeListItem, NotificationType, Translate, - i18n, } from "@gnu-taler/taler-util"; import { PendingTaskInfo } from "@gnu-taler/taler-wallet-core"; import { format } from "date-fns"; @@ -30,6 +29,7 @@ import { useRef, useState } from "preact/hooks"; import { Diagnostics } from "../components/Diagnostics"; import { NotifyUpdateFadeOut } from "../components/styled"; import { Time } from "../components/Time"; +import { useTranslationContext } from "../context/translation"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook"; import { useDiagnostics } from "../hooks/useDiagnostics"; import * as wxApi from "../wxApi"; @@ -110,6 +110,7 @@ export function View({ coins, onDownloadDatabase, }: Props): VNode { + const { i18n } = useTranslationContext(); const [downloadedDatabase, setDownloadedDatabase] = useState< { time: Date; content: string } | undefined >(undefined); @@ -153,7 +154,13 @@ export function View({ <p> <i18n.Translate>Debug tools</i18n.Translate>: </p> - <button onClick={confirmReset}> + <button + onClick={() => + confirmReset( + i18n.str`Do you want to IRREVOCABLY DESTROY everything inside your wallet and LOSE ALL YOUR COINS?`, + ) + } + > <i18n.Translate>reset</i18n.Translate> </button> <br /> @@ -262,6 +269,7 @@ function ShowAllCoins({ coins: SplitedCoinInfo; currencies: { [ex: string]: string }; }) { + const { i18n } = useTranslationContext(); const [collapsedSpent, setCollapsedSpent] = useState(true); const [collapsedUnspent, setCollapsedUnspent] = useState(false); const total = coins.usable.reduce((prev, cur) => prev + cur.denom_value, 0); @@ -372,12 +380,10 @@ export function reload(): void { function runIntegrationTest() {} -export async function confirmReset(): Promise<void> { - if ( - confirm( - i18n.str`Do you want to IRREVOCABLY DESTROY everything inside your wallet and LOSE ALL YOUR COINS?`, - ) - ) { +export async function confirmReset( + confirmTheResetMessage: string, +): Promise<void> { + if (confirm(confirmTheResetMessage)) { await wxApi.resetDb(); window.close(); } |