Skip to content

Commit

Permalink
chore(i18n): Use i18n keys on page
Browse files Browse the repository at this point in the history
Signed-off-by: Kirill Mironov <[email protected]>
  • Loading branch information
Drevoed committed Oct 16, 2024
1 parent bb42948 commit d73fd3c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/client/src/interface/ConfirmDelete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useParams } from "@solidjs/router";
import { Modal, Preloader } from "@revolt/ui";
import { styled } from "styled-system/jsx";
import { BiRegularCheck } from "solid-icons/bi";
import { useTranslation } from "@revolt/i18n";

const Centre = styled('div', {
base: {
Expand All @@ -12,7 +13,10 @@ const Centre = styled('div', {
}
});

const i18nScope = 'app.settings.pages.account.delete';

export function ConfirmDelete() {
const t = useTranslation();
const params = useParams<{ token: string }>();
const clientController = getController("client");
const [deleted] = createResource<boolean | null>( async () => {
Expand All @@ -35,27 +39,27 @@ export function ConfirmDelete() {
})

const title = createMemo(() => {
if (deleted() === null) return "Deletion failed";
if (deleted() === null) return t(`${i18nScope}.error.title`);

return deleted() ? "Confirmed deletion" : "Please wait";
return deleted() ? t(`${i18nScope}.success.title`) : t(`${i18nScope}.loading.title`);
});

const description = createMemo(() => {
if (deleted() === null) return "There was an error with your request.";
if (deleted() === null) return t(`${i18nScope}.error.description`);

if (deleted()) return (
<>
Your account will be deleted in 7 days.
{t(`${i18nScope}.success.description.header`)}
<br />
You may contact{" "}
{t(`${i18nScope}.success.description.paragraph_first`)}{" "}
<a href="mailto:[email protected]">
Revolt support
{t(`${i18nScope}.success.description.support`)}
</a>{" "}
to cancel the request if you wish.
{t(`${i18nScope}.success.description.paragraph_second`)}
</>
)

return "Contacting the server."
return t(`${i18nScope}.loading.description`)
})

return (
Expand Down

0 comments on commit d73fd3c

Please sign in to comment.