commit 80f72573e346d9651bc02d9f14ff26f0d3434359
parent 78443e8231309007b559b2256dffc0696f31bcb0
Author: Sebastian <sebasjm@gmail.com>
Date: Mon, 24 Nov 2025 11:39:27 -0300
fix pogen reporting
Diffstat:
8 files changed, 57 insertions(+), 36 deletions(-)
diff --git a/packages/bank-ui/src/components/Transactions/views.tsx b/packages/bank-ui/src/components/Transactions/views.tsx
@@ -25,7 +25,7 @@ import { Fragment, VNode, h } from "preact";
import { RenderAmount } from "../../pages/PaytoWireTransferForm.js";
import { State } from "./index.js";
-const TALER_SCREEN_ID = 5;
+const TALER_SCREEN_ID = 4;
export function ReadyView({
transactions,
diff --git a/packages/bank-ui/src/pages/ConversionRateClassDetails.tsx b/packages/bank-ui/src/pages/ConversionRateClassDetails.tsx
@@ -52,6 +52,7 @@ import { TalerErrorCode } from "@gnu-taler/taler-util";
import { opFixedSuccess } from "@gnu-taler/taler-util";
import { AmountJson } from "@gnu-taler/taler-util";
+const TALER_SCREEN_ID = 11;
interface Props {
classId: number;
routeCancel: RouteDefinition;
diff --git a/packages/bank-ui/src/pages/NewConversionRateClass.tsx b/packages/bank-ui/src/pages/NewConversionRateClass.tsx
@@ -2,7 +2,7 @@ import {
AccessToken,
HttpStatusCode,
TalerCorebankApi,
- TalerErrorCode
+ TalerErrorCode,
} from "@gnu-taler/taler-util";
import {
ButtonBetter,
@@ -11,13 +11,14 @@ import {
RouteDefinition,
useBankCoreApiContext,
useLocalNotificationBetter,
- useTranslationContext
+ useTranslationContext,
} from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { useSessionState } from "../hooks/session.js";
import { ConversionRateClassForm } from "./admin/ConversionRateClassForm.js";
+const TALER_SCREEN_ID = 13;
interface Props {
routeCancel: RouteDefinition;
onCreated: (id: number) => void;
diff --git a/packages/bank-ui/src/pages/OperationState/views.tsx b/packages/bank-ui/src/pages/OperationState/views.tsx
@@ -43,7 +43,7 @@ import { SolveMFAChallenges } from "../SolveMFA.js";
import { ShouldBeSameUser } from "../WithdrawalConfirmationQuestion.js";
import { State } from "./index.js";
-const TALER_SCREEN_ID = 5;
+const TALER_SCREEN_ID = 6;
export function InvalidPaytoView({ payto }: State.InvalidPayto) {
return <div>Payto from server is not valid "{payto}"</div>;
diff --git a/packages/bank-ui/src/pages/SolveMFA.tsx b/packages/bank-ui/src/pages/SolveMFA.tsx
@@ -23,6 +23,7 @@ import { Fragment, h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks";
import { doAutoFocus } from "./PaytoWireTransferForm.js";
+const TALER_SCREEN_ID = 9;
export interface Props {
onCompleted: SafeHandlerTemplate<[challenges: string[]], any>;
username: string;
diff --git a/packages/bank-ui/src/pages/admin/ConversionClassList.tsx b/packages/bank-ui/src/pages/admin/ConversionClassList.tsx
@@ -39,7 +39,7 @@ import {
import { RenderAmount } from "../PaytoWireTransferForm.js";
import { CurrencySpecification } from "@gnu-taler/taler-util";
-const TALER_SCREEN_ID = 121;
+const TALER_SCREEN_ID = 130;
interface Props {
routeCreate: RouteDefinition;
diff --git a/packages/bank-ui/src/pages/admin/ConversionRateClassForm.tsx b/packages/bank-ui/src/pages/admin/ConversionRateClassForm.tsx
@@ -14,28 +14,21 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
import {
- AmountString,
- Amounts,
DecimalNumber,
RoundingMode,
- TalerCorebankApi,
- TranslatedString,
- assertUnreachable,
+ TalerCorebankApi
} from "@gnu-taler/taler-util";
import {
- InputToggle,
ShowInputErrorLabel,
- useBankCoreApiContext,
- useTranslationContext,
+ useTranslationContext
} from "@gnu-taler/web-util/browser";
import { ComponentChildren, VNode, h } from "preact";
import { useState } from "preact/hooks";
-import { Fragment } from "preact/jsx-runtime";
import { useSessionState } from "../../hooks/session.js";
import { ErrorMessageMappingFor, undefinedIfEmpty } from "../../utils.js";
-import { InputAmount, doAutoFocus } from "../PaytoWireTransferForm.js";
+import { doAutoFocus } from "../PaytoWireTransferForm.js";
-const TALER_SCREEN_ID = 120;
+const TALER_SCREEN_ID = 129;
export type ConversionRateClassFormData = {
name?: string;
diff --git a/packages/pogen/src/potextract.ts b/packages/pogen/src/potextract.ts
@@ -185,21 +185,34 @@ function processTaggedTemplateExpression(
return res;
}
-const SCREEN_ID_MAP: Record<string, Set<string>> = {};
-const MISSING_SCREEN_ID: Set<string> = new Set();
+type ScreenInfo = {
+ fileMap: Record<string, Set<string>>;
+ missing: Set<String>;
+ maxId: number;
+};
+const SCREEN_INFO: ScreenInfo = {
+ fileMap: {},
+ missing: new Set(),
+ maxId: 0,
+};
function formatScreenId(
sourceFile: ts.SourceFile,
outChunks: string[],
screenId: string,
) {
- if (!screenId) {
- MISSING_SCREEN_ID.add(sourceFile.fileName);
+ const screen = Number.parseInt(screenId, 10);
+ if (!screen || Number.isNaN(screen)) {
+ SCREEN_INFO.missing.add(sourceFile.fileName);
} else {
- if (!SCREEN_ID_MAP[screenId]) {
- SCREEN_ID_MAP[screenId] = new Set();
+ if (!SCREEN_INFO.fileMap[screenId]) {
+ SCREEN_INFO.fileMap[screenId] = new Set();
+ }
+ SCREEN_INFO.fileMap[screenId].add(sourceFile.fileName);
+
+ if (SCREEN_INFO.maxId < screen) {
+ SCREEN_INFO.maxId = screen;
}
- SCREEN_ID_MAP[screenId].add(sourceFile.fileName);
outChunks.push(`#. screenid: ${screenId}\n`);
}
@@ -679,19 +692,31 @@ export function potextract() {
processFile(f, chunks, knownMessageIds, gitRoot);
}
- MISSING_SCREEN_ID.forEach((fileName) => {
- console.error(`missing SCREEN_ID for file: ${fileName}`);
- });
-
- Object.entries(SCREEN_ID_MAP).forEach(([screenId, files]) => {
- if (files.size > 1) {
- console.error(
- `SCREEN_ID ${screenId} is in multiple files: \n * ${[...files].join(
- "\n * ",
- )}`,
- );
- }
- });
+ if (SCREEN_INFO.missing.size) {
+ console.error(
+ `There are some files with translation strings that doesnt have a constant TALER_SCREEN_ID on the root. This constant should be a unquie integer number to facilitate the identification from other locations. Add a "const TALER_SCREEN_ID = <number>;" after the last import. It doesn't need to be exported and it can be removed from runtime. Files:`,
+ );
+ SCREEN_INFO.missing.forEach((fileName) => {
+ console.error(` * ${fileName}`);
+ });
+ }
+ const haveRepetition =
+ Object.values(SCREEN_INFO.fileMap).find((files) => files.size > 1) !==
+ undefined;
+ if (haveRepetition) {
+ console.error(
+ `There are more than one file with the same TALER_SCREEN_ID, the current max number is "${SCREEN_INFO.maxId}". Repeated ids:`,
+ );
+ Object.entries(SCREEN_INFO.fileMap).forEach(([screenId, files]) => {
+ if (files.size > 1) {
+ console.error(
+ `const TALER_SCREEN_ID = ${screenId};\n * ${[...files].join(
+ "\n * ",
+ )}`,
+ );
+ }
+ });
+ }
const pot = chunks.join("");