fix: update i18n - fields components

This commit is contained in:
2026-09-13 06:25:53 +05:00
parent 6c88a23e48
commit 4b44bc439c
7 changed files with 33 additions and 22 deletions
+6 -4
View File
@@ -4,7 +4,8 @@
FieldSpecKind, FieldSpecKind,
ToolSchema, ToolSchema,
} from "$lib/registry-schema"; } from "$lib/registry-schema";
import { fieldLabel } from "$lib/i18n/schema-tool-strings"; import { fieldLabel, groupLabel } from "$lib/i18n/schema-tool-strings";
import { t } from "$lib/i18n/t";
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";
@@ -89,7 +90,7 @@
{#each layoutGroups as group (group.key)} {#each layoutGroups as group (group.key)}
{#if group.title} {#if group.title}
<span class="group-title">{group.title}</span> <span class="group-title">{groupLabel(group.title)}</span>
{/if} {/if}
<div <div
class="group-fields" class="group-fields"
@@ -111,9 +112,10 @@
<div class="panel-foot"> <div class="panel-foot">
<button class="reset-btn" onclick={onreset}> <button class="reset-btn" onclick={onreset}>
<RotateCcw size={14} /> Reset <RotateCcw size={14} />
{t("ui.reset")}
</button> </button>
<span class="auto-note"><i></i> updates automatically</span> <span class="auto-note"><i></i> {t("ui.autoUpdate")}</span>
</div> </div>
<style> <style>
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { t } from "$lib/i18n/t";
import type { import type {
Dimension, Dimension,
DimensionSpec, DimensionSpec,
@@ -37,7 +38,7 @@
<span class="dimension-label">{label}</span> <span class="dimension-label">{label}</span>
<div class="dimension-field"> <div class="dimension-field">
<label class="dimension-axis"> <label class="dimension-axis">
<span>Width</span> <span>{t("ui.width")}</span>
<input <input
type="number" type="number"
min={sp.min} min={sp.min}
@@ -48,7 +49,7 @@
/> />
</label> </label>
<label class="dimension-axis"> <label class="dimension-axis">
<span>Height</span> <span>{t("ui.height")}</span>
<input <input
type="number" type="number"
min={sp.min} min={sp.min}
@@ -1,4 +1,6 @@
<script lang="ts"> <script lang="ts">
import { t } from "$lib/i18n/t";
interface Preset { interface Preset {
value: number; value: number;
label: string; label: string;
@@ -15,7 +17,7 @@
} }
let { let {
label = "Angle", label = t("ui.angle"),
value, value,
min = 0, min = 0,
max = 360, max = 360,
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { t } from "$lib/i18n/t";
import type { import type {
ColorList, ColorList,
ColorListSpec, ColorListSpec,
@@ -59,14 +60,16 @@
class="remove" class="remove"
onclick={() => removeColor(i)} onclick={() => removeColor(i)}
disabled={current.length <= 1} disabled={current.length <= 1}
aria-label="Remove color" aria-label={t("ui.removeColor")}
> >
× ×
</button> </button>
</div> </div>
{/each} {/each}
</div> </div>
<button type="button" class="add" onclick={addColor}>+ Add color</button> <button type="button" class="add" onclick={addColor}
>{t("ui.addColor")}</button
>
</div> </div>
<style> <style>
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { t } from "$lib/i18n/t";
import type { TextFont } from "$lib/core/domText"; import type { TextFont } from "$lib/core/domText";
import type { import type {
FieldSpec, FieldSpec,
@@ -35,10 +36,10 @@
onchange?.({ ...current, [key]: val }); onchange?.({ ...current, [key]: val });
} }
const FONTS: { value: TextFont; label: string }[] = [ const FONTS: { value: TextFont; labelKey: string }[] = [
{ value: "sans", label: "Sans" }, { value: "sans", labelKey: "ui.fontSans" },
{ value: "serif", label: "Serif" }, { value: "serif", labelKey: "ui.fontSerif" },
{ value: "mono", label: "Mono" }, { value: "mono", labelKey: "ui.fontMono" },
]; ];
</script> </script>
@@ -46,7 +47,7 @@
<span class="fs-label">{label}</span> <span class="fs-label">{label}</span>
<div class="fs-grid"> <div class="fs-grid">
<label class="fs-cell"> <label class="fs-cell">
<span class="fs-sub">Font</span> <span class="fs-sub">{t("ui.font")}</span>
<select <select
class="fs-select" class="fs-select"
value={current.font} value={current.font}
@@ -54,12 +55,12 @@
set("font", (e.target as HTMLSelectElement).value as TextFont)} set("font", (e.target as HTMLSelectElement).value as TextFont)}
> >
{#each FONTS as option (option.value)} {#each FONTS as option (option.value)}
<option value={option.value}>{option.label}</option> <option value={option.value}>{t(option.labelKey)}</option>
{/each} {/each}
</select> </select>
</label> </label>
<label class="fs-cell"> <label class="fs-cell">
<span class="fs-sub">Size</span> <span class="fs-sub">{t("ui.size")}</span>
<input <input
class="fs-input" class="fs-input"
type="number" type="number"
@@ -71,7 +72,7 @@
/> />
</label> </label>
<label class="fs-cell"> <label class="fs-cell">
<span class="fs-sub">Color</span> <span class="fs-sub">{t("ui.color")}</span>
<span class="fs-color"> <span class="fs-color">
<span class="swatch" style="background:{current.color}"></span> <span class="swatch" style="background:{current.color}"></span>
<input <input
@@ -83,7 +84,7 @@
</span> </span>
</label> </label>
<label class="fs-cell fs-bold"> <label class="fs-cell fs-bold">
<span class="fs-sub">Bold</span> <span class="fs-sub">{t("ui.bold")}</span>
<input <input
type="checkbox" type="checkbox"
checked={current.bold} checked={current.bold}
@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import AngleControl from "./AngleControl.svelte"; import AngleControl from "./AngleControl.svelte";
import { t } from "$lib/i18n/t";
import type { FieldSpec, Gradient, GradientSpec } from "$lib/registry-schema"; import type { FieldSpec, Gradient, GradientSpec } from "$lib/registry-schema";
interface Props { interface Props {
@@ -32,7 +33,7 @@
<span class="gradient-label">{label}</span> <span class="gradient-label">{label}</span>
<div class="gradient-colors"> <div class="gradient-colors">
<label class="color-field"> <label class="color-field">
<span>From</span> <span>{t("ui.from")}</span>
<span class="swatch" style="background:{current.from}"></span> <span class="swatch" style="background:{current.from}"></span>
<input <input
type="color" type="color"
@@ -41,7 +42,7 @@
/> />
</label> </label>
<label class="color-field"> <label class="color-field">
<span>To</span> <span>{t("ui.to")}</span>
<span class="swatch" style="background:{current.to}"></span> <span class="swatch" style="background:{current.to}"></span>
<input <input
type="color" type="color"
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { t } from "$lib/i18n/t";
import type { FieldSpec, Plate, PlateSpec } from "$lib/registry-schema"; import type { FieldSpec, Plate, PlateSpec } from "$lib/registry-schema";
interface Props { interface Props {
@@ -31,7 +32,7 @@
<span class="plate-label">{label}</span> <span class="plate-label">{label}</span>
<div class="plate-row {current.enabled ? '' : 'off'}"> <div class="plate-row {current.enabled ? '' : 'off'}">
<label class="plate-enabled"> <label class="plate-enabled">
<span>Backing plate</span> <span>{t("ui.backingPlate")}</span>
<input <input
type="checkbox" type="checkbox"
checked={current.enabled} checked={current.enabled}
@@ -49,7 +50,7 @@
</label> </label>
<label class="plate-opacity"> <label class="plate-opacity">
<span> <span>
Opacity {t("ui.opacity")}
<output>{current.opacity}%</output> <output>{current.opacity}%</output>
</span> </span>
<input <input