feat(frontend): profile media, files and links tabs speak russian and english
This commit is contained in:
1 parent
cff493f5dd
commit
0cd34f3037
4 files changed
+29
-14
No files matched your search
@@ -7,6 +7,7 @@
|
|||||||
import Spinner from "#lib/components/ui/Spinner.svelte";
|
import Spinner from "#lib/components/ui/Spinner.svelte";
|
||||||
import { formatListDate } from "#lib/format/datetime.js";
|
import { formatListDate } from "#lib/format/datetime.js";
|
||||||
import { safeHref } from "#lib/format/url.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 { accounts } from "#lib/stores/accounts.svelte.js";
|
||||||
import { ui } from "#lib/stores/ui.svelte.js";
|
import { ui } from "#lib/stores/ui.svelte.js";
|
||||||
import { goto } from "$app/navigation";
|
import { goto } from "$app/navigation";
|
||||||
@@ -83,7 +84,7 @@
|
|||||||
{#if loading}
|
{#if loading}
|
||||||
<div class="center"><Spinner /></div>
|
<div class="center"><Spinner /></div>
|
||||||
{:else}
|
{:else}
|
||||||
<EmptyState title="Нет ссылок" />
|
<EmptyState title={t("social.links.empty")} />
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
@@ -122,7 +123,7 @@
|
|||||||
onclick={() => loadMore()}
|
onclick={() => loadMore()}
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
{loading ? "Загрузка…" : "Показать ещё"}
|
{loading ? t("ui.loading") : t("ui.showMore")}
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
import Spinner from "#lib/components/ui/Spinner.svelte";
|
import Spinner from "#lib/components/ui/Spinner.svelte";
|
||||||
import { formatListDate } from "#lib/format/datetime.js";
|
import { formatListDate } from "#lib/format/datetime.js";
|
||||||
import { formatBytes, mediaKindLabel } from "#lib/format/media.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 { poster } from "#lib/media/poster.js";
|
||||||
import { accounts } from "#lib/stores/accounts.svelte.js";
|
import { accounts } from "#lib/stores/accounts.svelte.js";
|
||||||
import { shareUi } from "#lib/stores/shares.svelte.js";
|
import { shareUi } from "#lib/stores/shares.svelte.js";
|
||||||
@@ -56,14 +57,16 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
function displayName(item: MediaView): string {
|
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) {
|
async function save(item: MediaView) {
|
||||||
try {
|
try {
|
||||||
await downloadMedia(item.id);
|
await downloadMedia(item.id);
|
||||||
} catch {
|
} catch {
|
||||||
toasts.error("Не удалось скачать файл");
|
toasts.error(t("ui.downloadFailed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +178,7 @@
|
|||||||
{#if loading}
|
{#if loading}
|
||||||
<div class="center"><Spinner /></div>
|
<div class="center"><Spinner /></div>
|
||||||
{:else}
|
{:else}
|
||||||
<EmptyState title="Пусто" />
|
<EmptyState title={t("shared.media.empty")} />
|
||||||
{/if}
|
{/if}
|
||||||
{:else if layout === "grid"}
|
{:else if layout === "grid"}
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
@@ -217,17 +220,17 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
{#snippet menu()}
|
{#snippet menu()}
|
||||||
<ContextMenuItem icon="open-in-new-tab" onselect={() => open(index)}
|
<ContextMenuItem icon="open-in-new-tab" onselect={() => open(index)}
|
||||||
>Открыть на весь экран</ContextMenuItem
|
>{t("shared.media.fullscreen")}</ContextMenuItem
|
||||||
>
|
>
|
||||||
<ContextMenuItem icon="reply" onselect={() => jump(item.message_id)}
|
<ContextMenuItem icon="reply" onselect={() => jump(item.message_id)}
|
||||||
>Перейти к сообщению</ContextMenuItem
|
>{t("ui.jumpToMessage")}</ContextMenuItem
|
||||||
>
|
>
|
||||||
{#if item.downloaded}
|
{#if item.downloaded}
|
||||||
<ContextMenuItem icon="download" onselect={() => save(item)}
|
<ContextMenuItem icon="download" onselect={() => save(item)}
|
||||||
>Скачать файл</ContextMenuItem
|
>{t("ui.downloadFile")}</ContextMenuItem
|
||||||
>
|
>
|
||||||
<ContextMenuItem icon="allow-share" onselect={() => share(item)}
|
<ContextMenuItem icon="allow-share" onselect={() => share(item)}
|
||||||
>Доступ по ссылке</ContextMenuItem
|
>{t("ui.shareLink")}</ContextMenuItem
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
@@ -262,17 +265,17 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
{#snippet menu()}
|
{#snippet menu()}
|
||||||
<ContextMenuItem icon="open-in-new-tab" onselect={() => open(index)}
|
<ContextMenuItem icon="open-in-new-tab" onselect={() => open(index)}
|
||||||
>Открыть</ContextMenuItem
|
>{t("ui.open")}</ContextMenuItem
|
||||||
>
|
>
|
||||||
<ContextMenuItem icon="reply" onselect={() => jump(item.message_id)}
|
<ContextMenuItem icon="reply" onselect={() => jump(item.message_id)}
|
||||||
>Перейти к сообщению</ContextMenuItem
|
>{t("ui.jumpToMessage")}</ContextMenuItem
|
||||||
>
|
>
|
||||||
{#if item.downloaded}
|
{#if item.downloaded}
|
||||||
<ContextMenuItem icon="download" onselect={() => save(item)}
|
<ContextMenuItem icon="download" onselect={() => save(item)}
|
||||||
>Скачать файл</ContextMenuItem
|
>{t("ui.downloadFile")}</ContextMenuItem
|
||||||
>
|
>
|
||||||
<ContextMenuItem icon="allow-share" onselect={() => share(item)}
|
<ContextMenuItem icon="allow-share" onselect={() => share(item)}
|
||||||
>Доступ по ссылке</ContextMenuItem
|
>{t("ui.shareLink")}</ContextMenuItem
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
@@ -289,7 +292,7 @@
|
|||||||
onclick={() => loadMore()}
|
onclick={() => loadMore()}
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
{loading ? "Загрузка…" : "Показать ещё"}
|
{loading ? t("ui.loading") : t("ui.showMore")}
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { read } from "#lib/i18n/messages/read.js";
|
|||||||
import { search } from "#lib/i18n/messages/search.js";
|
import { search } from "#lib/i18n/messages/search.js";
|
||||||
import { service } from "#lib/i18n/messages/service.js";
|
import { service } from "#lib/i18n/messages/service.js";
|
||||||
import { settings } from "#lib/i18n/messages/settings.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 { shares } from "#lib/i18n/messages/shares.js";
|
||||||
import { social } from "#lib/i18n/messages/social.js";
|
import { social } from "#lib/i18n/messages/social.js";
|
||||||
import { storage } from "#lib/i18n/messages/storage.js";
|
import { storage } from "#lib/i18n/messages/storage.js";
|
||||||
@@ -45,6 +46,7 @@ export const messages = {
|
|||||||
...search,
|
...search,
|
||||||
...service,
|
...service,
|
||||||
...settings,
|
...settings,
|
||||||
|
...shared,
|
||||||
...shares,
|
...shares,
|
||||||
...social,
|
...social,
|
||||||
...storage,
|
...storage,
|
||||||
|
|||||||
@@ -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;
|
||||||
Reference in new issue
Block a user