i18n: localize profile pages

This commit is contained in:
Xylight committed 2024-06-03 17:53:44 -07:00
1 parent bcc007ad61
commit 96d4e5dd35
3 files changed
+84 -37

No files matched your search

+34 -2
View File
@@ -118,7 +118,34 @@
"nsfw": "NSFW", "nsfw": "NSFW",
"generateTitle": "Generate Title", "generateTitle": "Generate Title",
"uploadImage": "Upload Image" "uploadImage": "Upload Image"
} },
"profile": {
"displayName": "Display name",
"bio": "Bio",
"avatar": "Avatar",
"banner": "Banner",
"email": "Email",
"matrix": "Matrix User",
"showNSFW": "Show NSFW content",
"scores": "Show Scores",
"bot": "Bot Account",
"showBots": "Show Bots",
"showRead": "Show Read Posts",
"currentPassword": "Current Password",
"newPassword": "New Password",
"verifyNewPassword": "Verify New Password",
"2fa": {
"totp": "TOTP",
"2fa": "2FA",
"paste": "Paste this in your authenticator app."
},
"deleteAccount": {
"label": "Delete account",
"deleteContent": "Delete content",
"warning": "This will delete ALL of your submissions."
}
},
"setup": "Setup"
}, },
"routes": { "routes": {
"frontpage": { "frontpage": {
@@ -244,6 +271,11 @@
"next": "Next", "next": "Next",
"debug": "Debug", "debug": "Debug",
"refresh": "Refresh", "refresh": "Refresh",
"jump": "Jump" "jump": "Jump",
"save": "Save",
"enabled": "Enabled",
"disabled": "Disabled",
"enable": "Enable",
"disable": "Disable"
} }
} }
@@ -9,6 +9,8 @@
import { page } from '$app/stores' import { page } from '$app/stores'
import Switch from '$lib/components/input/Switch.svelte' import Switch from '$lib/components/input/Switch.svelte'
import { feature } from '$lib/version.js' import { feature } from '$lib/version.js'
import { t } from '$lib/translations.js'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
export let data export let data
@@ -82,50 +84,55 @@
} }
</script> </script>
<h1 class="font-bold text-3xl">Credentials</h1> <h1 class="font-bold text-3xl">{$t('routes.profile.credentials')}</h1>
<div class="flex flex-row flex-wrap gap-8"> <div class="flex flex-row flex-wrap gap-8">
<div class="flex flex-col gap-2 max-w-sm w-full"> <div class="flex flex-col gap-2 max-w-sm w-full">
<h1 class="font-bold text-2xl">Password</h1> <h1 class="font-bold text-2xl">{$t('form.password')}</h1>
<form <form
on:submit|preventDefault={changePassword} on:submit|preventDefault={changePassword}
class="max-w-sm flex flex-col gap-4" class="max-w-sm flex flex-col gap-4"
> >
<TextInput <TextInput
bind:value={oldPassword} bind:value={oldPassword}
label="Current Password" label={$t('form.profile.currentPassword')}
type="password" type="password"
minlength={10} minlength={10}
required required
/> />
<TextInput <TextInput
bind:value={newPassword} bind:value={newPassword}
label="New Password" label={$t('form.profile.newPassword')}
type="password" type="password"
minlength={10} minlength={10}
required required
/> />
<TextInput <TextInput
bind:value={newPasswordVerify} bind:value={newPasswordVerify}
label="New Password (Verify)" label={$t('form.profile.verifyNewPassword')}
type="password" type="password"
minlength={10} minlength={10}
required required
/> />
<Button size="lg" color="primary" submit {loading} disabled={loading}> <Button size="lg" color="primary" submit {loading} disabled={loading}>
Submit {$t('form.submit')}
</Button> </Button>
</form> </form>
</div> </div>
<div class="flex flex-col gap-4 max-w-sm w-full"> <div class="flex flex-col gap-4 max-w-sm w-full">
<h1 class="font-bold text-2xl">2FA</h1> <Header>{$t('form.profile.2fa.2fa')}</Header>
<p> <p>
2FA is <span class="font-bold"> <span class="font-bold">
{totpEnabled ? 'enabled' : 'disabled'} {totpEnabled ? $t('common.enabled') : $t('common.disabled')}
</span> </span>
</p> </p>
{#if totpEnabled || totpLink} {#if totpEnabled || totpLink}
{#if totpLink && !totpEnabled} {#if totpLink && !totpEnabled}
<TextInput disabled type="password" value={totpLink} label="TOTP Link"> <TextInput
disabled
type="password"
value={totpLink}
label={$t('form.profile.2fa.totp')}
>
<button <button
slot="suffix" slot="suffix"
class="contents" class="contents"
@@ -138,7 +145,7 @@
<Icon src={ClipboardDocument} size="20" mini /> <Icon src={ClipboardDocument} size="20" mini />
</button> </button>
<span class="font-normal text-xs"> <span class="font-normal text-xs">
Paste this in your authenticator app. {$t('form.profile.2fa.paste')}
</span> </span>
</TextInput> </TextInput>
{/if} {/if}
@@ -146,21 +153,21 @@
<TextInput <TextInput
bind:value={verify_totp} bind:value={verify_totp}
placeholder="012345" placeholder="012345"
label="2FA Code" label={$t('form.2fa')}
/> />
{#if totpEnabled} {#if totpEnabled}
<Button on:click={() => twofa(false, true)} size="lg" color="primary"> <Button on:click={() => twofa(false, true)} size="lg" color="primary">
Disable {$t('common.disabled')}
</Button> </Button>
{:else} {:else}
<Button on:click={() => twofa(true, true)} size="lg" color="primary"> <Button on:click={() => twofa(true, true)} size="lg" color="primary">
Enable {$t('common.enabled')}
</Button> </Button>
{/if} {/if}
</form> </form>
{:else} {:else}
<Button on:click={() => twofa(true)} size="lg" color="primary"> <Button on:click={() => twofa(true)} size="lg" color="primary">
Setup {$t('form.setup')}
</Button> </Button>
{/if} {/if}
</div> </div>
@@ -7,6 +7,8 @@
import type { SaveUserSettings } from 'lemmy-js-client' import type { SaveUserSettings } from 'lemmy-js-client'
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte' import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
import { uploadImage } from '$lib/util.js' import { uploadImage } from '$lib/util.js'
import { t } from '$lib/translations.js'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
export let data export let data
@@ -141,50 +143,58 @@
action="Submit" action="Submit"
on:action={() => deleteAccount(4)} on:action={() => deleteAccount(4)}
> >
<span slot="title">Delete account</span> <span slot="title">{$t('form.profile.deleteAccount.label')}</span>
<TextInput <TextInput
label="Password" label={$t('form.password')}
type="password" type="password"
bind:value={deletion.password} bind:value={deletion.password}
/> />
<Checkbox bind:checked={deletion.deleteContent}> <Checkbox bind:checked={deletion.deleteContent}>
Delete content {$t('form.profile.deleteAccount.deleteContent')}
<span slot="description"> <span slot="description">
This will delete ALL of your account's posts and comments. {$t('form.profile.deleteAccount.warning')}
</span> </span>
</Checkbox> </Checkbox>
</Modal> </Modal>
{/if} {/if}
<form class="flex flex-col gap-4 h-full" on:submit|preventDefault={save}> <form class="flex flex-col gap-4 h-full" on:submit|preventDefault={save}>
<h1 class="font-bold text-2xl">User settings</h1> <Header>{$t('routes.profile.settings')}</Header>
{#if data.my_user?.local_user_view?.local_user && formData} {#if data.my_user?.local_user_view?.local_user && formData}
<TextInput <TextInput
label="Display name" label={$t('form.profile.displayName')}
bind:value={formData.display_name} bind:value={formData.display_name}
placeholder="Optional" placeholder="Optional"
/> />
<MarkdownEditor <MarkdownEditor
images={false} images={false}
bind:value={formData.bio} bind:value={formData.bio}
label="Bio" label={$t('form.profile.bio')}
previewButton previewButton
/> />
<ImageInput label="Profile Image" bind:files={profileImage} /> <ImageInput label={$t('form.profile.avatar')} bind:files={profileImage} />
<ImageInput label="Banner Image" bind:files={bannerImage} /> <ImageInput label={$t('form.profile.banner')} bind:files={bannerImage} />
<TextInput label="Email" bind:value={formData.email} /> <TextInput label={$t('form.profile.email')} bind:value={formData.email} />
<TextInput <TextInput
label="Matrix User" label={$t('form.profile.matrix')}
bind:value={formData.matrix_user_id} bind:value={formData.matrix_user_id}
placeholder="@user:example.com" placeholder="@user:example.com"
/> />
<Checkbox bind:checked={formData.show_nsfw}>Show NSFW content</Checkbox> <Checkbox bind:checked={formData.show_nsfw}>
<Checkbox bind:checked={formData.show_scores}>Show Scores</Checkbox> {$t('form.profile.showNSFW')}
<Checkbox bind:checked={formData.bot_account}>Bot Account</Checkbox> </Checkbox>
<Checkbox bind:checked={formData.show_scores}>
{$t('form.profile.scores')}
</Checkbox>
<Checkbox bind:checked={formData.bot_account}>
{$t('form.profile.bot')}
</Checkbox>
<Checkbox bind:checked={formData.show_bot_accounts}> <Checkbox bind:checked={formData.show_bot_accounts}>
Show Bot Accounts {$t('form.profile.showBots')}
</Checkbox>
<Checkbox bind:checked={formData.show_read_posts}>
{$t('form.profile.showRead')}
</Checkbox> </Checkbox>
<Checkbox bind:checked={formData.show_read_posts}>Show Read Posts</Checkbox>
<Button <Button
submit submit
@@ -194,10 +204,8 @@
{loading} {loading}
disabled={loading} disabled={loading}
> >
Save {$t('common.save')}
</Button> </Button>
{:else}
<Material padding="lg">The API didn't return your user settings.</Material>
{/if} {/if}
<Button <Button
on:click={() => deleteAccount(0)} on:click={() => deleteAccount(0)}
@@ -205,6 +213,6 @@
size="lg" size="lg"
class="ml-auto" class="ml-auto"
> >
Delete account {$t('form.profile.deleteAccount.label')}
</Button> </Button>
</form> </form>