i18n: localize admin config page
This commit is contained in:
1 parent
0493c44344
commit
62901081ab
4 files changed
+147
-69
No files matched your search
+49
-1
@@ -162,7 +162,8 @@
|
||||
"description": "This instance has registrations closed. Find another instance.",
|
||||
"anotherInstance": "Find another instance"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Description"
|
||||
},
|
||||
"routes": {
|
||||
"frontpage": {
|
||||
@@ -229,6 +230,53 @@
|
||||
"resolve": "Resolve",
|
||||
"unresolve": "Unresolve"
|
||||
},
|
||||
"admin": {
|
||||
"title": "Administration",
|
||||
"config": {
|
||||
"title": "Configuration",
|
||||
"sidebar": "Sidebar",
|
||||
"icon": "Icon",
|
||||
"banner": "Banner",
|
||||
"downvotesEnabled": "Enable Downvotes",
|
||||
"nsfwEnabled": "Enable NSFW",
|
||||
"registration": {
|
||||
"label": "Registration Mode",
|
||||
"open": "Open",
|
||||
"application": "Require Application",
|
||||
"closed": "Closed"
|
||||
},
|
||||
"applicationQuestion": "Application Question",
|
||||
"adminCommunityOnly": "Only admins can create communities",
|
||||
"requireVerifyEmail": "Require email verification",
|
||||
"emailAdminsOnApplication": "Email admins on receiving new applications",
|
||||
"emailAdminsOnReport": "Email admins on receiving new reports",
|
||||
"listingType": {
|
||||
"label": "Listing Type",
|
||||
"all": "All",
|
||||
"local": "Local"
|
||||
},
|
||||
"private": "Private instance",
|
||||
"hideModlogModNames": "Hide modlog mod names",
|
||||
"slurFilter": "Slur filter regex",
|
||||
"federation": "Federation enabled",
|
||||
"federationDebug": "Federation debug mode",
|
||||
"captcha": {
|
||||
"enabled": "Enabled"
|
||||
}
|
||||
},
|
||||
"applications": {
|
||||
"title": "Applications"
|
||||
},
|
||||
"taglines": {
|
||||
"title": "Taglines"
|
||||
},
|
||||
"team": {
|
||||
"title": "Team"
|
||||
},
|
||||
"federation": {
|
||||
"title": "Federation"
|
||||
}
|
||||
},
|
||||
"verifyEmail": {
|
||||
"message": "Your email was verified. You can now close this window.",
|
||||
"error": "Failed to verify your email."
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { page } from '$app/stores'
|
||||
import { profile } from '$lib/auth'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import { Badge } from 'mono-svelte'
|
||||
</script>
|
||||
|
||||
@@ -24,11 +25,11 @@
|
||||
'/admin/federation',
|
||||
]}
|
||||
optionNames={[
|
||||
'Configuration',
|
||||
'Applications',
|
||||
'Taglines',
|
||||
'Team',
|
||||
'Federation',
|
||||
$t('routes.admin.config.title'),
|
||||
$t('routes.admin.applications.title'),
|
||||
$t('routes.admin.taglines.title'),
|
||||
$t('routes.admin.team.title'),
|
||||
$t('routes.admin.federation.title'),
|
||||
]}
|
||||
selected={$page.url.pathname}
|
||||
on:select={(e) => {
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { Label, toast } from 'mono-svelte'
|
||||
import { Label, Switch, toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { EditSite } from 'lemmy-js-client'
|
||||
import type { PageData } from './$types.js'
|
||||
import { Button, Checkbox, Select, TextInput } from 'mono-svelte'
|
||||
import ImageUploadModal from '$lib/components/lemmy/modal/ImageUploadModal.svelte';
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons';
|
||||
import ImageUploadModal from '$lib/components/lemmy/modal/ImageUploadModal.svelte'
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data: PageData
|
||||
|
||||
@@ -46,136 +48,163 @@
|
||||
|
||||
let uploading = {
|
||||
icon: false,
|
||||
banner: false
|
||||
banner: false,
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Administration</title>
|
||||
<title>{$t('routes.admin.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<form class="flex flex-col gap-4" on:submit|preventDefault={save}>
|
||||
<h1 class="font-bold text-2xl">Site configuration</h1>
|
||||
<Header>{$t('routes.admin.config.title')}</Header>
|
||||
{#if formData}
|
||||
<TextInput bind:value={formData.name} label="Name" />
|
||||
<TextInput bind:value={formData.description} label="Description" />
|
||||
<TextInput bind:value={formData.name} label={$t('form.name')} />
|
||||
<TextInput
|
||||
bind:value={formData.description}
|
||||
label={$t('form.description')}
|
||||
/>
|
||||
<MarkdownEditor
|
||||
previewButton
|
||||
bind:value={formData.sidebar}
|
||||
label="Sidebar"
|
||||
label={$t('routes.admin.config.sidebar')}
|
||||
/>
|
||||
<MarkdownEditor
|
||||
previewButton
|
||||
bind:value={formData.legal_information}
|
||||
label="Legal"
|
||||
label={$t('routes.legal.title')}
|
||||
/>
|
||||
<div class="flex flex-col gap-1">
|
||||
<Label>Icon</Label>
|
||||
<button type="button" on:click={() => uploading.icon = !uploading.icon} class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl">
|
||||
<Label>{$t('routes.admin.config.icon')}</Label>
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (uploading.icon = !uploading.icon)}
|
||||
class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl"
|
||||
>
|
||||
{#if formData.icon}
|
||||
<img src={formData.icon} class="rounded-md mx-auto h-full" />
|
||||
{:else}
|
||||
<Icon src={DocumentPlus} size="48" class="text-slate-500 dark:text-zinc-500 mx-auto my-auto" />
|
||||
<Icon
|
||||
src={DocumentPlus}
|
||||
size="48"
|
||||
class="text-slate-500 dark:text-zinc-500 mx-auto my-auto"
|
||||
/>
|
||||
{/if}
|
||||
</button>
|
||||
{#if uploading.icon}
|
||||
<ImageUploadModal
|
||||
bind:open={uploading.icon}
|
||||
bind:output={formData.icon}
|
||||
on:upload={() => uploading.icon = false}
|
||||
on:upload={() => (uploading.icon = false)}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<Label>Banner</Label>
|
||||
<button type="button" on:click={() => uploading.banner = !uploading.banner} class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl">
|
||||
<Label>{$t('routes.admin.config.banner')}</Label>
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (uploading.banner = !uploading.banner)}
|
||||
class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl"
|
||||
>
|
||||
{#if formData.banner}
|
||||
<img src={formData.banner} class="rounded-md mx-auto h-full" />
|
||||
{:else}
|
||||
<Icon src={DocumentPlus} size="48" class="text-slate-500 dark:text-zinc-500 mx-auto my-auto" />
|
||||
<Icon
|
||||
src={DocumentPlus}
|
||||
size="48"
|
||||
class="text-slate-500 dark:text-zinc-500 mx-auto my-auto"
|
||||
/>
|
||||
{/if}
|
||||
</button>
|
||||
{#if uploading.banner}
|
||||
<ImageUploadModal
|
||||
bind:open={uploading.banner}
|
||||
bind:output={formData.banner}
|
||||
on:upload={() => uploading.banner = false}
|
||||
on:upload={() => (uploading.banner = false)}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<Checkbox bind:checked={formData.enable_downvotes} defaultValue={true}>
|
||||
Enable downvotes
|
||||
</Checkbox>
|
||||
<Checkbox checked={formData.enable_nsfw} defaultValue={true}>
|
||||
Enable NSFW
|
||||
</Checkbox>
|
||||
<Switch bind:checked={formData.enable_downvotes} defaultValue={true}>
|
||||
{$t('routes.admin.config.downvotesEnabled')}
|
||||
</Switch>
|
||||
<Switch checked={formData.enable_nsfw} defaultValue={true}>
|
||||
{$t('routes.admin.config.nsfwEnabled')}
|
||||
</Switch>
|
||||
<Select
|
||||
label="Registration Mode"
|
||||
label={$t('routes.admin.config.registration.label')}
|
||||
bind:value={formData.registration_mode}
|
||||
class="w-max"
|
||||
>
|
||||
<option value="Open">Open</option>
|
||||
<option value="RequireApplication">Require Application</option>
|
||||
<option value="Closed">Closed</option>
|
||||
<option value="Open">
|
||||
{$t('routes.admin.config.registration.open')}
|
||||
</option>
|
||||
<option value="RequireApplication">
|
||||
{$t('routes.admin.config.registration.application')}
|
||||
</option>
|
||||
<option value="Closed">
|
||||
{$t('routes.admin.config.registration.closed')}
|
||||
</option>
|
||||
</Select>
|
||||
{#if formData.registration_mode == 'RequireApplication'}
|
||||
<MarkdownEditor
|
||||
previewButton
|
||||
label="Application question"
|
||||
label={$t('routes.admin.config.applicationQuestion')}
|
||||
bind:value={formData.application_question}
|
||||
/>
|
||||
{/if}
|
||||
<Checkbox
|
||||
<Switch
|
||||
bind:checked={formData.community_creation_admin_only}
|
||||
defaultValue={true}
|
||||
>
|
||||
Only admins can create communities
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
{$t('routes.admin.config.adminCommunityOnly')}
|
||||
</Switch>
|
||||
<Switch
|
||||
bind:checked={formData.require_email_verification}
|
||||
defaultValue={true}
|
||||
>
|
||||
Require email verification
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
{$t('routes.admin.config.requireVerifyEmail')}
|
||||
</Switch>
|
||||
<Switch
|
||||
bind:checked={formData.application_email_admins}
|
||||
defaultValue={true}
|
||||
>
|
||||
Email admins on receiving new applications
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.reports_email_admins} defaultValue={true}>
|
||||
Email admins on receiving new reports
|
||||
</Checkbox>
|
||||
{$t('routes.admin.config.emailAdminsOnApplication')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.reports_email_admins} defaultValue={true}>
|
||||
{$t('routes.admin.config.emailAdminsOnReport')}
|
||||
</Switch>
|
||||
<Select
|
||||
label="Listing Type"
|
||||
label={$t('routes.admin.config.listingType.label')}
|
||||
bind:value={formData.default_post_listing_type}
|
||||
class="w-max"
|
||||
>
|
||||
<option value="All">All</option>
|
||||
<option value="Local">Local</option>
|
||||
<option value="All">{$t('routes.admin.config.listingType.all')}</option>
|
||||
<option value="Local">
|
||||
{$t('routes.admin.config.listingType.local')}
|
||||
</option>
|
||||
</Select>
|
||||
<Checkbox bind:checked={formData.private_instance} defaultValue={true}>
|
||||
Private instance
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.hide_modlog_mod_names} defaultValue={true}>
|
||||
Hide modlog mod names
|
||||
</Checkbox>
|
||||
<Switch bind:checked={formData.private_instance} defaultValue={true}>
|
||||
{$t('routes.admin.config.private')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.hide_modlog_mod_names} defaultValue={true}>
|
||||
{$t('routes.admin.config.hideModlogModNames')}
|
||||
</Switch>
|
||||
<TextInput
|
||||
bind:value={formData.slur_filter_regex}
|
||||
label="Slur filter regex"
|
||||
label={$t('routes.admin.config.slurFilter')}
|
||||
placeholder="(word1|word2)"
|
||||
/>
|
||||
<Checkbox bind:checked={formData.federation_enabled} defaultValue={true}>
|
||||
Federation enabled
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.federation_debug} defaultValue={false}>
|
||||
Federation debug mode
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.captcha_enabled} defaultValue={false}>
|
||||
Captcha enabled
|
||||
</Checkbox>
|
||||
<Switch bind:checked={formData.federation_enabled} defaultValue={true}>
|
||||
{$t('routes.admin.config.federation')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.federation_debug} defaultValue={false}>
|
||||
{$t('routes.admin.config.federationDebug')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.captcha_enabled} defaultValue={false}>
|
||||
{$t('routes.admin.config.captcha.enabled')}
|
||||
</Switch>
|
||||
{/if}
|
||||
<Button color="primary" size="lg" loading={saving} disabled={saving} submit>
|
||||
Save
|
||||
{$t('common.save')}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -103,8 +103,8 @@
|
||||
<p slot="description">
|
||||
The language used for Photon's UI.
|
||||
<Note>
|
||||
All languages other than US English are community translated, and may
|
||||
be incomplete!
|
||||
All languages other than US English and Hebrew are community
|
||||
translated, and may be incomplete!
|
||||
</Note>
|
||||
</p>
|
||||
<Select bind:value={$userSettings.language}>
|
||||
|
||||
Reference in new issue
Block a user