From 0cd34f3037314a1bc820b32924e0ee8f7925ee2a Mon Sep 17 00:00:00 2001 From: h Date: Mon, 19 Oct 2026 05:34:42 +0000 Subject: [PATCH] feat(frontend): profile media, files and links tabs speak russian and english --- .../lib/components/profile/SharedLinks.svelte | 5 ++-- .../lib/components/profile/SharedMedia.svelte | 27 ++++++++++--------- frontend/src/lib/i18n/messages.ts | 2 ++ frontend/src/lib/i18n/messages/shared.ts | 9 +++++++ 4 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 frontend/src/lib/i18n/messages/shared.ts diff --git a/frontend/src/lib/components/profile/SharedLinks.svelte b/frontend/src/lib/components/profile/SharedLinks.svelte index 46a4f40..c5a010b 100644 --- a/frontend/src/lib/components/profile/SharedLinks.svelte +++ b/frontend/src/lib/components/profile/SharedLinks.svelte @@ -7,6 +7,7 @@ import Spinner from "#lib/components/ui/Spinner.svelte"; import { formatListDate } from "#lib/format/datetime.js"; import { safeHref } from "#lib/format/url.js"; + import { t } from "#lib/i18n/locale.svelte.js"; import { accounts } from "#lib/stores/accounts.svelte.js"; import { ui } from "#lib/stores/ui.svelte.js"; import { goto } from "$app/navigation"; @@ -83,7 +84,7 @@ {#if loading}
{:else} - + {/if} {:else}
    @@ -122,7 +123,7 @@ onclick={() => loadMore()} type="button" > - {loading ? "Загрузка…" : "Показать ещё"} + {loading ? t("ui.loading") : t("ui.showMore")} {/if} diff --git a/frontend/src/lib/components/profile/SharedMedia.svelte b/frontend/src/lib/components/profile/SharedMedia.svelte index 0df28ea..7548ac2 100644 --- a/frontend/src/lib/components/profile/SharedMedia.svelte +++ b/frontend/src/lib/components/profile/SharedMedia.svelte @@ -17,6 +17,7 @@ import Spinner from "#lib/components/ui/Spinner.svelte"; import { formatListDate } from "#lib/format/datetime.js"; import { formatBytes, mediaKindLabel } from "#lib/format/media.js"; + import { t } from "#lib/i18n/locale.svelte.js"; import { poster } from "#lib/media/poster.js"; import { accounts } from "#lib/stores/accounts.svelte.js"; import { shareUi } from "#lib/stores/shares.svelte.js"; @@ -56,14 +57,16 @@ ); function displayName(item: MediaView): string { - return item.file_name ?? mediaKindLabel(item.kind) ?? "Файл"; + return ( + item.file_name ?? mediaKindLabel(item.kind) ?? t("media.kind.document") + ); } async function save(item: MediaView) { try { await downloadMedia(item.id); } catch { - toasts.error("Не удалось скачать файл"); + toasts.error(t("ui.downloadFailed")); } } @@ -175,7 +178,7 @@ {#if loading}
    {:else} - + {/if} {:else if layout === "grid"}
    @@ -217,17 +220,17 @@ {/snippet} {#snippet menu()} open(index)} - >Открыть на весь экран{t("shared.media.fullscreen")} jump(item.message_id)} - >Перейти к сообщению{t("ui.jumpToMessage")} {#if item.downloaded} save(item)} - >Скачать файл{t("ui.downloadFile")} share(item)} - >Доступ по ссылке{t("ui.shareLink")} {/if} {/snippet} @@ -262,17 +265,17 @@ {/snippet} {#snippet menu()} open(index)} - >Открыть{t("ui.open")} jump(item.message_id)} - >Перейти к сообщению{t("ui.jumpToMessage")} {#if item.downloaded} save(item)} - >Скачать файл{t("ui.downloadFile")} share(item)} - >Доступ по ссылке{t("ui.shareLink")} {/if} {/snippet} @@ -289,7 +292,7 @@ onclick={() => loadMore()} type="button" > - {loading ? "Загрузка…" : "Показать ещё"} + {loading ? t("ui.loading") : t("ui.showMore")} {/if} diff --git a/frontend/src/lib/i18n/messages.ts b/frontend/src/lib/i18n/messages.ts index 0bcc1c3..3bcb910 100644 --- a/frontend/src/lib/i18n/messages.ts +++ b/frontend/src/lib/i18n/messages.ts @@ -17,6 +17,7 @@ import { read } from "#lib/i18n/messages/read.js"; import { search } from "#lib/i18n/messages/search.js"; import { service } from "#lib/i18n/messages/service.js"; import { settings } from "#lib/i18n/messages/settings.js"; +import { shared } from "#lib/i18n/messages/shared.js"; import { shares } from "#lib/i18n/messages/shares.js"; import { social } from "#lib/i18n/messages/social.js"; import { storage } from "#lib/i18n/messages/storage.js"; @@ -45,6 +46,7 @@ export const messages = { ...search, ...service, ...settings, + ...shared, ...shares, ...social, ...storage, diff --git a/frontend/src/lib/i18n/messages/shared.ts b/frontend/src/lib/i18n/messages/shared.ts new file mode 100644 index 0000000..9363d2f --- /dev/null +++ b/frontend/src/lib/i18n/messages/shared.ts @@ -0,0 +1,9 @@ +import type { Messages } from "#lib/i18n/types.js"; + +export const shared = { + "shared.media.empty": { en: "Nothing here yet", ru: "Здесь пока пусто" }, + "shared.media.fullscreen": { + en: "Open full screen", + ru: "Открыть на весь экран", + }, +} satisfies Messages;