i18n: localize frontpage's layout

This commit is contained in:
Xylight committed 2024-06-03 15:16:48 -07:00
1 parent d1a041ff56
commit 64107e51a0
13 files changed
+248 -90

No files matched your search

+19 -10
View File
@@ -37,6 +37,7 @@
import Logo from '../Logo.svelte'
import { LINKED_INSTANCE_URL } from '$lib/instance'
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
import { t } from '$lib/translations'
let searching = false
</script>
@@ -48,7 +49,7 @@
"
style={$$props.style}
>
<NavButton href="/" label="Home" class="ml-2 logo">
<NavButton href="/" label={$t('nav.home')} class="ml-2 logo">
<svelte:fragment slot="icon">
{#if LINKED_INSTANCE_URL}
{#if $site}
@@ -171,7 +172,7 @@
{#if $profile?.user && isAdmin($profile.user)}
<NavButton
href="/admin"
label="Admin"
label={$t('nav.admin')}
icon={ServerStack}
class="relative"
isSelectedFilter={(path) => path.startsWith('/admin')}
@@ -184,7 +185,11 @@
</NavButton>
{/if}
{#if amModOfAny($profile?.user)}
<NavButton href="/moderation" label="Moderation" class="relative">
<NavButton
href="/moderation"
label={$t('nav.moderation')}
class="relative"
>
{#if ($profile?.user?.notifications.reports ?? 0) > 0}
<div
class="rounded-full w-2 h-2 bg-red-500 absolute -top-1 -left-1"
@@ -193,10 +198,14 @@
<ShieldIcon let:isSelected slot="icon" filled={isSelected} width={18} />
</NavButton>
{/if}
<NavButton href="/communities" label="Explore" icon={GlobeAlt} />
<NavButton
href="/communities"
label={$t('nav.communities')}
icon={GlobeAlt}
/>
<NavButton
on:click={() => (searching = true)}
label="Search"
label={$t('nav.search')}
icon={MagnifyingGlass}
/>
<Menu placement="top">
@@ -204,13 +213,13 @@
class="relative"
color="primary"
slot="target"
label="Create"
label={$t('nav.create.label')}
icon={Plus}
/>
<MenuDivider>Create</MenuDivider>
<MenuDivider>{$t('nav.create.label')}</MenuDivider>
<MenuButton link href="/create/post" disabled={!$profile?.jwt}>
<Icon src={PencilSquare} mini width={16} slot="prefix" />
Post
{$t('nav.create.post')}
</MenuButton>
<MenuButton
link
@@ -221,11 +230,11 @@
!isAdmin($profile.user))}
>
<Icon src={Newspaper} mini width={16} slot="prefix" />
Community
{$t('nav.create.community')}
</MenuButton>
{#if !$profile?.jwt}
<span class="text-sm mx-4 my-1 py-1">
<Link highlight href="/login">Log in</Link> to create content.
{$t('nav.create.logingate')}
</span>
{/if}
</Menu>
+22 -11
View File
@@ -26,6 +26,7 @@
import Expandable from '$lib/components/ui/Expandable.svelte'
import EndPlaceholder from '../EndPlaceholder.svelte'
import Application from '../../../../routes/admin/applications/Application.svelte'
import { t } from '$lib/translations'
</script>
<nav
@@ -35,11 +36,13 @@
>
{#if $profile?.jwt}
<SidebarButton icon={UserCircle} href="/profile/user">
<span slot="label">Profile</span>
<span slot="label">
{$t('profile.profile')}
</span>
</SidebarButton>
<SidebarButton icon={Inbox} href="/inbox">
<span slot="label" class="flex items-center gap-2">
Inbox
{$t('profile.inbox')}
{#if $profile?.user?.notifications.inbox}
<Badge
class="w-5 h-5 !p-0 grid place-items-center ml-auto"
@@ -51,22 +54,30 @@
</span>
</SidebarButton>
<SidebarButton icon={Bookmark} href="/saved">
<span slot="label">Saved</span>
<span slot="label">{$t('profile.saved')}</span>
</SidebarButton>
{:else}
<SidebarButton href="/login" title="Log In" icon={ArrowLeftOnRectangle}>
<span slot="label">Log In</span>
<SidebarButton
href="/login"
title={$t('account.login')}
icon={ArrowLeftOnRectangle}
>
<span slot="label">{$t('account.login')}</span>
</SidebarButton>
<SidebarButton href="/signup" title="Sign Up" icon={Identification}>
<span slot="label">Sign Up</span>
<SidebarButton
href="/signup"
title={$t('account.signup')}
icon={Identification}
>
<span slot="label">{$t('account.signup')}</span>
</SidebarButton>
{#if LINKED_INSTANCE_URL === undefined}
<SidebarButton
href="/accounts"
title="Change Instance"
title={$t('account.changeinstance')}
icon={ServerStack}
>
<span slot="label">Change Instance</span>
<span slot="label">{$t('account.changeinstance')}</span>
</SidebarButton>
{/if}
{/if}
@@ -78,7 +89,7 @@
</div>
{/each}
<SidebarButton href="/accounts" icon={UserGroup}>
<span slot="label">Accounts</span>
<span slot="label">{$t('account.accounts')}</span>
</SidebarButton>
{/if}
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
@@ -99,7 +110,7 @@
: '//max-lg:hidden'}"
>
<EndPlaceholder>
Subscribed
{$t('profile.subscribed')}
<span slot="action" class="dark:text-white text-black">
{$profile.user.follows.length}
</span>