[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant-backoffice] branch master updated: bank's i18n
From: |
gnunet |
Subject: |
[taler-merchant-backoffice] branch master updated: bank's i18n |
Date: |
Mon, 03 Jan 2022 10:35:54 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository merchant-backoffice.
The following commit(s) were added to refs/heads/master by this push:
new 45a3f1a bank's i18n
45a3f1a is described below
commit 45a3f1ab77725bb98cf30fa2db5ac33cf6092ba4
Author: ms <ms@taler.net>
AuthorDate: Mon Jan 3 10:35:32 2022 +0100
bank's i18n
---
packages/bank/build-bank-translations.sh | 28 +++++++++++
.../bank/{src/i18n/strings.ts => contrib/po2ts} | 56 +++++++++++-----------
packages/bank/src/i18n/bank.pot | 50 +++++++++++++++++++
packages/bank/src/i18n/de.po | 49 +++++++++++++++++++
packages/bank/src/i18n/strings.ts | 49 ++++++++++---------
packages/bank/src/pages/home/index.tsx | 4 +-
6 files changed, 183 insertions(+), 53 deletions(-)
diff --git a/packages/bank/build-bank-translations.sh
b/packages/bank/build-bank-translations.sh
new file mode 100755
index 0000000..34176b2
--- /dev/null
+++ b/packages/bank/build-bank-translations.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -eu
+
+function build {
+ POTGEN=node_modules/@gnu-taler/pogen/bin/pogen
+ PACKAGE_NAME=$1
+
+ find \( -name '*.ts' -or -name '*.tsx' \) ! -name '*.d.ts' \
+ | xargs node $POTGEN \
+ | msguniq \
+ | msgmerge src/i18n/poheader - \
+ > src/i18n/$PACKAGE_NAME.pot
+
+ for pofile in $(ls src/i18n/*.po 2> /dev/null || true); do
+ echo merging $pofile;
+ msgmerge -o $pofile $pofile src/i18n/$PACKAGE_NAME.pot;
+ done;
+
+ # generate .ts file containing all translations
+ cat src/i18n/strings-prelude > src/i18n/strings.ts
+ for pofile in $(ls src/i18n/*.po 2> /dev/null || true); do \
+ echo appending $pofile; \
+ ./contrib/po2ts $pofile >> src/i18n/strings.ts; \
+ done;
+}
+
+build bank
diff --git a/packages/bank/src/i18n/strings.ts b/packages/bank/contrib/po2ts
old mode 100644
new mode 100755
similarity index 50%
copy from packages/bank/src/i18n/strings.ts
copy to packages/bank/contrib/po2ts
index d12e63e..a135da6
--- a/packages/bank/src/i18n/strings.ts
+++ b/packages/bank/contrib/po2ts
@@ -1,6 +1,7 @@
+#!/usr/bin/env node
/*
This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
+ (C) 2020 Taler Systems S.A.
GNU 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
@@ -14,31 +15,28 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-/*eslint quote-props: ["error", "consistent"]*/
-export const strings: { [s: string]: any } = {};
-
-strings["de"] = {
- domain: "messages",
- locale_data: {
- messages: {
- "": {
- domain: "messages",
- plural_forms: "nplurals=2; plural=(n != 1);",
- lang: "",
- },
- },
- },
-};
-
-strings["en"] = {
- domain: "messages",
- locale_data: {
- messages: {
- "": {
- domain: "messages",
- plural_forms: "nplurals=2; plural=(n != 1);",
- lang: "",
- },
- },
- },
-};
+/**
+ * Convert a <lang>.po file into a JavaScript / TypeScript expression.
+ */
+
+const po2json = require("po2json");
+
+const filename = process.argv[2];
+
+if (!filename) {
+ console.error("error: missing filename");
+ process.exit(1);
+}
+
+const m = filename.match(/([a-zA-Z0-9-_]+).po/);
+
+if (!m) {
+ console.error("error: unexpected filename (expected <lang>.po)");
+ process.exit(1);
+}
+
+const lang = m[1];
+const pojson = po2json.parseFileSync(filename, { format: "jed1.x", fuzzy: true
});
+const s =
+ "strings['" + lang + "'] = " + JSON.stringify(pojson, null, " ") + ";\n";
+console.log(s);
diff --git a/packages/bank/src/i18n/bank.pot b/packages/bank/src/i18n/bank.pot
new file mode 100644
index 0000000..63aa3b6
--- /dev/null
+++ b/packages/bank/src/i18n/bank.pot
@@ -0,0 +1,50 @@
+#:
/home/job/merchant-backoffice/packages/bank/src/components/picker/DurationPicker.tsx:55
+#, c-format
+msgid "days"
+msgstr ""
+
+#:
/home/job/merchant-backoffice/packages/bank/src/components/picker/DurationPicker.tsx:65
+#, c-format
+msgid "hours"
+msgstr ""
+
+#:
/home/job/merchant-backoffice/packages/bank/src/components/picker/DurationPicker.tsx:76
+#, c-format
+msgid "minutes"
+msgstr ""
+
+#:
/home/job/merchant-backoffice/packages/bank/src/components/picker/DurationPicker.tsx:87
+#, c-format
+msgid "seconds"
+msgstr ""
+
+#: /home/job/merchant-backoffice/packages/bank/src/pages/home/index.tsx:549
+#, c-format
+msgid "Page has a problem:"
+msgstr ""
+
+# This file is part of GNU Taler
+# (C) 2021 Taler Systems S.A.
+# GNU 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.
+# GNU 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
+# GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: Taler Wallet\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2016-11-23 00:00+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
diff --git a/packages/bank/src/i18n/de.po b/packages/bank/src/i18n/de.po
new file mode 100644
index 0000000..5f7b959
--- /dev/null
+++ b/packages/bank/src/i18n/de.po
@@ -0,0 +1,49 @@
+#:
/home/job/merchant-backoffice/packages/bank/src/components/picker/DurationPicker.tsx:55
+#, c-format
+msgid "days"
+msgstr ""
+
+#:
/home/job/merchant-backoffice/packages/bank/src/components/picker/DurationPicker.tsx:65
+#, c-format
+msgid "hours"
+msgstr ""
+
+#:
/home/job/merchant-backoffice/packages/bank/src/components/picker/DurationPicker.tsx:76
+#, c-format
+msgid "minutes"
+msgstr ""
+
+#:
/home/job/merchant-backoffice/packages/bank/src/components/picker/DurationPicker.tsx:87
+#, c-format
+msgid "seconds"
+msgstr ""
+
+#: /home/job/merchant-backoffice/packages/bank/src/pages/home/index.tsx:549
+#, c-format
+msgid "Page has a problem:"
+msgstr ""
+
+# This file is part of GNU Taler
+# (C) 2021 Taler Systems S.A.
+# GNU 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.
+# GNU 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
+# GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Taler Wallet\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2016-11-23 00:00+0100\n"
+"PO-Revision-Date: 2022-01-03 10:27+0100\n"
+"Last-Translator: <translations@taler.net>\n"
+"Language-Team: German\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
diff --git a/packages/bank/src/i18n/strings.ts
b/packages/bank/src/i18n/strings.ts
index d12e63e..0722b2b 100644
--- a/packages/bank/src/i18n/strings.ts
+++ b/packages/bank/src/i18n/strings.ts
@@ -15,30 +15,33 @@
*/
/*eslint quote-props: ["error", "consistent"]*/
-export const strings: { [s: string]: any } = {};
+export const strings: {[s: string]: any} = {};
-strings["de"] = {
- domain: "messages",
- locale_data: {
- messages: {
+strings['de'] = {
+ "domain": "messages",
+ "locale_data": {
+ "messages": {
+ "days": [
+ ""
+ ],
+ "hours": [
+ ""
+ ],
+ "minutes": [
+ ""
+ ],
+ "seconds": [
+ ""
+ ],
+ "Page has a problem:": [
+ ""
+ ],
"": {
- domain: "messages",
- plural_forms: "nplurals=2; plural=(n != 1);",
- lang: "",
- },
- },
- },
+ "domain": "messages",
+ "plural_forms": "nplurals=2; plural=(n != 1);",
+ "lang": "de"
+ }
+ }
+ }
};
-strings["en"] = {
- domain: "messages",
- locale_data: {
- messages: {
- "": {
- domain: "messages",
- plural_forms: "nplurals=2; plural=(n != 1);",
- lang: "",
- },
- },
- },
-};
diff --git a/packages/bank/src/pages/home/index.tsx
b/packages/bank/src/pages/home/index.tsx
index beb19aa..80f0c57 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -56,6 +56,8 @@ interface AccountStateType {
* Helpers. *
***********/
+let i18n = useTranslator();
+
/**
* Craft headers with Authorization and Content-Type.
*/
@@ -544,7 +546,7 @@ export function BankHome(): VNode {
var [accountState, accountStateSetter] = useAccountState();
if (pageState.hasError) {
- return <p>Page has a problem: {pageState.error}</p>;
+ return <p>{i18n`Page has a problem:`} {pageState.error}</p>;
}
/**
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant-backoffice] branch master updated: bank's i18n,
gnunet <=