i18n: localize explore and search pages

This commit is contained in:
Xylight committed 2024-06-03 16:54:32 -07:00
1 parent 2aaacf07a7
commit 9089dd9ac3
4 files changed
+36 -37

No files matched your search

@@ -1,3 +1,3 @@
<h1 class="text-3xl font-bold flex items-center"> <h1 class="text-3xl font-bold flex items-center gap-2">
<slot /> <slot />
</h1> </h1>
+11
View File
@@ -118,6 +118,17 @@
"moderates": "Moderates" "moderates": "Moderates"
}, },
"accounts": "Accounts", "accounts": "Accounts",
"communities": "Communities",
"search": {
"title": "Search",
"federating": "Federating",
"query": "Query",
"noResults": {
"title": "No Results",
"description": "There are no results that match that filter. Try refining your search.",
"alt": "Search across the fediverse"
}
},
"post": { "post": {
"crosspostCount": "crossposts", "crosspostCount": "crossposts",
"commentCount": "comments", "commentCount": "comments",
+10 -20
View File
@@ -13,6 +13,9 @@
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte' import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte' import Placeholder from '$lib/components/ui/Placeholder.svelte'
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte' import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
import { t } from '$lib/translations.js'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
export let data export let data
@@ -24,8 +27,8 @@
<title>Communities</title> <title>Communities</title>
</svelte:head> </svelte:head>
<h1 class="text-3xl font-bold"> <Header>
<span>Communities</span> <span>{$t('routes.communities')}</span>
<Popover <Popover
openOnHover openOnHover
class="!inline-flex" class="!inline-flex"
@@ -52,20 +55,9 @@
</p> </p>
</Material> </Material>
</Popover> </Popover>
</h1> </Header>
<div class="flex flex-row flex-wrap gap-4 mt-4 items-center"> <div class="flex flex-row flex-wrap gap-4 mt-4 items-center">
<Select <Location selected={data.type} />
bind:value={data.type}
on:change={() => searchParam($page.url, 'type', data.type ?? 'All', 'page')}
>
<span slot="label" class="flex items-center gap-1">
<Icon src={GlobeAmericas} mini size="15" />
Location
</span>
<option value="All">All</option>
<option value="Local">Local</option>
<option value="Subscribed">Subscribed</option>
</Select>
<Sort selected={data.sort} /> <Sort selected={data.sort} />
<form <form
on:submit|preventDefault={() => searchParam($page.url, 'q', search, 'page')} on:submit|preventDefault={() => searchParam($page.url, 'q', search, 'page')}
@@ -73,8 +65,7 @@
> >
<TextInput <TextInput
bind:value={search} bind:value={search}
placeholder="Search for a community..." label={$t('routes.search.query')}
label="Query"
size="md" size="md"
/> />
<Button <Button
@@ -93,9 +84,8 @@
{#if data.communities.length == 0} {#if data.communities.length == 0}
<Placeholder <Placeholder
icon={QuestionMarkCircle} icon={QuestionMarkCircle}
title="No communities" title={$t('routes.search.noResults.title')}
description="There are no communities that match this filter. Try refining your description={$t('routes.search.noResults.description')}
search."
/> />
{/if} {/if}
{#each data.communities as community} {#each data.communities as community}
+14 -16
View File
@@ -33,6 +33,7 @@
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import { expoOut } from 'svelte/easing' import { expoOut } from 'svelte/easing'
import { slide } from 'svelte/transition' import { slide } from 'svelte/transition'
import { t } from '$lib/translations.js'
type Result = PostView | CommentView | PersonView | CommunityView type Result = PostView | CommentView | PersonView | CommunityView
@@ -57,25 +58,20 @@
> >
<span slot="label" class="flex items-center gap-1"> <span slot="label" class="flex items-center gap-1">
<Icon src={AdjustmentsHorizontal} mini size="15" /> <Icon src={AdjustmentsHorizontal} mini size="15" />
Filter {$t('filter.type')}
</span> </span>
<option value="All">All</option> <option value="All">{$t('content.all')}</option>
<option value="Posts">Posts</option> <option value="Posts">{$t('content.posts')}</option>
<option value="Comments">Comments</option> <option value="Comments">{$t('content.comments')}</option>
<option value="Communities">Communities</option> <option value="Communities">{$t('content.communities')}</option>
<option value="Users">Users</option> <option value="Users">{$t('content.users')}</option>
</Select> </Select>
<Sort navigate bind:selected={data.sort} /> <Sort navigate bind:selected={data.sort} />
<form <form
on:submit|preventDefault={() => searchParam($page.url, 'q', query, 'page')} on:submit|preventDefault={() => searchParam($page.url, 'q', query, 'page')}
class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center" class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center"
> >
<TextInput <TextInput bind:value={query} label={$t('routes.search.query')} size="md" />
bind:value={query}
placeholder="Search for a keyword..."
label="Query"
size="md"
/>
<Button <Button
submit submit
color="secondary" color="secondary"
@@ -100,7 +96,7 @@
{#if moreOptions} {#if moreOptions}
<div transition:slide={{ axis: 'y', easing: expoOut }} class="max-w-sm"> <div transition:slide={{ axis: 'y', easing: expoOut }} class="max-w-sm">
<ObjectAutocomplete <ObjectAutocomplete
label="Community" label={$t('nav.create.community')}
jwt={$profile?.jwt} jwt={$profile?.jwt}
listing_type={'All'} listing_type={'All'}
showWhenEmpty={true} showWhenEmpty={true}
@@ -112,8 +108,10 @@
{#if !data.results} {#if !data.results}
<Placeholder <Placeholder
icon={MagnifyingGlass} icon={MagnifyingGlass}
title="No results" title={$t('routes.search.noResults.title')}
description="Search across the fediverse" description={query == ''
? $t('routes.search.noResults.alt')
: $t('routes.search.noResults.description')}
class="pt-4" class="pt-4"
/> />
{:else} {:else}
@@ -123,7 +121,7 @@
out:slide={{ axis: 'y', easing: expoOut }} out:slide={{ axis: 'y', easing: expoOut }}
> >
<Spinner width={24} /> <Spinner width={24} />
<span>Federating...</span> <span>{$t('routes.search.federating')}</span>
</div> </div>
{:then object} {:then object}
{#if object} {#if object}