add more i18n

This commit is contained in:
ari melody 2026-02-25 17:26:24 +00:00
parent 47130ed6c2
commit a42ac20e2d
Signed by: ari
GPG key ID: CF99829C92678188
3 changed files with 87 additions and 58 deletions

View file

@ -13,5 +13,28 @@
"section_settings_mta": "Mail Transfer Settings",
"section_settings_version": "Running:",
"dashboard_n_accounts_active": "Active: {count}"
"dashboard_n_accounts_active": "Active: {count}",
"clipboard_email": "Email copied to clipboard.",
"account_configuration": "Account Configuration",
"account_actions": "Actions",
"account_action_send_email": "Send Email",
"account_action_reset_password": "Reset Password",
"account_action_delete_account": "Delete Account",
"account_action_delete_account_confirm": "Are you sure you wish to delete this account?\nThis action is irreversible.\n\nTo confirm, please enter {email}",
"account_action_delete_account_failed": "Failed to delete account:",
"account_action_delete_account_success": "Account deleted successfully.",
"account_details": "Details",
"account_detail_mail_directory": "Mail Directory:",
"warn_account_not_activated": "This account is not activated yet.",
"create_account": "Create Account",
"create_account_display_name": "Display Name",
"create_account_display_name_placeholder": "Example User",
"create_account_username": "Username",
"create_account_username_placeholder": "user",
"create_account_domain": "Domain",
"create_account_domain_placeholder": "example.org",
"create_account_failed": "Failed to create account:",
"create_account_succeess": "Account created successfully."
}

View file

@ -6,6 +6,7 @@
import Label from '@jupiter/components/ui/Label.svelte';
import { goto } from '$app/navigation';
import * as api from '@jupiter/lib/api';
import { m } from '@jupiter/paraglide/messages.js';
const { data } = $props();
@ -17,7 +18,7 @@
"text/plain": email,
})]);
pushToast("Email copied to clipboard.", ToastType.SUCCESS);
pushToast(m.clipboard_email(), ToastType.SUCCESS);
}
async function resetPassword() {
@ -25,21 +26,18 @@
}
async function deleteAccount() {
if (prompt(
"Are you sure you wish to delete this account? " +
"This action is irreversible.\n\n" +
`To confirm, please enter ${email}:`) !== email) return;
if (prompt(m.account_action_delete_account_confirm({ email })) !== email) return;
const res = await fetch(api.BASE_URL + "/api/v1/accounts/" + email, {
method: "DELETE",
})
if (!res.ok) {
const text = await res.text();
pushToast("Failed to delete account: " + text, ToastType.ERROR);
pushToast(m.account_action_delete_account_failed() + " " + text, ToastType.ERROR);
return
}
pushToast("Account deleted successfully.", ToastType.SUCCESS);
pushToast(m.account_action_delete_account_success(), ToastType.SUCCESS);
goto("/accounts");
}
</script>
@ -47,11 +45,10 @@
<div class="page-container">
<Header>
<User />
<h1>Account Configuration</h1>
<h1>{m.account_configuration()}</h1>
</Header>
<main>
{#if account}
<div class="account-title-container">
<div class="account-title-icon">
<User />
@ -71,25 +68,26 @@
<hr>
{#if !account.activated}
<p class="warning">* This account is not activated yet.</p>
<p class="warning">{m.warn_account_not_activated()}</p>
{/if}
<Label>Actions</Label>
<Label>{m.account_actions()}</Label>
<div class="account-actions">
<Button href="mailto:{email}"><Mail /> Send Email</Button>
<Button onclick={() => resetPassword()}><KeyRound /> Reset Password</Button>
<Button href="mailto:{email}">
<Mail /> {m.account_action_send_email()}
</Button>
<Button onclick={() => resetPassword()}>
<KeyRound /> {m.account_action_reset_password()}
</Button>
<Button onclick={() => deleteAccount()} class="delete">
<Trash /> Delete Account
<Trash /> {m.account_action_delete_account()}
</Button>
</div>
<Label>Details</Label>
<Label>{m.account_details()}</Label>
<div class="account-details">
<p>Mail Directory: <code>{account.mail_directory}</code></p>
<p>{m.account_detail_mail_directory()} <code>{account.mail_directory}</code></p>
</div>
{:else}
<p>Just a moment...</p>
{/if}
</main>
</div>

View file

@ -8,6 +8,7 @@
import { type Account } from '@jupiter/lib/account';
import AccountListItem from '@jupiter/components/ui/AccountListItem.svelte';
import { goto } from '$app/navigation';
import { m } from '@jupiter/paraglide/messages';
let domainInput: HTMLInputElement;
@ -35,12 +36,12 @@
});
if (!res.ok) {
const text = await res.text();
const err = new Error("Failed to create account: " + text);
const err = new Error(m.create_account_failed() + " " + text);
pushToast(err.message, ToastType.ERROR);
throw err;
}
pushToast("Account created successfully.", ToastType.SUCCESS);
pushToast(m.create_account_succeess(), ToastType.SUCCESS);
goto("/accounts");
}
@ -50,18 +51,21 @@
<div class="page-container">
<Header>
<UserRoundPlus />
<h1>Create Account</h1>
<h1>{m.create_account()}</h1>
</Header>
<main>
<div class="form">
<Label>Display Name</Label>
<input type="text" placeholder="Example User" bind:value={newAccount.display_name}>
<Label>Username</Label>
<Label>{m.create_account_display_name()}</Label>
<input
type="text"
placeholder="user"
placeholder="{m.create_account_display_name_placeholder()}"
bind:value={newAccount.display_name}>
<Label>{m.create_account_username()}</Label>
<input
type="text"
placeholder="{m.create_account_username_placeholder()}"
bind:value={newAccount.username}
onkeydown={(event: KeyboardEvent) => {
if (event.key === "@") {
@ -70,12 +74,16 @@
}
}}>
<Label>Domain</Label>
<input type="text" placeholder="example.org" bind:value={newAccount.domain} bind:this={domainInput}>
<Label>{m.create_account_domain()}</Label>
<input
type="text"
placeholder="{m.create_account_domain_placeholder()}"
bind:value={newAccount.domain}
bind:this={domainInput}>
<AccountListItem account={newAccount} />
<Button onclick={() => {createAccount()}}>Create Account</Button>
<Button onclick={() => {createAccount()}}>{m.create_account()}</Button>
</div>
</main>
</div>