mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 13:36:36 +00:00
docs: update dict for i18n
This commit is contained in:
@@ -156,8 +156,12 @@
|
|||||||
- `verdictTone(key)` — `success`|`danger`|`info` по имени ключа
|
- `verdictTone(key)` — `success`|`danger`|`info` по имени ключа
|
||||||
(`*Yes`/`*No`/`*Portrait`/`*Landscape`) — не по строке.
|
(`*Yes`/`*No`/`*Portrait`/`*Landscape`) — не по строке.
|
||||||
- **0.9** Расширить тип `Dict` (только новая ветка `lib/i18n`):
|
- **0.9** Расширить тип `Dict` (только новая ветка `lib/i18n`):
|
||||||
- новая секция `preview` для UI-строк нового дизайна (только те, что остаются
|
- секция `preview` **не заводится**: оставшиеся после чистки mono-лейблов
|
||||||
после чистки mono-лейблов, см. решение B);
|
(см. решение B) строки нового UI живут в собственных категориях — расширяем
|
||||||
|
существующие (`catalog`, `header`, `dropZone`, `sourceCard`, `resultCard`,
|
||||||
|
`paramsCard`, `textResult`, `ui`) и заводим две маленькие новые: `actions`
|
||||||
|
(Generate / Open image / Download result…) и `textSource` (placeholder, Try
|
||||||
|
sample…);
|
||||||
- новая глобальная секция `fields: Record<string, string>` — переводы подписей
|
- новая глобальная секция `fields: Record<string, string>` — переводы подписей
|
||||||
полей по ключу из схемы (решение C);
|
полей по ключу из схемы (решение C);
|
||||||
- новая глобальная секция `groups: Record<string, string>` — переводы
|
- новая глобальная секция `groups: Record<string, string>` — переводы
|
||||||
@@ -165,7 +169,8 @@
|
|||||||
|
|
||||||
### Фаза 1: Словари — наполнение (только новая ветка `lib/i18n`, v1 не трогаем)
|
### Фаза 1: Словари — наполнение (только новая ветка `lib/i18n`, v1 не трогаем)
|
||||||
|
|
||||||
- **1.1** Заполнить `en.ts` и `ru.ts` секциями `preview`, `fields`, `groups`.
|
- **1.1** Заполнить `en.ts` и `ru.ts` секциями `actions`, `textSource`, `fields`,
|
||||||
|
`groups` и ключами недостающих строк в существующих секциях.
|
||||||
- **1.2** Проинвентаризировать разницу между 122 инструментами нового registry и
|
- **1.2** Проинвентаризировать разницу между 122 инструментами нового registry и
|
||||||
ключами `ru.tools`: для инструментов без перевода (нет в v1) добавить
|
ключами `ru.tools`: для инструментов без перевода (нет в v1) добавить
|
||||||
title/description в ru.ts новой ветки (по категориям — несколько коммитов).
|
title/description в ru.ts новой ветки (по категориям — несколько коммитов).
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
FieldSpecKind,
|
FieldSpecKind,
|
||||||
ToolSchema,
|
ToolSchema,
|
||||||
} from "$lib/registry-schema";
|
} from "$lib/registry-schema";
|
||||||
import { fieldLabel as labelOf } from "$lib/i18n/schema-tool-strings";
|
import { fieldLabel } from "$lib/i18n/schema-tool-strings";
|
||||||
import { RotateCcw } from "@lucide/svelte";
|
import { RotateCcw } from "@lucide/svelte";
|
||||||
import type { Component } from "svelte";
|
import type { Component } from "svelte";
|
||||||
import DimensionField from "./fields/DimensionField.svelte";
|
import DimensionField from "./fields/DimensionField.svelte";
|
||||||
@@ -53,13 +53,6 @@
|
|||||||
}
|
}
|
||||||
let { schema, values, onchange, onreset }: Props = $props();
|
let { schema, values, onchange, onreset }: Props = $props();
|
||||||
|
|
||||||
function labelOf(id: string): string {
|
|
||||||
return id
|
|
||||||
.replace(/([a-z])([A-Z])/g, "$1 $2")
|
|
||||||
.replace(/[_-]+/g, " ")
|
|
||||||
.replace(/\b\w/g, (c) => c.toUpperCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LayoutGroup {
|
interface LayoutGroup {
|
||||||
key: string;
|
key: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -107,7 +100,7 @@
|
|||||||
{#each group.fields as id (id)}
|
{#each group.fields as id (id)}
|
||||||
{@const Control = FIELDS[schema.fields[id].spec.kind]}
|
{@const Control = FIELDS[schema.fields[id].spec.kind]}
|
||||||
<Control
|
<Control
|
||||||
label={labelOf(id)}
|
label={fieldLabel(schema.fields[id], id)}
|
||||||
value={values[id]}
|
value={values[id]}
|
||||||
spec={schema.fields[id].spec}
|
spec={schema.fields[id].spec}
|
||||||
onchange={(v) => onchange(id, v)}
|
onchange={(v) => onchange(id, v)}
|
||||||
|
|||||||
@@ -53,4 +53,12 @@ export type Dict = {
|
|||||||
ui: Record<string, string>;
|
ui: Record<string, string>;
|
||||||
errors: Record<string, string>;
|
errors: Record<string, string>;
|
||||||
tools: Record<string, ToolStrings>;
|
tools: Record<string, ToolStrings>;
|
||||||
|
/** Действия панели результата/генерации (Generate, Open image…). */
|
||||||
|
actions?: Record<string, string>;
|
||||||
|
/** Поля ввода текста нового UI (placeholder, Try sample…). */
|
||||||
|
textSource?: Record<string, string>;
|
||||||
|
/** Подписи полей по ключу (решение C: label-ключ на поле). */
|
||||||
|
fields?: Record<string, string>;
|
||||||
|
/** Заголовки групп полей по ключу (решение A). */
|
||||||
|
groups?: Record<string, string>;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user