feat: move all common messages to i18n (ru\en)

This commit is contained in:
2026-08-25 05:45:34 +05:00
parent 8255d33098
commit 2301b0e165
22 changed files with 100 additions and 87 deletions
+6 -5
View File
@@ -1,5 +1,6 @@
<script lang="ts">
import { getTool } from '$lib/registry';
import { t } from '$lib/i18n/t';
import ToolPage from '$lib/components/ToolPage.svelte';
import ToolSearch from '$lib/components/search/ToolSearch.svelte';
import Button from '$lib/components/ui/Button.svelte';
@@ -42,20 +43,20 @@
<svelte:head>
<title>
{selected ? `${selected.title} easy-png-tools` : 'easy-png-tools — PNG-утилиты прямо в браузере'}
{selected ? `${selected.title} easy-png-tools` : t('home.defaultTitle')}
</title>
</svelte:head>
{#if !selected}
<section class="hero">
<h1>Что делаем с изображением?</h1>
<p class="lead text-muted">Найдите инструмент — все операции выполняются локально в браузере.</p>
<h1>{t('home.heroTitle')}</h1>
<p class="lead text-muted">{t('home.heroLead')}</p>
<ToolSearch onSelect={(id) => openTool(id)} />
{#if lastToolId !== null && getTool(lastToolId)}
{@const restoreId = lastToolId}
<div class="restore-row">
<Button variant="secondary" fullWidth onclick={() => openTool(restoreId, true)}>
↩ Вернуть последний: {getTool(restoreId)?.title}
{t('home.restoreLast', { title: getTool(restoreId)?.title ?? '' })}
</Button>
</div>
{/if}
@@ -63,7 +64,7 @@
{:else}
<section class="workbench">
<button type="button" class="back text-caption text-muted" onclick={closeTool}>
← Сменить инструмент
{t('home.changeTool')}
</button>
{#key selectedId}
<ToolPage tool={selected} restoreChain={restoreOnOpen} />
+6 -10
View File
@@ -1,27 +1,23 @@
<script lang="ts">
import { CATEGORIES } from '$lib/categories';
import { t } from '$lib/i18n/t';
import ToolCard from '$lib/components/search/ToolCard.svelte';
import { TOOLS } from '$lib/registry';
</script>
<svelte:head>
<title>Все инструменты — easy-png-tools</title>
<meta
name="description"
content="Полный каталог PNG-утилит: конвертация, прозрачность, цвет, геометрия, анализ и генерация изображений."
/>
<title>{t('catalog.pageTitle')}</title>
<meta name="description" content={t('catalog.metaDescription')} />
</svelte:head>
<h1>Каталог инструментов</h1>
<p class="lead text-muted">
{TOOLS.length} утилит для работы с PNG. Все операции выполняются локально в браузере.
</p>
<h1>{t('catalog.heading')}</h1>
<p class="lead text-muted">{t('catalog.lead', { count: TOOLS.length })}</p>
{#each CATEGORIES as category (category.id)}
{@const categoryTools = TOOLS.filter((tool) => tool.category === category.id)}
{#if categoryTools.length > 0}
<section id={category.id} class="category" aria-labelledby="{category.id}-heading">
<h2 id="{category.id}-heading" class="heading-section">{category.label}</h2>
<h2 id="{category.id}-heading" class="heading-section">{t(`categories.${category.id}`)}</h2>
<div class="grid">
{#each categoryTools as tool (tool.id)}
<div class="panel">
+2 -1
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import ToolPage from '$lib/components/ToolPage.svelte';
import { getTool } from '$lib/registry';
import { t } from '$lib/i18n/t';
let { data } = $props();
@@ -8,7 +9,7 @@
</script>
<svelte:head>
<title>{tool?.title ?? 'Инструмент'} — easy-png-tools</title>
<title>{tool?.title ?? t('toolPage.fallbackTitle')} — easy-png-tools</title>
{#if tool}
<meta name="description" content={tool.description} />
{/if}
+2 -1
View File
@@ -1,5 +1,6 @@
import { error } from '@sveltejs/kit';
import { getTool, TOOLS } from '$lib/registry';
import { t } from '$lib/i18n/t';
import type { EntryGenerator, PageLoad } from './$types';
export const entries: EntryGenerator = () => TOOLS.map((tool) => ({ id: tool.id }));
@@ -7,7 +8,7 @@ export const entries: EntryGenerator = () => TOOLS.map((tool) => ({ id: tool.id
export const load: PageLoad = ({ params }) => {
const tool = getTool(params.id);
if (!tool) {
error(404, 'Инструмент не найден');
error(404, t('errors.notFound'));
}
return { id: tool.id };
};