From f3dbf7cc5d3e6e5611df55ed8880b7bc3ddf243a Mon Sep 17 00:00:00 2001
From: Philip Okugbe <16838612+Philipinho@users.noreply.github.com>
Date: Sat, 11 Jan 2025 22:11:31 +0000
Subject: [PATCH] feat: add new languages to selection (#626)
* Add new languages to selection
* more translations
---
.../public/locales/en-US/translation.json | 9 +++-
.../features/editor/extensions/extensions.ts | 2 +-
.../space/components/delete-space-modal.tsx | 47 ++++++++++---------
.../components/sidebar/space-sidebar.tsx | 10 ++--
.../space/components/space-details.tsx | 2 +-
.../features/space/types/space-role-data.ts | 13 ++---
...ount-languate.tsx => account-language.tsx} | 3 ++
apps/client/src/lib/time.ts | 5 +-
.../settings/account/account-preferences.tsx | 2 +-
9 files changed, 54 insertions(+), 39 deletions(-)
rename apps/client/src/features/user/components/{account-languate.tsx => account-language.tsx} (88%)
diff --git a/apps/client/public/locales/en-US/translation.json b/apps/client/public/locales/en-US/translation.json
index 624d0316..d3e06d26 100644
--- a/apps/client/public/locales/en-US/translation.json
+++ b/apps/client/public/locales/en-US/translation.json
@@ -226,7 +226,11 @@
"Select a group": "Select a group",
"Export all pages and attachments in this space.": "Export all pages and attachments in this space.",
"Delete space": "Delete space",
+ "Are you sure you want to delete this space?": "Are you sure you want to delete this space?",
"Delete this space with all its pages and data.": "Delete this space with all its pages and data.",
+ "All pages, comments, attachments and permissions in this space will be deleted irreversibly.": "All pages, comments, attachments and permissions in this space will be deleted irreversibly.",
+ "Confirm space name": "Confirm space name",
+ "Type the space name {{spaceName}} to confirm your action.": "Type the space name {{spaceName}} to confirm your action.",
"Format": "Format",
"Include subpages": "Include subpages",
"Include attachments": "Include attachments",
@@ -331,5 +335,8 @@
"Multiple": "Multiple",
"Heading {{level}}": "Heading {{level}}",
"Toggle title": "Toggle title",
- "Write anything. Enter \"/\" for commands": "Write anything. Enter \"/\" for commands"
+ "Write anything. Enter \"/\" for commands": "Write anything. Enter \"/\" for commands",
+ "Names do not match": "Names do not match",
+ "Today, {{time}}": "Today, {{time}}",
+ "Yesterday, {{time}}": "Yesterday, {{time}}"
}
diff --git a/apps/client/src/features/editor/extensions/extensions.ts b/apps/client/src/features/editor/extensions/extensions.ts
index 30d04d28..891f1182 100644
--- a/apps/client/src/features/editor/extensions/extensions.ts
+++ b/apps/client/src/features/editor/extensions/extensions.ts
@@ -64,8 +64,8 @@ import clojure from "highlight.js/lib/languages/clojure";
import fortran from "highlight.js/lib/languages/fortran";
import haskell from "highlight.js/lib/languages/haskell";
import scala from "highlight.js/lib/languages/scala";
-import i18n from "@/i18n.ts";
import { MarkdownClipboard } from "@/features/editor/extensions/markdown-clipboard.ts";
+import i18n from "i18next";
const lowlight = createLowlight(common);
lowlight.register("mermaid", plaintext);
diff --git a/apps/client/src/features/space/components/delete-space-modal.tsx b/apps/client/src/features/space/components/delete-space-modal.tsx
index bc3ac38e..f697322d 100644
--- a/apps/client/src/features/space/components/delete-space-modal.tsx
+++ b/apps/client/src/features/space/components/delete-space-modal.tsx
@@ -1,27 +1,29 @@
-import { Button, Divider, Group, Modal, Text, TextInput } from '@mantine/core';
-import { useDisclosure } from '@mantine/hooks';
-import { useDeleteSpaceMutation } from '../queries/space-query';
-import { useField } from '@mantine/form';
-import { ISpace } from '../types/space.types';
-import { useNavigate } from 'react-router-dom';
-import APP_ROUTE from '@/lib/app-route';
+import { Button, Divider, Group, Modal, Text, TextInput } from "@mantine/core";
+import { useDisclosure } from "@mantine/hooks";
+import { useDeleteSpaceMutation } from "../queries/space-query";
+import { useField } from "@mantine/form";
+import { ISpace } from "../types/space.types";
+import { useNavigate } from "react-router-dom";
+import APP_ROUTE from "@/lib/app-route";
+import { Trans, useTranslation } from "react-i18next";
interface DeleteSpaceModalProps {
space: ISpace;
}
export default function DeleteSpaceModal({ space }: DeleteSpaceModalProps) {
+ const { t } = useTranslation();
const [opened, { open, close }] = useDisclosure(false);
const deleteSpaceMutation = useDeleteSpaceMutation();
const navigate = useNavigate();
const confirmNameField = useField({
- initialValue: '',
+ initialValue: "",
validateOnChange: true,
validate: (value) =>
value.trim().toLowerCase() === space.name.trim().toLocaleLowerCase()
? null
- : 'Names do not match',
+ : t("Names do not match"),
});
const handleDelete = async () => {
@@ -38,46 +40,47 @@ export default function DeleteSpaceModal({ space }: DeleteSpaceModalProps) {
await deleteSpaceMutation.mutateAsync({ id: space.id, slug: space.slug });
navigate(APP_ROUTE.HOME);
} catch (error) {
- console.error('Failed to delete space', error);
+ console.error("Failed to delete space", error);
}
};
return (
<>