i18n: localize posts
This commit is contained in:
1 parent
64107e51a0
commit
c4236fa124
9 files changed
+110
-31
No files matched your search
@@ -49,6 +49,7 @@
|
||||
} from 'mono-svelte'
|
||||
import { fediseer, type Data } from '$lib/fediseer/fediseer'
|
||||
import Fediseer from '$lib/fediseer/Fediseer.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let post: PostView
|
||||
|
||||
@@ -110,7 +111,7 @@
|
||||
href="/post/{getInstance()}/{post.post.id}"
|
||||
class="!text-inherit h-8 px-3"
|
||||
target={$userSettings.openLinksInNewTab ? '_blank' : ''}
|
||||
title="Comments"
|
||||
title={$t('post.actions.comments')}
|
||||
>
|
||||
<Icon slot="prefix" src={ChatBubbleOvalLeft} mini size="14" />
|
||||
<FormattedNumber number={post.counts.comments} />
|
||||
@@ -123,7 +124,12 @@
|
||||
<DebugObject object={post} bind:open={debug} />
|
||||
{/await}
|
||||
{/if}
|
||||
<Button on:click={() => (debug = true)} size="square-md" color="ghost">
|
||||
<Button
|
||||
on:click={() => (debug = true)}
|
||||
title="Debug"
|
||||
size="square-md"
|
||||
color="ghost"
|
||||
>
|
||||
<Icon src={BugAnt} mini size="16" slot="prefix" />
|
||||
</Button>
|
||||
{/if}
|
||||
@@ -143,7 +149,7 @@
|
||||
color="ghost"
|
||||
loading={saving}
|
||||
disabled={saving}
|
||||
title={post.saved ? 'Unsave' : 'Save'}
|
||||
title={post.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
|
||||
>
|
||||
<Icon
|
||||
src={post.saved ? BookmarkSlash : Bookmark}
|
||||
@@ -159,12 +165,17 @@
|
||||
containerClass="overflow-auto max-h-[400px]"
|
||||
class="h-8"
|
||||
targetClass="h-full"
|
||||
title="Post actions"
|
||||
title={$t('post.actions.more.label')}
|
||||
>
|
||||
<Button slot="target" title="Post actions" color="ghost" size="square-md">
|
||||
<Button
|
||||
slot="target"
|
||||
title={$t('post.actions.more.label')}
|
||||
color="ghost"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon slot="prefix" src={EllipsisHorizontal} width={16} mini />
|
||||
</Button>
|
||||
<MenuDivider>Creator</MenuDivider>
|
||||
<MenuDivider>{$t('post.actions.more.creator')}</MenuDivider>
|
||||
<MenuButton
|
||||
link
|
||||
href="/u/{post.creator.name}@{new URL(post.creator.actor_id).hostname}"
|
||||
@@ -189,7 +200,6 @@
|
||||
const data = await fediseer.getInstanceInfo(
|
||||
new URL(post.community.actor_id).hostname
|
||||
)
|
||||
console.log(data)
|
||||
fediseerData = data
|
||||
fediseerOpen = true
|
||||
fediseerLoading = false
|
||||
@@ -207,11 +217,11 @@
|
||||
<span>{new URL(post.community.actor_id).hostname}</span>
|
||||
</MenuButton>
|
||||
<hr class="w-[90%] mx-auto opacity-100 dark:opacity-10 my-2" />
|
||||
<MenuDivider>Actions</MenuDivider>
|
||||
<MenuDivider>{$t('post.actions.more.actions')}</MenuDivider>
|
||||
{#if $profile?.user && $profile?.jwt && $profile.user.local_user_view.person.id == post.creator.id}
|
||||
<MenuButton on:click={() => (editing = true)}>
|
||||
<Icon src={PencilSquare} width={16} mini slot="prefix" />
|
||||
Edit
|
||||
{$t('post.actions.more.edit')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $profile?.jwt}
|
||||
@@ -222,7 +232,9 @@
|
||||
}}
|
||||
>
|
||||
<Icon slot="prefix" src={post.read ? EyeSlash : Eye} width={16} mini />
|
||||
Mark as {post.read ? 'Unread' : 'Read'}
|
||||
{post.read
|
||||
? $t('post.actions.more.markUnread')
|
||||
: $t('post.actions.more.markRead')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton
|
||||
@@ -233,7 +245,7 @@
|
||||
}}
|
||||
>
|
||||
<Icon src={Share} width={16} mini slot="prefix" />
|
||||
Share
|
||||
{$t('post.actions.more.share')}
|
||||
</MenuButton>
|
||||
{#if $profile?.jwt}
|
||||
<MenuButton
|
||||
@@ -260,7 +272,7 @@
|
||||
}}
|
||||
>
|
||||
<Icon src={ArrowTopRightOnSquare} width={16} mini slot="prefix" />
|
||||
Crosspost
|
||||
{$t('post.actions.more.crosspost')}
|
||||
</MenuButton>
|
||||
{#if $profile.user && post.creator.id == $profile.user.local_user_view.person.id}
|
||||
<MenuButton
|
||||
@@ -275,13 +287,15 @@
|
||||
color="danger-subtle"
|
||||
>
|
||||
<Icon src={Trash} width={16} mini slot="prefix" />
|
||||
{post.post.deleted ? 'Restore' : 'Delete'}
|
||||
{post.post.deleted
|
||||
? $t('post.actions.more.restore')
|
||||
: $t('post.actions.more.delete')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $profile.user?.local_user_view.person.id != post.creator.id}
|
||||
<MenuButton on:click={() => report(post)} color="danger-subtle">
|
||||
<Icon src={Flag} width={16} mini slot="prefix" />
|
||||
Report
|
||||
{$t('moderation.report')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/translations'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import {
|
||||
@@ -32,7 +33,7 @@
|
||||
class={$$slots.default ? '' : 'flex-1'}
|
||||
>
|
||||
<Icon src={ChevronLeft} size="18" mini slot="prefix" />
|
||||
Back
|
||||
{$t('common.back')}
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -43,7 +44,7 @@
|
||||
}}
|
||||
class={$$slots.default ? '' : 'flex-1'}
|
||||
>
|
||||
Next
|
||||
{$t('common.next')}
|
||||
<Icon src={ChevronRight} size="18" mini slot="suffix" />
|
||||
</Button>
|
||||
</div>
|
||||
@@ -1,11 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { locale } from '$lib/translations'
|
||||
|
||||
export let number: number
|
||||
export let locale: string = 'en'
|
||||
let localeToUse: string = $locale
|
||||
export let options: Intl.NumberFormatOptions = {
|
||||
notation: 'compact',
|
||||
}
|
||||
|
||||
export { localeToUse as locale }
|
||||
</script>
|
||||
|
||||
<span class={$$props.class ?? ''}>
|
||||
{Intl.NumberFormat(locale, options).format(number)}
|
||||
{Intl.NumberFormat(localeToUse, options).format(number)}
|
||||
</span>
|
||||
Reference in new issue
Block a user