gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated (b9b6ac0c -> edfe5389)


From: gnunet
Subject: [taler-wallet-core] branch master updated (b9b6ac0c -> edfe5389)
Date: Tue, 08 Jun 2021 22:18:34 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a change to branch master
in repository wallet-core.

    from b9b6ac0c better label for the fields
     new 2c5612fd moving i18n into taler util
     new 2e1438eb moving logger into taler-util
     new 1d55c551 moving strings from wallet-core to web-extension
     new edfe5389 adding some translation

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-util/package.json                   |   1 +
 packages/taler-util/src/i18n.ts                    | 147 +++++++++++++++
 packages/taler-util/src/index.ts                   |   4 +-
 .../src/util => taler-util/src}/logging.ts         |   0
 packages/taler-wallet-cli/src/index.ts             |   2 +-
 .../src/crypto/workers/cryptoApi.ts                |   2 +-
 .../src/crypto/workers/cryptoImplementation.ts     |   2 +-
 .../src/crypto/workers/nodeThreadWorker.ts         |   2 +-
 packages/taler-wallet-core/src/db.ts               |   2 +-
 .../taler-wallet-core/src/headless/NodeHttpLib.ts  |   2 +-
 packages/taler-wallet-core/src/headless/helpers.ts |   2 +-
 packages/taler-wallet-core/src/i18n/index.ts       |  93 ---------
 packages/taler-wallet-core/src/index.ts            |   4 -
 .../src/operations/backup/import.ts                |   2 +-
 .../src/operations/backup/index.ts                 |   2 +-
 .../taler-wallet-core/src/operations/balance.ts    |   2 +-
 .../taler-wallet-core/src/operations/currencies.ts |   2 +-
 .../taler-wallet-core/src/operations/deposits.ts   |   2 +-
 .../taler-wallet-core/src/operations/exchanges.ts  |   2 +-
 packages/taler-wallet-core/src/operations/pay.ts   |   2 +-
 .../taler-wallet-core/src/operations/recoup.ts     |   2 +-
 .../taler-wallet-core/src/operations/refresh.ts    |   2 +-
 .../taler-wallet-core/src/operations/refund.ts     |   2 +-
 .../taler-wallet-core/src/operations/reserves.ts   |   2 +-
 packages/taler-wallet-core/src/operations/state.ts |   4 +-
 .../taler-wallet-core/src/operations/testing.ts    |   2 +-
 packages/taler-wallet-core/src/operations/tip.ts   |   2 +-
 .../taler-wallet-core/src/operations/withdraw.ts   |   2 +-
 .../taler-wallet-core/src/util/RequestThrottler.ts |   2 +-
 .../taler-wallet-core/src/util/coinSelection.ts    |   3 +-
 packages/taler-wallet-core/src/util/http.ts        |   2 +-
 packages/taler-wallet-core/src/util/query.ts       |   3 +-
 packages/taler-wallet-core/src/util/timer.ts       |   3 +-
 packages/taler-wallet-core/src/wallet.ts           |   2 +-
 .../.storybook/preview.js                          |   7 +-
 .../src/browserHttpLib.ts                          |   3 +-
 .../src/browserWorkerEntry.ts                      |   3 +-
 packages/taler-wallet-webextension/src/i18n.tsx    | 209 ---------------------
 .../src/i18n/de.po                                 |   0
 .../src/i18n/en-US.po                              |   0
 .../src/i18n/fr.po                                 |   0
 .../src/{background.ts => i18n/index.ts}           |  10 +-
 .../src/i18n/it.po                                 |   0
 .../src/i18n/poheader                              |   0
 .../src/i18n/strings-prelude                       |   0
 .../src/i18n/strings.ts                            |   0
 .../src/i18n/sv.po                                 |   0
 .../src/i18n/taler-wallet-webex.pot                |   0
 .../src/pageEntryPoint.ts                          |   5 +-
 .../taler-wallet-webextension/src/pages/pay.tsx    |  10 +-
 .../src/pages/popup.stories.tsx                    |  11 +-
 .../taler-wallet-webextension/src/pages/popup.tsx  |  16 +-
 .../src/pages/withdraw.tsx                         |  19 +-
 .../taler-wallet-webextension/tests/i18n.test.tsx  |   2 +-
 pnpm-lock.yaml                                     |   3 +-
 55 files changed, 225 insertions(+), 383 deletions(-)
 create mode 100644 packages/taler-util/src/i18n.ts
 rename packages/{taler-wallet-core/src/util => taler-util/src}/logging.ts 
(100%)
 delete mode 100644 packages/taler-wallet-core/src/i18n/index.ts
 delete mode 100644 packages/taler-wallet-webextension/src/i18n.tsx
 rename packages/{taler-wallet-core => 
taler-wallet-webextension}/src/i18n/de.po (100%)
 rename packages/{taler-wallet-core => 
taler-wallet-webextension}/src/i18n/en-US.po (100%)
 rename packages/{taler-wallet-core => 
taler-wallet-webextension}/src/i18n/fr.po (100%)
 copy packages/taler-wallet-webextension/src/{background.ts => i18n/index.ts} 
(81%)
 rename packages/{taler-wallet-core => 
taler-wallet-webextension}/src/i18n/it.po (100%)
 rename packages/{taler-wallet-core => 
taler-wallet-webextension}/src/i18n/poheader (100%)
 rename packages/{taler-wallet-core => 
taler-wallet-webextension}/src/i18n/strings-prelude (100%)
 rename packages/{taler-wallet-core => 
taler-wallet-webextension}/src/i18n/strings.ts (100%)
 rename packages/{taler-wallet-core => 
taler-wallet-webextension}/src/i18n/sv.po (100%)
 rename packages/{taler-wallet-core => 
taler-wallet-webextension}/src/i18n/taler-wallet-webex.pot (100%)

diff --git a/packages/taler-util/package.json b/packages/taler-util/package.json
index a1c769e8..977a35c6 100644
--- a/packages/taler-util/package.json
+++ b/packages/taler-util/package.json
@@ -36,6 +36,7 @@
     "typescript": "^4.2.3"
   },
   "dependencies": {
+    "jed": "^1.1.1",
     "tslib": "^2.1.0"
   },
   "ava": {
diff --git a/packages/taler-util/src/i18n.ts b/packages/taler-util/src/i18n.ts
new file mode 100644
index 00000000..4253eb22
--- /dev/null
+++ b/packages/taler-util/src/i18n.ts
@@ -0,0 +1,147 @@
+// @ts-ignore: no type decl for this library
+import * as jedLib from "jed";
+import { Logger } from "./logging";
+
+const logger = new Logger("i18n/index.ts");
+
+export let jed: any = undefined;
+
+/**
+ * Set up jed library for internationalization,
+ * based on browser language settings.
+ */
+export function setupI18n(lang: string, strings: { [s: string]: any }): any {
+  lang = lang.replace("_", "-");
+
+  if (!strings[lang]) {
+    lang = "en-US";
+    logger.warn(`language ${lang} not found, defaulting to english`);
+  }
+  debugger
+  jed = new jedLib.Jed(strings[lang]);
+}
+
+/**
+ * Use different translations for testing.  Should not be used outside
+ * of test cases.
+ */
+export function internalSetStrings(langStrings: any): void {
+  jed = new jedLib.Jed(langStrings);
+}
+
+/**
+ * Convert template strings to a msgid
+ */
+function toI18nString(stringSeq: ReadonlyArray<string>): string {
+  let s = "";
+  for (let i = 0; i < stringSeq.length; i++) {
+    s += stringSeq[i];
+    if (i < stringSeq.length - 1) {
+      s += `%${i + 1}$s`;
+    }
+  }
+  return s;
+}
+
+/**
+ * Internationalize a string template with arbitrary serialized values.
+ */
+export function str(stringSeq: TemplateStringsArray, ...values: any[]): string 
{
+  const s = toI18nString(stringSeq);
+  const tr = jed
+    .translate(s)
+    .ifPlural(1, s)
+    .fetch(...values);
+  return tr;
+}
+
+/**
+ * Internationalize a string template without serializing
+ */
+export function translate(stringSeq: TemplateStringsArray, ...values: any[]): 
any[] {
+  const s = toI18nString(stringSeq);
+  if (!s) return []
+  const translation: string = jed.ngettext(s, s, 1);
+  return replacePlaceholderWithValues(translation, values)
+}
+
+/**
+ * Internationalize a string template without serializing
+ */
+export function Translate({ children, ...rest }: { children: any }): any {
+  const c = [].concat(children);
+  const s = stringifyArray(c);
+  if (!s) return []
+  const translation: string = jed.ngettext(s, s, 1);
+  return replacePlaceholderWithValues(translation, c)
+}
+
+/**
+ * Get an internationalized string (based on the globally set, current 
language)
+ * from a JSON object.  Fall back to the default language of the JSON object
+ * if no match exists.
+ */
+export function getJsonI18n<K extends string>(
+  obj: Record<K, string>,
+  key: K,
+): string {
+  return obj[key];
+}
+
+export function getTranslatedArray(array: Array<any>) {
+  const s = stringifyArray(array);
+  const translation: string = jed.ngettext(s, s, 1);
+  return replacePlaceholderWithValues(translation, array);
+}
+
+
+function replacePlaceholderWithValues(
+  translation: string,
+  childArray: Array<any>,
+): Array<any> {
+  const tr = translation.split(/%(\d+)\$s/);
+  // const childArray = toChildArray(children);
+  // Merge consecutive string children.
+  const placeholderChildren = [];
+  for (let i = 0; i < childArray.length; i++) {
+    const x = childArray[i];
+    if (x === undefined) {
+      continue;
+    } else if (typeof x === "string") {
+      continue;
+    } else {
+      placeholderChildren.push(x);
+    }
+  }
+  const result = [];
+  for (let i = 0; i < tr.length; i++) {
+    if (i % 2 == 0) {
+      // Text
+      result.push(tr[i]);
+    } else {
+      const childIdx = Number.parseInt(tr[i]) - 1;
+      result.push(placeholderChildren[childIdx]);
+    }
+  }
+  return result;
+}
+
+function stringifyArray(children: Array<any>): string {
+  let n = 1;
+  const ss = children.map((c) => {
+    if (typeof c === "string") {
+      return c;
+    }
+    return `%${n++}$s`;
+  });
+  const s = ss.join("").replace(/ +/g, " ").trim();
+  console.log("translation lookup", JSON.stringify(s));
+  return s;
+}
+
+export const i18n = {
+  str,
+  Translate,
+  translate
+}
+
diff --git a/packages/taler-util/src/index.ts b/packages/taler-util/src/index.ts
index 3416c7d1..25a24fa1 100644
--- a/packages/taler-util/src/index.ts
+++ b/packages/taler-util/src/index.ts
@@ -16,4 +16,6 @@ export * from "./talerTypes.js";
 export * from "./taleruri.js";
 export * from "./time.js";
 export * from "./transactionsTypes.js";
-export * from "./walletTypes.js";
\ No newline at end of file
+export * from "./walletTypes.js";
+export * from "./i18n.js";
+export * from "./logging.js";
\ No newline at end of file
diff --git a/packages/taler-wallet-core/src/util/logging.ts 
b/packages/taler-util/src/logging.ts
similarity index 100%
rename from packages/taler-wallet-core/src/util/logging.ts
rename to packages/taler-util/src/logging.ts
diff --git a/packages/taler-wallet-cli/src/index.ts 
b/packages/taler-wallet-cli/src/index.ts
index db6c0a9f..93ef0cf5 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -32,9 +32,9 @@ import {
   addPaytoQueryParams,
   codecForList,
   codecForString,
+  Logger,
 } from "@gnu-taler/taler-util";
 import {
-  Logger,
   Wallet,
   NodeHttpLib,
   getDefaultNodeWallet,
diff --git a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts 
b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts
index c124b89d..a3844106 100644
--- a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts
@@ -37,7 +37,7 @@ import {
 } from "@gnu-taler/taler-util";
 
 import * as timer from "../../util/timer";
-import { Logger } from "../../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import {
   DerivedRefreshSession,
   DerivedTipPlanchet,
diff --git 
a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts 
b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
index 6e9427e5..d8c02cb1 100644
--- a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
@@ -68,7 +68,7 @@ import { randomBytes } from "../primitives/nacl-fast";
 import { kdf } from "../primitives/kdf";
 import { Timestamp, timestampTruncateToSecond } from "@gnu-taler/taler-util";
 
-import { Logger } from "../../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import {
   DerivedRefreshSession,
   DerivedTipPlanchet,
diff --git a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts 
b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts
index 66fd2de7..37b93abe 100644
--- a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts
@@ -21,7 +21,7 @@ import { CryptoWorkerFactory } from "./cryptoApi";
 import { CryptoWorker } from "./cryptoWorker";
 import os from "os";
 import { CryptoImplementation } from "./cryptoImplementation";
-import { Logger } from "../../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 
 const logger = new Logger("nodeThreadWorker.ts");
 
diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index 68741809..6de23a79 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -12,7 +12,7 @@ import {
   IDBTransaction,
   IDBKeyPath,
 } from "@gnu-taler/idb-bridge";
-import { Logger } from "./util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import {
   AmountJson,
   AmountString,
diff --git a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts 
b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
index 74672cd3..4d041108 100644
--- a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
+++ b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
@@ -29,7 +29,7 @@ import { RequestThrottler } from "../util/RequestThrottler";
 import Axios, { AxiosResponse } from "axios";
 import { OperationFailedError, makeErrorDetails } from "../operations/errors";
 import { URL } from "../util/url";
-import { Logger } from "../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { bytesToString } from "../crypto/talerCrypto";
 import { TalerErrorCode } from "@gnu-taler/taler-util";
 
diff --git a/packages/taler-wallet-core/src/headless/helpers.ts 
b/packages/taler-wallet-core/src/headless/helpers.ts
index 1ae556b3..73196492 100644
--- a/packages/taler-wallet-core/src/headless/helpers.ts
+++ b/packages/taler-wallet-core/src/headless/helpers.ts
@@ -32,7 +32,7 @@ import { openTalerDatabase } from "../db";
 import { HttpRequestLibrary } from "../util/http";
 import { NodeThreadCryptoWorkerFactory } from 
"../crypto/workers/nodeThreadWorker";
 import { NodeHttpLib } from "./NodeHttpLib";
-import { Logger } from "../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { SynchronousCryptoWorkerFactory } from 
"../crypto/workers/synchronousWorker";
 import type { IDBFactory } from "@gnu-taler/idb-bridge";
 import { WalletNotification } from "@gnu-taler/taler-util";
diff --git a/packages/taler-wallet-core/src/i18n/index.ts 
b/packages/taler-wallet-core/src/i18n/index.ts
deleted file mode 100644
index a820eaeb..00000000
--- a/packages/taler-wallet-core/src/i18n/index.ts
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- This file is part of TALER
- (C) 2016 GNUnet e.V.
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
- 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/>
- */
-
-/**
- * Translation helpers for React components and template literals.
- */
-
-/**
- * Imports.
- */
-import { strings } from "./strings";
-export { strings } from "./strings";
-
-// @ts-ignore: no type decl for this library
-import * as jedLib from "jed";
-import { Logger } from "../util/logging";
-
-const logger = new Logger("i18n/index.ts");
-
-export let jed: any = undefined;
-
-/**
- * Set up jed library for internationalization,
- * based on browser language settings.
- */
-export function setupI18n(lang: string): any {
-  lang = lang.replace("_", "-");
-
-  if (!strings[lang]) {
-    lang = "en-US";
-    logger.warn(`language ${lang} not found, defaulting to english`);
-  }
-  jed = new jedLib.Jed(strings[lang]);
-}
-
-/**
- * Use different translations for testing.  Should not be used outside
- * of test cases.
- */
-export function internalSetStrings(langStrings: any): void {
-  jed = new jedLib.Jed(langStrings);
-}
-
-/**
- * Convert template strings to a msgid
- */
-function toI18nString(stringSeq: ReadonlyArray<string>): string {
-  let s = "";
-  for (let i = 0; i < stringSeq.length; i++) {
-    s += stringSeq[i];
-    if (i < stringSeq.length - 1) {
-      s += `%${i + 1}$s`;
-    }
-  }
-  return s;
-}
-
-/**
- * Internationalize a string template with arbitrary serialized values.
- */
-export function str(stringSeq: TemplateStringsArray, ...values: any[]): string 
{
-  const s = toI18nString(stringSeq);
-  const tr = jed
-    .translate(s)
-    .ifPlural(1, s)
-    .fetch(...values);
-  return tr;
-}
-
-/**
- * Get an internationalized string (based on the globally set, current 
language)
- * from a JSON object.  Fall back to the default language of the JSON object
- * if no match exists.
- */
-export function getJsonI18n<K extends string>(
-  obj: Record<K, string>,
-  key: K,
-): string {
-  return obj[key];
-}
diff --git a/packages/taler-wallet-core/src/index.ts 
b/packages/taler-wallet-core/src/index.ts
index 26701256..459c4c07 100644
--- a/packages/taler-wallet-core/src/index.ts
+++ b/packages/taler-wallet-core/src/index.ts
@@ -22,7 +22,6 @@
 export * from "./operations/errors";
 
 // Util functionality
-export { Logger } from "./util/logging";
 export { URL } from "./util/url";
 export * from "./util/promiseUtils";
 export * from "./util/query";
@@ -39,9 +38,6 @@ export * from "./operations/versions";
 
 export * from "./db";
 
-// Internationalization
-export * from "./i18n";
-
 // Crypto and crypto workers
 export * from "./crypto/workers/nodeThreadWorker";
 export { CryptoImplementation } from "./crypto/workers/cryptoImplementation";
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts 
b/packages/taler-wallet-core/src/operations/backup/import.ts
index f0a944a2..74b7a3b5 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -51,7 +51,7 @@ import { TransactionHandle } from "../../index.js";
 import { PayCoinSelection } from "../../util/coinSelection";
 import { j2s } from "@gnu-taler/taler-util";
 import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants";
-import { Logger } from "../../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { initRetryInfo } from "../../util/retries";
 import { InternalWalletState } from "../state";
 import { provideBackupState } from "./state";
diff --git a/packages/taler-wallet-core/src/operations/backup/index.ts 
b/packages/taler-wallet-core/src/operations/backup/index.ts
index 2314c730..74331479 100644
--- a/packages/taler-wallet-core/src/operations/backup/index.ts
+++ b/packages/taler-wallet-core/src/operations/backup/index.ts
@@ -70,7 +70,7 @@ import {
   readSuccessResponseJsonOrThrow,
   readTalerErrorResponse,
 } from "../../util/http";
-import { Logger } from "../../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { gunzipSync, gzipSync } from "fflate";
 import { kdf } from "../../crypto/primitives/kdf";
 import { initRetryInfo } from "../../util/retries";
diff --git a/packages/taler-wallet-core/src/operations/balance.ts 
b/packages/taler-wallet-core/src/operations/balance.ts
index 741c46eb..afa561bf 100644
--- a/packages/taler-wallet-core/src/operations/balance.ts
+++ b/packages/taler-wallet-core/src/operations/balance.ts
@@ -20,7 +20,7 @@
 import { AmountJson, BalancesResponse, Amounts } from "@gnu-taler/taler-util";
 import { Stores, CoinStatus } from "../db.js";
 import { TransactionHandle } from "../index.js";
-import { Logger } from "../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { InternalWalletState } from "./state.js";
 
 const logger = new Logger("withdraw.ts");
diff --git a/packages/taler-wallet-core/src/operations/currencies.ts 
b/packages/taler-wallet-core/src/operations/currencies.ts
index 8fd5c62c..cead07a6 100644
--- a/packages/taler-wallet-core/src/operations/currencies.ts
+++ b/packages/taler-wallet-core/src/operations/currencies.ts
@@ -18,7 +18,7 @@
  * Imports.
  */
 import { ExchangeRecord, Stores } from "../db.js";
-import { Logger } from "../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { getExchangeDetails } from "./exchanges.js";
 import { InternalWalletState } from "./state.js";
 
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts 
b/packages/taler-wallet-core/src/operations/deposits.ts
index 59c27b9c..408ad392 100644
--- a/packages/taler-wallet-core/src/operations/deposits.ts
+++ b/packages/taler-wallet-core/src/operations/deposits.ts
@@ -55,7 +55,7 @@ import {
   getTotalPaymentCost,
 } from "./pay";
 import { InternalWalletState } from "./state";
-import { Logger } from "../util/logging.js";
+import { Logger } from "@gnu-taler/taler-util";
 import { DepositGroupRecord, Stores } from "../db.js";
 import { guardOperationException } from "./errors.js";
 import { getExchangeDetails } from "./exchanges.js";
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts 
b/packages/taler-wallet-core/src/operations/exchanges.ts
index be9a383d..e48d1299 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -30,6 +30,7 @@ import {
   ExchangeWireJson,
   getTimestampNow,
   isTimestampExpired,
+  Logger,
   NotificationType,
   parsePaytoUri,
   Recoup,
@@ -49,7 +50,6 @@ import {
   WireInfo,
 } from "../db.js";
 import {
-  Logger,
   URL,
   readSuccessResponseJsonOrThrow,
   getExpiryTimestamp,
diff --git a/packages/taler-wallet-core/src/operations/pay.ts 
b/packages/taler-wallet-core/src/operations/pay.ts
index dad460b8..0b1b30f6 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -50,6 +50,7 @@ import {
   PreparePayResult,
   PreparePayResultType,
   parsePayUri,
+  Logger,
 } from "@gnu-taler/taler-util";
 import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
 import {
@@ -62,7 +63,6 @@ import {
   getHttpResponseErrorDetails,
   guardOperationException,
   HttpResponseStatus,
-  Logger,
   makeErrorDetails,
   OperationFailedAndReportedError,
   OperationFailedError,
diff --git a/packages/taler-wallet-core/src/operations/recoup.ts 
b/packages/taler-wallet-core/src/operations/recoup.ts
index aa551e8d..da01ca82 100644
--- a/packages/taler-wallet-core/src/operations/recoup.ts
+++ b/packages/taler-wallet-core/src/operations/recoup.ts
@@ -45,7 +45,7 @@ import {
 } from "../db.js";
 
 import { readSuccessResponseJsonOrThrow } from "../util/http";
-import { Logger } from "../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { TransactionHandle } from "../util/query";
 import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
 import { URL } from "../util/url";
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts 
b/packages/taler-wallet-core/src/operations/refresh.ts
index 9d4390ab..6f4c9725 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -37,7 +37,7 @@ import { AmountJson, Amounts } from "@gnu-taler/taler-util";
 import { amountToPretty } from "@gnu-taler/taler-util";
 import { readSuccessResponseJsonOrThrow } from "../util/http";
 import { checkDbInvariant } from "../util/invariants";
-import { Logger } from "../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { TransactionHandle } from "../util/query";
 import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
 import {
diff --git a/packages/taler-wallet-core/src/operations/refund.ts 
b/packages/taler-wallet-core/src/operations/refund.ts
index b9341e57..2e2ab780 100644
--- a/packages/taler-wallet-core/src/operations/refund.ts
+++ b/packages/taler-wallet-core/src/operations/refund.ts
@@ -46,7 +46,7 @@ import {
   parseRefundUri,
   RefreshReason,
 } from "@gnu-taler/taler-util";
-import { Logger } from "../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { readSuccessResponseJsonOrThrow } from "../util/http";
 import { TransactionHandle } from "../util/query";
 import { URL } from "../util/url";
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts 
b/packages/taler-wallet-core/src/operations/reserves.ts
index 885865af..a2482db7 100644
--- a/packages/taler-wallet-core/src/operations/reserves.ts
+++ b/packages/taler-wallet-core/src/operations/reserves.ts
@@ -64,7 +64,7 @@ import {
 } from "./withdraw.js";
 import { getExchangeTrust } from "./currencies.js";
 import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto.js";
-import { Logger } from "../util/logging.js";
+import { Logger } from "@gnu-taler/taler-util";
 import { readSuccessResponseJsonOrErrorCode, readSuccessResponseJsonOrThrow, 
throwUnexpectedRequestError } from "../util/http.js";
 import { URL } from "../util/url.js";
 import { TransactionHandle } from "../util/query.js";
diff --git a/packages/taler-wallet-core/src/operations/state.ts 
b/packages/taler-wallet-core/src/operations/state.ts
index 752a57ff..0d07f293 100644
--- a/packages/taler-wallet-core/src/operations/state.ts
+++ b/packages/taler-wallet-core/src/operations/state.ts
@@ -17,9 +17,9 @@
 /**
  * Imports.
  */
-import { WalletNotification, BalancesResponse } from "@gnu-taler/taler-util";
+import { WalletNotification, BalancesResponse, Logger } from 
"@gnu-taler/taler-util";
 import { Stores } from "../db.js";
-import { Logger, CryptoApi, OpenedPromise, Database, CryptoWorkerFactory, 
openPromise } from "../index.js";
+import { CryptoApi, OpenedPromise, Database, CryptoWorkerFactory, openPromise 
} from "../index.js";
 import { PendingOperationsResponse } from "../pending-types.js";
 import { AsyncOpMemoMap, AsyncOpMemoSingle } from "../util/asyncMemo.js";
 import { HttpRequestLibrary } from "../util/http";
diff --git a/packages/taler-wallet-core/src/operations/testing.ts 
b/packages/taler-wallet-core/src/operations/testing.ts
index aa9afc50..6875a308 100644
--- a/packages/taler-wallet-core/src/operations/testing.ts
+++ b/packages/taler-wallet-core/src/operations/testing.ts
@@ -17,7 +17,7 @@
 /**
  * Imports.
  */
-import { Logger } from "../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import {
   HttpRequestLibrary,
   readSuccessResponseJsonOrThrow,
diff --git a/packages/taler-wallet-core/src/operations/tip.ts 
b/packages/taler-wallet-core/src/operations/tip.ts
index 6de11609..f9d7a024 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -28,6 +28,7 @@ import {
   TipPlanchetDetail,
   TalerErrorCode,
   codecForTipResponse,
+  Logger,
 } from "@gnu-taler/taler-util";
 import { DerivedTipPlanchet } from "../crypto/cryptoTypes.js";
 import {
@@ -38,7 +39,6 @@ import {
   CoinStatus,
 } from "../db.js";
 import {
-  Logger,
   URL,
   readSuccessResponseJsonOrThrow,
   encodeCrock,
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts 
b/packages/taler-wallet-core/src/operations/withdraw.ts
index 5f050620..36be84df 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -50,7 +50,7 @@ import {
   codecForTalerConfigResponse,
 } from "@gnu-taler/taler-util";
 import { InternalWalletState } from "./state";
-import { Logger } from "../util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { getExchangeDetails, updateExchangeFromUrl } from "./exchanges";
 import {
   WALLET_EXCHANGE_PROTOCOL_VERSION,
diff --git a/packages/taler-wallet-core/src/util/RequestThrottler.ts 
b/packages/taler-wallet-core/src/util/RequestThrottler.ts
index b38e948f..66a89575 100644
--- a/packages/taler-wallet-core/src/util/RequestThrottler.ts
+++ b/packages/taler-wallet-core/src/util/RequestThrottler.ts
@@ -25,9 +25,9 @@ import {
   getTimestampNow,
   timestampDifference,
   timestampCmp,
+  Logger,
 } from "@gnu-taler/taler-util";
 import { URL } from "./url";
-import { Logger } from "./logging";
 
 const logger = new Logger("RequestThrottler.ts");
 
diff --git a/packages/taler-wallet-core/src/util/coinSelection.ts 
b/packages/taler-wallet-core/src/util/coinSelection.ts
index c5a75878..bd90526a 100644
--- a/packages/taler-wallet-core/src/util/coinSelection.ts
+++ b/packages/taler-wallet-core/src/util/coinSelection.ts
@@ -24,8 +24,7 @@
  * Imports.
  */
 import { AmountJson, AmountLike, Amounts } from "@gnu-taler/taler-util";
-import { strcmp } from "@gnu-taler/taler-util";
-import { Logger } from "./logging.js";
+import { strcmp, Logger } from "@gnu-taler/taler-util";
 
 const logger = new Logger("coinSelection.ts");
 
diff --git a/packages/taler-wallet-core/src/util/http.ts 
b/packages/taler-wallet-core/src/util/http.ts
index ee6ff80a..649105f2 100644
--- a/packages/taler-wallet-core/src/util/http.ts
+++ b/packages/taler-wallet-core/src/util/http.ts
@@ -25,8 +25,8 @@
  * Imports
  */
 import { OperationFailedError, makeErrorDetails } from "../operations/errors";
-import { Logger } from "./logging";
 import {
+  Logger,
   Duration,
   Timestamp,
   getTimestampNow,
diff --git a/packages/taler-wallet-core/src/util/query.ts 
b/packages/taler-wallet-core/src/util/query.ts
index 7c2aea78..6a3db44d 100644
--- a/packages/taler-wallet-core/src/util/query.ts
+++ b/packages/taler-wallet-core/src/util/query.ts
@@ -33,9 +33,8 @@ import {
   IDBVersionChangeEvent,
   Event,
   IDBCursor,
-  IDBKeyPath,
 } from "@gnu-taler/idb-bridge";
-import { Logger } from "./logging";
+import { Logger } from "@gnu-taler/taler-util";
 
 const logger = new Logger("query.ts");
 
diff --git a/packages/taler-wallet-core/src/util/timer.ts 
b/packages/taler-wallet-core/src/util/timer.ts
index 9133bd57..a7fe7dd7 100644
--- a/packages/taler-wallet-core/src/util/timer.ts
+++ b/packages/taler-wallet-core/src/util/timer.ts
@@ -24,8 +24,7 @@
 /**
  * Imports.
  */
-import { Duration } from "@gnu-taler/taler-util";
-import { Logger } from "./logging";
+import { Logger, Duration } from "@gnu-taler/taler-util";
 
 const logger = new Logger("timer.ts");
 
diff --git a/packages/taler-wallet-core/src/wallet.ts 
b/packages/taler-wallet-core/src/wallet.ts
index d968fea4..0bb7bc97 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -177,7 +177,7 @@ import { AmountJson, Amounts } from "@gnu-taler/taler-util";
 import { assertUnreachable } from "./util/assertUnreachable";
 import { AsyncOpMemoSingle } from "./util/asyncMemo";
 import { HttpRequestLibrary } from "./util/http";
-import { Logger } from "./util/logging";
+import { Logger } from "@gnu-taler/taler-util";
 import { AsyncCondition } from "./util/promiseUtils";
 import { Database } from "./util/query";
 import { Duration, durationMin } from "@gnu-taler/taler-util";
diff --git a/packages/taler-wallet-webextension/.storybook/preview.js 
b/packages/taler-wallet-webextension/.storybook/preview.js
index c5740261..e669398d 100644
--- a/packages/taler-wallet-webextension/.storybook/preview.js
+++ b/packages/taler-wallet-webextension/.storybook/preview.js
@@ -14,7 +14,8 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-import * as core from "@gnu-taler/taler-wallet-core";
+import { setupI18n } from "@gnu-taler/taler-util"
+import { strings } from '../src/i18n'
 
 const mockConfig = {
   backendURL: 'http://demo.taler.net',
@@ -45,8 +46,8 @@ export const globalTypes = {
 
 export const decorators = [
   (Story, { globals }) => {
-    core.setupI18n(globals.locale);
+    setupI18n(globals.locale, strings);
     return <Story />
   },
-//   (Story) => <ConfigContextProvider value={mockConfig}> <Story /> 
</ConfigContextProvider>
+  //   (Story) => <ConfigContextProvider value={mockConfig}> <Story /> 
</ConfigContextProvider>
 ];
diff --git a/packages/taler-wallet-webextension/src/browserHttpLib.ts 
b/packages/taler-wallet-webextension/src/browserHttpLib.ts
index fe12289d..63fd456f 100644
--- a/packages/taler-wallet-webextension/src/browserHttpLib.ts
+++ b/packages/taler-wallet-webextension/src/browserHttpLib.ts
@@ -19,13 +19,12 @@
  */
 import {
   OperationFailedError,
-  Logger,
   HttpRequestLibrary,
   HttpRequestOptions,
   HttpResponse,
   Headers,
 } from "@gnu-taler/taler-wallet-core";
-import { TalerErrorCode } from "@gnu-taler/taler-util";
+import { Logger, TalerErrorCode } from "@gnu-taler/taler-util";
 
 const logger = new Logger("browserHttpLib");
 
diff --git a/packages/taler-wallet-webextension/src/browserWorkerEntry.ts 
b/packages/taler-wallet-webextension/src/browserWorkerEntry.ts
index 8ab22e23..d8dff72f 100644
--- a/packages/taler-wallet-webextension/src/browserWorkerEntry.ts
+++ b/packages/taler-wallet-webextension/src/browserWorkerEntry.ts
@@ -22,7 +22,8 @@
  * Imports.
  */
 
-import { CryptoImplementation, Logger } from "@gnu-taler/taler-wallet-core";
+import { Logger } from "@gnu-taler/taler-util";
+import { CryptoImplementation } from "@gnu-taler/taler-wallet-core";
 
 const logger = new Logger("browserWorkerEntry.ts");
 
diff --git a/packages/taler-wallet-webextension/src/i18n.tsx 
b/packages/taler-wallet-webextension/src/i18n.tsx
deleted file mode 100644
index 4d5f8341..00000000
--- a/packages/taler-wallet-webextension/src/i18n.tsx
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- This file is part of TALER
- (C) 2016 GNUnet e.V.
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
- 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/>
- */
-
-/**
- * Translation helpers for React components and template literals.
- */
-
-/**
- * Imports
- */
-
-import * as i18nCore from "@gnu-taler/taler-wallet-core";
-import { Component, ComponentChildren, h, JSX, toChildArray, VNode } from 
"preact";
-/**
- * Convert template strings to a msgid
- */
-function toI18nString(stringSeq: ReadonlyArray<string>): string {
-  let s = "";
-  for (let i = 0; i < stringSeq.length; i++) {
-    s += stringSeq[i];
-    if (i < stringSeq.length - 1) {
-      s += `%${i + 1}$s`;
-    }
-  }
-  return s;
-}
-
-
-export const str = i18nCore.str;
-export const internalSetStrings = i18nCore.internalSetStrings;
-export const strings = i18nCore.strings;
-
-
-interface TranslateSwitchProps {
-  target: number;
-}
-
-function stringifyChildren(children: any): string {
-  let n = 1;
-  const ss = toChildArray(children).map((c) => {
-    if (typeof c === "string") {
-      return c;
-    }
-    return `%${n++}$s`;
-  });
-  const s = ss.join("").replace(/ +/g, " ").trim();
-  console.log("translation lookup", JSON.stringify(s));
-  return s;
-}
-
-interface TranslateProps {
-  /**
-   * Component that the translated element should be wrapped in.
-   * Defaults to "div".
-   */
-  wrap?: any;
-
-  /**
-   * Props to give to the wrapped component.
-   */
-  wrapProps?: any;
-
-  /**
-   * Translated elements
-   */
-  children: ComponentChildren;
-}
-
-function getTranslatedChildren(
-  translation: string,
-  children: ComponentChildren,
-): ComponentChildren {
-  const tr = translation.split(/%(\d+)\$s/);
-  const childArray = toChildArray(children);
-  // Merge consecutive string children.
-  const placeholderChildren = [];
-  for (let i = 0; i < childArray.length; i++) {
-    const x = childArray[i];
-    if (x === undefined) {
-      continue;
-    } else if (typeof x === "string") {
-      continue;
-    } else {
-      placeholderChildren.push(x);
-    }
-  }
-  const result = [];
-  for (let i = 0; i < tr.length; i++) {
-    if (i % 2 == 0) {
-      // Text
-      result.push(tr[i]);
-    } else {
-      const childIdx = Number.parseInt(tr[i]) - 1;
-      result.push(placeholderChildren[childIdx]);
-    }
-  }
-  return result;
-}
-
-/**
- * Translate text node children of this component.
- * If a child component might produce a text node, it must be wrapped
- * in a another non-text element.
- *
- * Example:
- * ```
- * <Translate>
- * Hello.  Your score is <span><PlayerScore player={player} /></span>
- * </Translate>
- * ```
- */
-export function Translate({children, wrap, wrapProps}: TranslateProps): VNode {
-    const s = stringifyChildren(children);
-    const translation: string = i18nCore.jed.ngettext(s, s, 1);
-    const result = getTranslatedChildren(translation, children);
-    if (!wrap) {
-      return <div>{result}</div>;
-    }
-    return h(wrap, wrapProps, result);
-}
-
-/**
- * Switch translation based on singular or plural based on the target prop.
- * Should only contain TranslateSingular and TransplatePlural as children.
- *
- * Example:
- * ```
- * <TranslateSwitch target={n}>
- *  <TranslateSingular>I have {n} apple.</TranslateSingular>
- *  <TranslatePlural>I have {n} apples.</TranslatePlural>
- * </TranslateSwitch>
- * ```
- */
-export class TranslateSwitch extends Component<
-  TranslateSwitchProps,
-  void
-> {
-  render(): JSX.Element {
-    let singular: VNode<TranslationPluralProps> | undefined;
-    let plural: VNode<TranslationPluralProps> | undefined;
-    const children = this.props.children;
-    if (children) {
-      toChildArray(children).forEach((child: any) => {
-        if (child.type === TranslatePlural) {
-          plural = child;
-        }
-        if (child.type === TranslateSingular) {
-          singular = child;
-        }
-      });
-    }
-    if (!singular || !plural) {
-      console.error("translation not found");
-      return h("span", {}, ["translation not found"]);
-    }
-    singular.props.target = this.props.target;
-    plural.props.target = this.props.target;
-    // We're looking up the translation based on the
-    // singular, even if we must use the plural form.
-    return singular;
-  }
-}
-
-interface TranslationPluralProps {
-  target: number;
-}
-
-/**
- * See [[TranslateSwitch]].
- */
-export class TranslatePlural extends Component<
-  TranslationPluralProps,
-  void
-> {
-  render(): JSX.Element {
-    const s = stringifyChildren(this.props.children);
-    const translation = i18nCore.jed.ngettext(s, s, 1);
-    const result = getTranslatedChildren(translation, this.props.children);
-    return <div>{result}</div>;
-  }
-}
-
-/**
- * See [[TranslateSwitch]].
- */
-export class TranslateSingular extends Component<
-  TranslationPluralProps,
-  void
-> {
-  render(): JSX.Element {
-    const s = stringifyChildren(this.props.children);
-    const translation = i18nCore.jed.ngettext(s, s, this.props.target);
-    const result = getTranslatedChildren(translation, this.props.children);
-    return <div>{result}</div>;
-  }
-}
diff --git a/packages/taler-wallet-core/src/i18n/de.po 
b/packages/taler-wallet-webextension/src/i18n/de.po
similarity index 100%
rename from packages/taler-wallet-core/src/i18n/de.po
rename to packages/taler-wallet-webextension/src/i18n/de.po
diff --git a/packages/taler-wallet-core/src/i18n/en-US.po 
b/packages/taler-wallet-webextension/src/i18n/en-US.po
similarity index 100%
rename from packages/taler-wallet-core/src/i18n/en-US.po
rename to packages/taler-wallet-webextension/src/i18n/en-US.po
diff --git a/packages/taler-wallet-core/src/i18n/fr.po 
b/packages/taler-wallet-webextension/src/i18n/fr.po
similarity index 100%
rename from packages/taler-wallet-core/src/i18n/fr.po
rename to packages/taler-wallet-webextension/src/i18n/fr.po
diff --git a/packages/taler-wallet-webextension/src/background.ts 
b/packages/taler-wallet-webextension/src/i18n/index.ts
similarity index 81%
copy from packages/taler-wallet-webextension/src/background.ts
copy to packages/taler-wallet-webextension/src/i18n/index.ts
index dbc540df..abfc8b92 100644
--- a/packages/taler-wallet-webextension/src/background.ts
+++ b/packages/taler-wallet-webextension/src/i18n/index.ts
@@ -15,16 +15,10 @@
  */
 
 /**
- * Entry point for the background page.
- *
- * @author Florian Dold
+ * Translation helpers for React components and template literals.
  */
 
 /**
  * Imports.
  */
-import { wxMain } from "./wxBackend";
-
-window.addEventListener("load", () => {
-  wxMain();
-});
+export { strings } from "./strings";
diff --git a/packages/taler-wallet-core/src/i18n/it.po 
b/packages/taler-wallet-webextension/src/i18n/it.po
similarity index 100%
rename from packages/taler-wallet-core/src/i18n/it.po
rename to packages/taler-wallet-webextension/src/i18n/it.po
diff --git a/packages/taler-wallet-core/src/i18n/poheader 
b/packages/taler-wallet-webextension/src/i18n/poheader
similarity index 100%
rename from packages/taler-wallet-core/src/i18n/poheader
rename to packages/taler-wallet-webextension/src/i18n/poheader
diff --git a/packages/taler-wallet-core/src/i18n/strings-prelude 
b/packages/taler-wallet-webextension/src/i18n/strings-prelude
similarity index 100%
rename from packages/taler-wallet-core/src/i18n/strings-prelude
rename to packages/taler-wallet-webextension/src/i18n/strings-prelude
diff --git a/packages/taler-wallet-core/src/i18n/strings.ts 
b/packages/taler-wallet-webextension/src/i18n/strings.ts
similarity index 100%
rename from packages/taler-wallet-core/src/i18n/strings.ts
rename to packages/taler-wallet-webextension/src/i18n/strings.ts
diff --git a/packages/taler-wallet-core/src/i18n/sv.po 
b/packages/taler-wallet-webextension/src/i18n/sv.po
similarity index 100%
rename from packages/taler-wallet-core/src/i18n/sv.po
rename to packages/taler-wallet-webextension/src/i18n/sv.po
diff --git a/packages/taler-wallet-core/src/i18n/taler-wallet-webex.pot 
b/packages/taler-wallet-webextension/src/i18n/taler-wallet-webex.pot
similarity index 100%
rename from packages/taler-wallet-core/src/i18n/taler-wallet-webex.pot
rename to packages/taler-wallet-webextension/src/i18n/taler-wallet-webex.pot
diff --git a/packages/taler-wallet-webextension/src/pageEntryPoint.ts 
b/packages/taler-wallet-webextension/src/pageEntryPoint.ts
index 00fd5fc7..960b1995 100644
--- a/packages/taler-wallet-webextension/src/pageEntryPoint.ts
+++ b/packages/taler-wallet-webextension/src/pageEntryPoint.ts
@@ -21,7 +21,8 @@
  */
 
 import { render } from "preact";
-import { setupI18n } from "@gnu-taler/taler-wallet-core";
+import { setupI18n } from "@gnu-taler/taler-util";
+import { strings } from "./i18n"
 import { Application } from './Application';
 
 function main(): void {
@@ -37,7 +38,7 @@ function main(): void {
   }
 }
 
-setupI18n("en-US");
+setupI18n("en-US", strings);
 
 if (document.readyState === "loading") {
   document.addEventListener("DOMContentLoaded", main);
diff --git a/packages/taler-wallet-webextension/src/pages/pay.tsx 
b/packages/taler-wallet-webextension/src/pages/pay.tsx
index fd8b0f3a..e958cd48 100644
--- a/packages/taler-wallet-webextension/src/pages/pay.tsx
+++ b/packages/taler-wallet-webextension/src/pages/pay.tsx
@@ -22,14 +22,14 @@
 /**
  * Imports.
  */
-import * as i18n from "../i18n";
+// import * as i18n from "../i18n";
 
 import { renderAmount, ProgressButton } from "../renderHtml";
 import * as wxApi from "../wxApi";
 
 import { useState, useEffect } from "preact/hooks";
 
-import { getJsonI18n } from "@gnu-taler/taler-wallet-core";
+import { getJsonI18n, i18n } from "@gnu-taler/taler-util";
 import {
   PreparePayResult,
   ConfirmPayResult,
@@ -171,19 +171,19 @@ export function TalerPayDialog({ talerPayUri }: Props): 
JSX.Element {
   return (
     <div>
       <p>
-        <i18n.Translate wrap="p">
+        <i18n.Translate>
           The merchant <span>{merchantName}</span> offers you to purchase:
         </i18n.Translate>
         <div style={{ textAlign: "center" }}>
           <strong>{contractTerms.summary}</strong>
         </div>
         {totalFees ? (
-          <i18n.Translate wrap="p">
+          <i18n.Translate>
             The total price is <span>{amount} </span>
             (plus <span>{renderAmount(totalFees)}</span> fees).
           </i18n.Translate>
         ) : (
-          <i18n.Translate wrap="p">
+          <i18n.Translate>
             The total price is <span>{amount}</span>.
           </i18n.Translate>
         )}
diff --git a/packages/taler-wallet-webextension/src/pages/popup.stories.tsx 
b/packages/taler-wallet-webextension/src/pages/popup.stories.tsx
index 1aec771a..0cb51a33 100644
--- a/packages/taler-wallet-webextension/src/pages/popup.stories.tsx
+++ b/packages/taler-wallet-webextension/src/pages/popup.stories.tsx
@@ -19,8 +19,13 @@
 * @author Sebastian Javier Marchano (sebasjm)
 */
 
-import { PaymentStatus, TransactionPayment, TransactionType, 
TransactionWithdrawal, TransactionDeposit, TransactionRefresh, TransactionTip, 
TransactionRefund, WithdrawalType, TransactionCommon } from 
'@gnu-taler/taler-util';
-import { Fragment, h } from 'preact';
+import {
+  PaymentStatus,
+  TransactionCommon, TransactionDeposit, TransactionPayment,
+  TransactionRefresh, TransactionRefund, TransactionTip, TransactionType,
+  TransactionWithdrawal,
+  WithdrawalType
+} from '@gnu-taler/taler-util';
 import { WalletTransactionView as Component } from './popup';
 
 export default {
@@ -174,7 +179,7 @@ export const Refund = dynamic({
 });
 
 export const RefundPending = dynamic({
-  transaction: { ...exampleData.refund , pending: true }
+  transaction: { ...exampleData.refund, pending: true }
 });
 
 export const RefundWithProducts = dynamic({
diff --git a/packages/taler-wallet-webextension/src/pages/popup.tsx 
b/packages/taler-wallet-webextension/src/pages/popup.tsx
index 5fb08b77..d6c03e07 100644
--- a/packages/taler-wallet-webextension/src/pages/popup.tsx
+++ b/packages/taler-wallet-webextension/src/pages/popup.tsx
@@ -37,13 +37,13 @@ import {
   AmountString,
   Timestamp,
   amountFractionalBase,
+  i18n,
 } from "@gnu-taler/taler-util";
 import { format } from "date-fns";
 import { Component, ComponentChildren, Fragment, JSX } from "preact";
 import { route, Route, Router } from 'preact-router';
 import { Match } from 'preact-router/match';
 import { useEffect, useState } from "preact/hooks";
-import * as i18n from "../i18n";
 import { PageLink, renderAmount } from "../renderHtml";
 import * as wxApi from "../wxApi";
 import { PermissionsCheckbox, useExtendedPermissions, Diagnostics } from 
"./welcome";
@@ -92,10 +92,10 @@ function bigAmount(amount: AmountJson): JSX.Element {
 
 function EmptyBalanceView(): JSX.Element {
   return (
-    <i18n.Translate wrap="p">
+    <p><i18n.Translate>
       You have no balance to show. Need some{" "}
       <PageLink pageName="/welcome">help</PageLink> getting started?
-    </i18n.Translate>
+    </i18n.Translate></p>
   );
 }
 
@@ -166,13 +166,13 @@ class WalletBalanceView extends Component<any, any> {
 
     if (!Amounts.isZero(pendingIncoming)) {
       incoming = (
-        <i18n.Translate wrap="span">
+        <span><i18n.Translate>
           <span style={{ color: "darkgreen" }}>
             {"+"}
             {renderAmount(entry.pendingIncoming)}
           </span>{" "}
           incoming
-        </i18n.Translate>
+        </i18n.Translate></span>
       );
     }
 
@@ -436,14 +436,14 @@ interface WalletTransactionProps {
 
 export function WalletTransactionView({ transaction, onDelete, onBack }: 
WalletTransactionProps) {
   if (!transaction) {
-    return <div>Loading ...</div>;
+    return <div><i18n.Translate>Loading ...</i18n.Translate></div>;
   }
 
   function Footer() {
     return <footer style={{ marginTop: 'auto', display: 'flex' }}>
-      <button onClick={onBack}>back</button>
+      <button onClick={onBack}><i18n.Translate>back</i18n.Translate></button>
       <div style={{ width: '100%', flexDirection: 'row', justifyContent: 
'flex-end', display: 'flex' }}>
-        <button onClick={onDelete}>remove</button>
+        <button 
onClick={onDelete}><i18n.Translate>remove</i18n.Translate></button>
 
       </div>
 
diff --git a/packages/taler-wallet-webextension/src/pages/withdraw.tsx 
b/packages/taler-wallet-webextension/src/pages/withdraw.tsx
index 7b6a06d2..e0b7ccdc 100644
--- a/packages/taler-wallet-webextension/src/pages/withdraw.tsx
+++ b/packages/taler-wallet-webextension/src/pages/withdraw.tsx
@@ -21,8 +21,7 @@
  * @author Florian Dold
  */
 
-import * as i18n from "../i18n";
-
+import { i18n } from '@gnu-taler/taler-util'
 import { renderAmount } from "../renderHtml";
 
 import { useState, useEffect } from "preact/hooks";
@@ -50,30 +49,30 @@ export interface ViewProps {
 
 export function View({ talerWithdrawUri, details, cancelled, selectedExchange, 
accept, setCancelled, setSelecting }: ViewProps) {
   if (!talerWithdrawUri) {
-    return <span>missing withdraw uri</span>;
+    return <span><i18n.Translate>missing withdraw uri</i18n.Translate></span>;
   }
 
   if (!details) {
-    return <span>Loading...</span>;
+    return <span><i18n.Translate>Loading...</i18n.Translate></span>;
   }
 
   if (cancelled) {
-    return <span>Withdraw operation has been cancelled.</span>;
+    return <span><i18n.Translate>Withdraw operation has been 
cancelled.</i18n.Translate></span>;
   }
 
   return (
     <div>
-      <h1>Digital Cash Withdrawal</h1>
-      <i18n.Translate wrap="p">
+      <h1><i18n.Translate>Digital Cash Withdrawal</i18n.Translate></h1>
+      <p><i18n.Translate>
         You are about to withdraw{" "}
         <strong>{renderAmount(details.amount)}</strong> from your bank account
         into your wallet.
-      </i18n.Translate>
+      </i18n.Translate></p>
       {selectedExchange ? (
-        <p>
+        <p><i18n.Translate>
           The exchange <strong>{selectedExchange}</strong> will be used as the
           Taler payment service provider.
-        </p>
+        </i18n.Translate></p>
       ) : null}
 
       <div>
diff --git a/packages/taler-wallet-webextension/tests/i18n.test.tsx 
b/packages/taler-wallet-webextension/tests/i18n.test.tsx
index 89c5b3d5..bba1770b 100644
--- a/packages/taler-wallet-webextension/tests/i18n.test.tsx
+++ b/packages/taler-wallet-webextension/tests/i18n.test.tsx
@@ -15,7 +15,7 @@
  */
 
 // import * as test from "ava";
-import { internalSetStrings, str, Translate } from "../src/i18n";
+import { internalSetStrings, str, Translate } from "@gnu-taler/taler-util";
 import { render, configure } from "enzyme";
 import Adapter from 'enzyme-adapter-preact-pure';
 
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1cf013b8..10198d6a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -46,11 +46,13 @@ importers:
       '@types/node': ^14.14.22
       ava: ^3.15.0
       esbuild: ^0.9.2
+      jed: ^1.1.1
       prettier: ^2.2.1
       rimraf: ^3.0.2
       tslib: ^2.1.0
       typescript: ^4.2.3
     dependencies:
+      jed: 1.1.1
       tslib: 2.1.0
     devDependencies:
       '@types/node': 14.14.34
@@ -11583,7 +11585,6 @@ packages:
 
   /jed/1.1.1:
     resolution: {integrity: sha1-elSbvZ/+FYWwzQoZHiAwVb7ldLQ=}
-    dev: true
 
   /jest-changed-files/26.6.2:
     resolution: {integrity: 
sha512-fDS7szLcY9sCtIip8Fjry9oGf3I2ht/QT21bAHm5Dmf0mD4X3ReNUf17y+bO6fR8WgbIZTlbyG1ak/53cbRzKQ==}

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]