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

@@ -9,6 +9,8 @@
import { page } from '$app/stores'
import Switch from '$lib/components/input/Switch.svelte'
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
@@ -82,50 +84,55 @@
}
</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-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
on:submit|preventDefault={changePassword}
class="max-w-sm flex flex-col gap-4"
>
<TextInput
bind:value={oldPassword}
label="Current Password"
label={$t('form.profile.currentPassword')}
type="password"
minlength={10}
required
/>
<TextInput
bind:value={newPassword}
label="New Password"
label={$t('form.profile.newPassword')}
type="password"
minlength={10}
required
/>
<TextInput
bind:value={newPasswordVerify}
label="New Password (Verify)"
label={$t('form.profile.verifyNewPassword')}
type="password"
minlength={10}
required
/>
<Button size="lg" color="primary" submit {loading} disabled={loading}>
Submit
{$t('form.submit')}
</Button>
</form>
</div>
<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>
2FA is <span class="font-bold">
{totpEnabled ? 'enabled' : 'disabled'}
<span class="font-bold">
{totpEnabled ? $t('common.enabled') : $t('common.disabled')}
</span>
</p>
{#if totpEnabled || totpLink}
{#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
slot="suffix"
class="contents"
@@ -138,7 +145,7 @@
<Icon src={ClipboardDocument} size="20" mini />
</button>
<span class="font-normal text-xs">
Paste this in your authenticator app.
{$t('form.profile.2fa.paste')}
</span>
</TextInput>
{/if}
@@ -146,21 +153,21 @@
<TextInput
bind:value={verify_totp}
placeholder="012345"
label="2FA Code"
label={$t('form.2fa')}
/>
{#if totpEnabled}
<Button on:click={() => twofa(false, true)} size="lg" color="primary">
Disable
{$t('common.disabled')}
</Button>
{:else}
<Button on:click={() => twofa(true, true)} size="lg" color="primary">
Enable
{$t('common.enabled')}
</Button>
{/if}
</form>
{:else}
<Button on:click={() => twofa(true)} size="lg" color="primary">
Setup
{$t('form.setup')}
</Button>
{/if}
</div>
@@ -7,6 +7,8 @@
import type { SaveUserSettings } from 'lemmy-js-client'
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
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
@@ -141,50 +143,58 @@
action="Submit"
on:action={() => deleteAccount(4)}
>
<span slot="title">Delete account</span>
<span slot="title">{$t('form.profile.deleteAccount.label')}</span>
<TextInput
label="Password"
label={$t('form.password')}
type="password"
bind:value={deletion.password}
/>
<Checkbox bind:checked={deletion.deleteContent}>
Delete content
{$t('form.profile.deleteAccount.deleteContent')}
<span slot="description">
This will delete ALL of your account's posts and comments.
{$t('form.profile.deleteAccount.warning')}
</span>
</Checkbox>
</Modal>
{/if}
<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}
<TextInput
label="Display name"
label={$t('form.profile.displayName')}
bind:value={formData.display_name}
placeholder="Optional"
/>
<MarkdownEditor
images={false}
bind:value={formData.bio}
label="Bio"
label={$t('form.profile.bio')}
previewButton
/>
<ImageInput label="Profile Image" bind:files={profileImage} />
<ImageInput label="Banner Image" bind:files={bannerImage} />
<TextInput label="Email" bind:value={formData.email} />
<ImageInput label={$t('form.profile.avatar')} bind:files={profileImage} />
<ImageInput label={$t('form.profile.banner')} bind:files={bannerImage} />
<TextInput label={$t('form.profile.email')} bind:value={formData.email} />
<TextInput
label="Matrix User"
label={$t('form.profile.matrix')}
bind:value={formData.matrix_user_id}
placeholder="@user:example.com"
/>
<Checkbox bind:checked={formData.show_nsfw}>Show NSFW content</Checkbox>
<Checkbox bind:checked={formData.show_scores}>Show Scores</Checkbox>
<Checkbox bind:checked={formData.bot_account}>Bot Account</Checkbox>
<Checkbox bind:checked={formData.show_nsfw}>
{$t('form.profile.showNSFW')}
</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}>
Show Bot Accounts
{$t('form.profile.showBots')}
</Checkbox>
<Checkbox bind:checked={formData.show_read_posts}>
{$t('form.profile.showRead')}
</Checkbox>
<Checkbox bind:checked={formData.show_read_posts}>Show Read Posts</Checkbox>
<Button
submit
@@ -194,10 +204,8 @@
{loading}
disabled={loading}
>
Save
{$t('common.save')}
</Button>
{:else}
<Material padding="lg">The API didn't return your user settings.</Material>
{/if}
<Button
on:click={() => deleteAccount(0)}
@@ -205,6 +213,6 @@
size="lg"
class="ml-auto"
>
Delete account
{$t('form.profile.deleteAccount.label')}
</Button>
</form>