From 08959f83bc9f6d5df93cb6c2d34b671bf419d05a Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 14 Mar 2022 15:20:32 -0300
Subject: take translator from transaltion context

---
 .../src/popup/DeveloperPage.tsx                    | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx')

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();
   }
-- 
cgit v1.2.3

