mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-16 14:36:35 +00:00
fix: worker use only i18n keys instead of full i18n
This commit is contained in:
@@ -8,7 +8,6 @@ import {
|
||||
renderPredicateMask,
|
||||
} from "../core/masks";
|
||||
import { base64ToBytes, looksLikePng, stripDataUri } from "../core/textio";
|
||||
import { t } from "../i18n/t";
|
||||
import { field, toolSchema } from "../registry-schema";
|
||||
import { imgTool, textGen, type ToolEntry } from "./types";
|
||||
|
||||
@@ -277,7 +276,7 @@ const pngFileSize: ToolEntry<NoParams> = {
|
||||
const blob = await encode(img, "image/png");
|
||||
const kb = blob.size / 1024;
|
||||
const kbText = kb >= 100 ? Math.round(kb).toString() : kb.toFixed(1);
|
||||
return t("tools.png-file-size.results.line", { kb: kbText });
|
||||
return { key: "line", vars: { kb: kbText } };
|
||||
}),
|
||||
};
|
||||
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
import type { ToolEntry } from "./types";
|
||||
import { geometryEntries } from "./geometry";
|
||||
import { alphaEntries } from "./alpha";
|
||||
import { convertEntries } from "./convert";
|
||||
import { analyzeEntries } from "./analyze";
|
||||
import { filtersEntries } from "./filters";
|
||||
import { colorEntries } from "./color";
|
||||
import { convertEntries } from "./convert";
|
||||
import { filtersEntries } from "./filters";
|
||||
import { generateEntries } from "./generate";
|
||||
import { geometryEntries } from "./geometry";
|
||||
import { textEntries } from "./text";
|
||||
import type { ToolEntry } from "./types";
|
||||
|
||||
export {
|
||||
genTool,
|
||||
imgTool,
|
||||
textGen,
|
||||
INPUT_MODES,
|
||||
requireSource,
|
||||
requireText,
|
||||
INPUT_MODES,
|
||||
RESULT_KINDS,
|
||||
textGen,
|
||||
} from "./types";
|
||||
export type {
|
||||
FileResult,
|
||||
InputMode,
|
||||
ResultKind,
|
||||
ToolContext,
|
||||
ToolEntry,
|
||||
ToolResult,
|
||||
ToolImageFile,
|
||||
FileResult,
|
||||
ToolResult,
|
||||
VerdictResult,
|
||||
} from "./types";
|
||||
|
||||
export const TOOLS: ToolEntry[] = [
|
||||
|
||||
@@ -49,7 +49,18 @@ export interface FileResult {
|
||||
files: ToolImageFile[];
|
||||
}
|
||||
|
||||
export type ToolResult = PixelImage | string | FileResult;
|
||||
/**
|
||||
* Вердикт с подстановками: `key` — ключ словаря (`tools[id].results[key]`),
|
||||
* `vars` — значения для интерполяции `{name}`. Локализация выполняется на
|
||||
* стороне UI; из run() (и тем более из worker) локализованные строки не
|
||||
* возвращаются.
|
||||
*/
|
||||
export interface VerdictResult {
|
||||
key: string;
|
||||
vars?: Record<string, string | number>;
|
||||
}
|
||||
|
||||
export type ToolResult = PixelImage | string | FileResult | VerdictResult;
|
||||
|
||||
/**
|
||||
* Инструмент нового registry: полностью типизирован на `Params`, схема —
|
||||
|
||||
Reference in New Issue
Block a user