diff --git a/src/lib/components/account/ChangePassword.svelte b/src/lib/components/account/ChangePassword.svelte
index 4bda0961..7e006619 100644
--- a/src/lib/components/account/ChangePassword.svelte
+++ b/src/lib/components/account/ChangePassword.svelte
@@ -3,6 +3,7 @@
import { page } from "$app/stores";
import { getToastStore } from "@skeletonlabs/skeleton";
import PasswordInput from "../PasswordInput.svelte";
+ import { t } from "svelte-i18n";
const toastStore = getToastStore();
@@ -18,14 +19,14 @@
use:enhance={() => {
return async ({ result, update }) => {
if (result.type === "success") {
- const t = {
- message: "Password updated successfully",
+ const toastSettings = {
+ message: $t("auth.password-updated-successfully"),
autohide: true,
timeout: 5000
};
passwordReset.current = "";
- toastStore.trigger(t);
+ toastStore.trigger(toastSettings);
}
passwordReset.new = "";
@@ -39,14 +40,14 @@
id="oldpassword"
name="oldPassword"
autocomplete="current-password"
- label="Current Password"
+ label={$t("auth.current-password")}
bind:value={passwordReset.current}
/>
@@ -56,11 +57,11 @@
id="confirmpassword"
name="newPassword"
autocomplete="new-password"
- label="Confirm Password"
+ label={$t("auth.confirm-password")}
bind:value={passwordReset.confirm}
/>
{#if passwordReset.new !== passwordReset.confirm}
-
Passwords must match
+
{$t("auth.passwords-must-match")}
{/if}
{#if $page.form?.error && $page.form?.errors}
diff --git a/src/lib/components/account/EditProfile.svelte b/src/lib/components/account/EditProfile.svelte
index 802df58f..f7e8459e 100644
--- a/src/lib/components/account/EditProfile.svelte
+++ b/src/lib/components/account/EditProfile.svelte
@@ -2,6 +2,7 @@
import { enhance } from "$app/forms";
import { page } from "$app/stores";
import type { User } from "lucia";
+ import { t } from "svelte-i18n";
interface Props {
user: User;
@@ -13,7 +14,7 @@
diff --git a/src/lib/components/admin/Actions/ClearListsButton.svelte b/src/lib/components/admin/Actions/ClearListsButton.svelte
index 8d3e20d8..cf959e69 100644
--- a/src/lib/components/admin/Actions/ClearListsButton.svelte
+++ b/src/lib/components/admin/Actions/ClearListsButton.svelte
@@ -2,6 +2,7 @@
import { invalidateAll } from "$app/navigation";
import { ItemsAPI } from "$lib/api/items";
import { getModalStore, getToastStore, type ModalSettings } from "@skeletonlabs/skeleton";
+ import { t } from "svelte-i18n";
interface Props {
groupId?: string | undefined;
@@ -17,10 +18,10 @@
const handleDelete = async () => {
const settings: ModalSettings = {
type: "confirm",
- title: "Please Confirm",
- body: `Are you sure you wish to clear ${claimed ? "claimed items" : "all wishlists"} ${
- groupId ? "in this group" : "across
all groups"
- }?
This action is irreversible!`,
+ title: $t("general.please-confirm"),
+ body: $t("admin.clear-lists-confirmation", {
+ values: { claimedOnly: claimed, groupSpecific: groupId !== undefined }
+ }),
// confirm = TRUE | cancel = FALSE
response: async (r: boolean) => {
if (r) {
@@ -30,26 +31,27 @@
invalidateAll();
toastStore.trigger({
- message: "Wishlists cleared.",
+ message: $t("general.wishlists-cleared"),
autohide: true,
timeout: 5000
});
} else {
toastStore.trigger({
- message: `Oops! Something went wrong.`,
+ message: $t("general.oops"),
background: "variant-filled-warning",
autohide: true,
timeout: 5000
});
}
}
- }
+ },
+ buttonTextCancel: $t("general.cancel"),
+ buttonTextConfirm: $t("general.confirm")
};
modalStore.trigger(settings);
};
diff --git a/src/lib/components/admin/Groups.svelte b/src/lib/components/admin/Groups.svelte
index 93043f6f..6d417894 100644
--- a/src/lib/components/admin/Groups.svelte
+++ b/src/lib/components/admin/Groups.svelte
@@ -11,6 +11,7 @@
} from "@skeletonlabs/skeleton";
import Search from "../Search.svelte";
import { GroupsAPI } from "$lib/api/groups";
+ import { t } from "svelte-i18n";
type Group = {
id: string;
@@ -30,7 +31,7 @@
let groupsFiltered: Group[] = $state(groups);
let groupData: TableSource = $derived({
- head: ["Name", "User Count"],
+ head: [$t("auth.name"), $t("general.user-count")],
body: tableMapperValues(groupsFiltered, ["name", "userCount"]),
meta: tableSourceMapper(groupsFiltered, ["name", "id"])
});
@@ -43,8 +44,8 @@
const createGroup = () => {
const settings: ModalSettings = {
type: "prompt",
- title: "Enter Group Name",
- body: "Provide the name of the group below.",
+ title: $t("general.enter-group-name"),
+ body: $t("general.provide-the-name-of-the-group-below"),
valueAttr: { type: "text", minlength: 3, maxlength: 32, required: true },
// Returns the updated response value
response: async (name: string) => {
@@ -55,18 +56,18 @@
const group = await groupsAPI.create(name);
if (group) {
toastStore.trigger({
- message: "Group created successfully!"
+ message: $t("general.group-created-successfully")
});
} else {
toastStore.trigger({
- message: "An unknown error occurred while creating the group"
+ message: $t("errors.create-group-unknown-error")
});
}
await invalidateAll();
},
// Optionally override the button text
- buttonTextCancel: "Cancel",
- buttonTextSubmit: "Submit"
+ buttonTextCancel: $t("general.cancel"),
+ buttonTextSubmit: $t("general.submit")
};
modalStore.trigger(settings);
@@ -77,7 +78,7 @@
diff --git a/src/lib/components/admin/InviteUser.svelte b/src/lib/components/admin/InviteUser.svelte
index 8fdd047f..876ad2dc 100644
--- a/src/lib/components/admin/InviteUser.svelte
+++ b/src/lib/components/admin/InviteUser.svelte
@@ -4,6 +4,7 @@
import { page } from "$app/stores";
import type { Group } from "@prisma/client";
import { fade } from "svelte/transition";
+ import { t } from "svelte-i18n";
interface Props {
config: Config;
@@ -29,14 +30,14 @@
let toastConfig: ToastSettings;
if (form?.sent) {
toastConfig = {
- message: "Invite sent!",
+ message: $t("general.invite-sent"),
background: "variant-filled-success",
autohide: true,
timeout: 3000
};
} else {
toastConfig = {
- message: `Invite failed to send: ${form?.message} `,
+ message: $t("errors.invite-failed-to-send", { values: { errorMessage: form?.message } }),
background: "variant-filled-error",
autohide: true,
timeout: 3000
@@ -67,7 +68,8 @@
if (data.email) email = data.email;
if (groupId) setTimeout(() => submitButton?.click(), 200);
showUrl = true;
- }
+ },
+ buttonTextCancel: $t("general.cancel")
});
};
@@ -75,7 +77,7 @@