From 96d4e5dd358225a27463f8fc5e9232c9b342707b Mon Sep 17 00:00:00 2001 From: Xylight Date: Mon, 3 Jun 2024 17:53:44 -0700 Subject: [PATCH] i18n: localize profile pages --- src/lib/i18n/en.json | 36 +++++++++++++- .../(local_user)/password/+page.svelte | 37 ++++++++------ .../(local_user)/settings/+page.svelte | 48 +++++++++++-------- 3 files changed, 84 insertions(+), 37 deletions(-) diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index 9365aa7f..eeabd03e 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -118,7 +118,34 @@ "nsfw": "NSFW", "generateTitle": "Generate Title", "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": { "frontpage": { @@ -244,6 +271,11 @@ "next": "Next", "debug": "Debug", "refresh": "Refresh", - "jump": "Jump" + "jump": "Jump", + "save": "Save", + "enabled": "Enabled", + "disabled": "Disabled", + "enable": "Enable", + "disable": "Disable" } } diff --git a/src/routes/profile/(local_user)/password/+page.svelte b/src/routes/profile/(local_user)/password/+page.svelte index 66bfec04..0bca28f9 100644 --- a/src/routes/profile/(local_user)/password/+page.svelte +++ b/src/routes/profile/(local_user)/password/+page.svelte @@ -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 @@ } -

Credentials

+

{$t('routes.profile.credentials')}

-

Password

+

{$t('form.password')}

-

2FA

+
{$t('form.profile.2fa.2fa')}

- 2FA is - {totpEnabled ? 'enabled' : 'disabled'} + + {totpEnabled ? $t('common.enabled') : $t('common.disabled')}

{#if totpEnabled || totpLink} {#if totpLink && !totpEnabled} - + - Paste this in your authenticator app. + {$t('form.profile.2fa.paste')} {/if} @@ -146,21 +153,21 @@ {#if totpEnabled} {:else} {/if} {:else} {/if}
diff --git a/src/routes/profile/(local_user)/settings/+page.svelte b/src/routes/profile/(local_user)/settings/+page.svelte index 7dd5978a..55b30a08 100644 --- a/src/routes/profile/(local_user)/settings/+page.svelte +++ b/src/routes/profile/(local_user)/settings/+page.svelte @@ -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)} > - Delete account + {$t('form.profile.deleteAccount.label')} - Delete content + {$t('form.profile.deleteAccount.deleteContent')} - This will delete ALL of your account's posts and comments. + {$t('form.profile.deleteAccount.warning')} {/if}
-

User settings

+
{$t('routes.profile.settings')}
{#if data.my_user?.local_user_view?.local_user && formData} - - - + + + - Show NSFW content - Show Scores - Bot Account + + {$t('form.profile.showNSFW')} + + + {$t('form.profile.scores')} + + + {$t('form.profile.bot')} + - Show Bot Accounts + {$t('form.profile.showBots')} + + + {$t('form.profile.showRead')} - Show Read Posts - {:else} - The API didn't return your user settings. {/if}