diff --git a/frontend/src/components/SettingsButton/index.jsx b/frontend/src/components/SettingsButton/index.jsx index 98140bc8b3..a1d1f605d6 100644 --- a/frontend/src/components/SettingsButton/index.jsx +++ b/frontend/src/components/SettingsButton/index.jsx @@ -3,10 +3,12 @@ import paths from "@/utils/paths"; import { ArrowUUpLeft, Wrench } from "@phosphor-icons/react"; import { Link } from "react-router-dom"; import { useMatch } from "react-router-dom"; +import { useTranslation } from "react-i18next"; export default function SettingsButton() { const isInSettings = !!useMatch("/settings/*"); const { user } = useUser(); + const { t } = useTranslation(); if (user && user?.role === "default") return null; @@ -18,7 +20,7 @@ export default function SettingsButton() { className="transition-all duration-300 p-2 rounded-full bg-theme-sidebar-footer-icon hover:bg-theme-sidebar-footer-icon-hover" aria-label="Home" data-tooltip-id="footer-item" - data-tooltip-content="Back to workspaces" + data-tooltip-content={t("settings.back-to-workspaces")} > setShowOptions(!showOptions)} - aria-label="Thread options" + aria-label={t("threads.options")} > { @@ -188,7 +191,7 @@ function OptionsMenu({ containerRef, workspace, thread, onRemove, close }) { const renameThread = async () => { const name = window - .prompt("What would you like to rename this thread to?") + .prompt(t("threads.rename_question")) ?.trim(); if (!name || name.length === 0) { close(); @@ -213,19 +216,14 @@ function OptionsMenu({ containerRef, workspace, thread, onRemove, close }) { }; const handleDelete = async () => { - if ( - !window.confirm( - "Are you sure you want to delete this thread? All of its chats will be deleted. You cannot undo this." - ) - ) - return; + if (!window.confirm(t("threads.delete.question"))) return; const success = await Workspace.threads.delete(workspace.slug, thread.slug); if (!success) { - showToast("Thread could not be deleted!", "error", { clear: true }); + showToast(t("threads.delete.failure"), "error", { clear: true }); return; } if (success) { - showToast("Thread deleted successfully!", "success", { clear: true }); + showToast(t("threads.delete.success"), "success", { clear: true }); onRemove(thread.id); return; } @@ -242,7 +240,7 @@ function OptionsMenu({ containerRef, workspace, thread, onRemove, close }) { className="w-full rounded-md flex items-center p-2 gap-x-2 hover:bg-slate-500/20 text-slate-300 light:text-theme-text-primary" > -

Rename

+

{t("threads.rename")}

); diff --git a/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/index.jsx b/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/index.jsx index 157e6623e8..ac8a73836e 100644 --- a/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/index.jsx +++ b/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/index.jsx @@ -5,6 +5,7 @@ import { Plus, CircleNotch, Trash } from "@phosphor-icons/react"; import { useEffect, useState } from "react"; import ThreadItem from "./ThreadItem"; import { useParams } from "react-router-dom"; +import { useTranslation } from "react-i18next"; export const THREAD_RENAME_EVENT = "renameThread"; export default function ThreadContainer({ workspace }) { @@ -153,6 +154,8 @@ export default function ThreadContainer({ workspace }) { function NewThreadButton({ workspace }) { const [loading, setLoading] = useState(false); + const { t } = useTranslation(); + const onClick = async () => { setLoading(true); const { thread, error } = await Workspace.threads.new(workspace.slug); @@ -190,11 +193,11 @@ function NewThreadButton({ workspace }) { {loading ? (

- Starting Thread... + {t("threads.start")}

) : (

- New Thread + {t("threads.new")}

)} @@ -203,6 +206,7 @@ function NewThreadButton({ workspace }) { } function DeleteAllThreadButton({ ctrlPressed, threads, onDelete }) { + const { t } = useTranslation(); if (!ctrlPressed || threads.filter((t) => t.deleted).length === 0) return null; return ( @@ -220,7 +224,7 @@ function DeleteAllThreadButton({ ctrlPressed, threads, onDelete }) { />

- Delete Selected + {t("threads.delete.selected")}

diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx index b2a6f73f23..cc30a4eeeb 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx @@ -16,6 +16,7 @@ import { } from "@phosphor-icons/react"; import ConfluenceLogo from "@/media/dataConnectors/confluence.png"; import { toPercentString } from "@/utils/numbers"; +import { useTranslation } from "react-i18next"; function combineLikeSources(sources) { const combined = {}; @@ -36,9 +37,10 @@ function combineLikeSources(sources) { } export default function Citations({ sources = [] }) { - if (sources.length === 0) return null; const [open, setOpen] = useState(false); const [selectedSource, setSelectedSource] = useState(null); + const { t } = useTranslation(); + if (sources.length === 0) return null; return (
@@ -48,7 +50,7 @@ export default function Citations({ sources = [] }) { open ? "pb-2" : "" } hover:text-white/75 hover:light:text-black/75 transition-all duration-300`} > - {open ? "Hide Citations" : "Show Citations"} + {open ? t("citations.hide") : t("citations.show")} setOpen(!open); @@ -40,8 +42,8 @@ function ActionMenu({ chatId, forkThread, isEditing, role }) { onClick={toggleMenu} className="border-none text-[var(--theme-sidebar-footer-icon-fill)] hover:text-[var(--theme-sidebar-footer-icon-fill)] transition-colors duration-200" data-tooltip-id="action-menu" - data-tooltip-content="More actions" - aria-label="More actions" + data-tooltip-content={t("general.message.more-actions")} + aria-label="general.message.more-actions" > @@ -52,14 +54,14 @@ function ActionMenu({ chatId, forkThread, isEditing, role }) { className="border-none rounded-t-lg flex items-center text-white gap-x-2 hover:bg-theme-action-menu-item-hover py-1.5 px-2 transition-colors duration-200 w-full text-left" > - Fork + {t("general.message.fork")}
)} diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/DeleteMessage/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/DeleteMessage/index.jsx index 1e9518e70c..f66f21d6de 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/DeleteMessage/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/DeleteMessage/index.jsx @@ -1,6 +1,7 @@ import { useState, useEffect } from "react"; import { Trash } from "@phosphor-icons/react"; import Workspace from "@/models/workspace"; +import { useTranslation } from "react-i18next"; const DELETE_EVENT = "delete-message"; @@ -39,6 +40,7 @@ export function useWatchDeleteMessage({ chatId = null, role = "user" }) { } export function DeleteMessage({ chatId, isEditing, role }) { + const { t } = useTranslation(); if (!chatId || isEditing || role === "user") return null; function emitDeleteEvent() { @@ -52,7 +54,7 @@ export function DeleteMessage({ chatId, isEditing, role }) { role="menuitem" > -

Delete

+

{t("general.message.delete")}

); } diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/EditMessage/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/EditMessage/index.jsx index 3c1fd16a18..1f79ac2549 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/EditMessage/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/EditMessage/index.jsx @@ -1,5 +1,6 @@ import { Pencil } from "@phosphor-icons/react"; import { useState, useEffect, useRef } from "react"; +import { useTranslation } from "react-i18next"; const EDIT_EVENT = "toggle-message-edit"; @@ -29,6 +30,7 @@ export function useEditMessage({ chatId, role }) { } export function EditMessageAction({ chatId = null, role, isEditing }) { + const { t } = useTranslation(); function handleEditClick() { window.dispatchEvent( new CustomEvent(EDIT_EVENT, { detail: { chatId, role } }) @@ -45,11 +47,13 @@ export function EditMessageAction({ chatId = null, role, isEditing }) { diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/AttachItem/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/AttachItem/index.jsx index fcdee57f9a..f04260138e 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/AttachItem/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/AttachItem/index.jsx @@ -1,6 +1,7 @@ import useUser from "@/hooks/useUser"; import { PaperclipHorizontal } from "@phosphor-icons/react"; import { Tooltip } from "react-tooltip"; +import { useTranslation } from "react-i18next"; /** * This is a simple proxy component that clicks on the DnD file uploader for the user. @@ -8,6 +9,7 @@ import { Tooltip } from "react-tooltip"; */ export default function AttachItem() { const { user } = useUser(); + const { t } = useTranslation(); if (!!user && user.role === "default") return null; return ( @@ -15,13 +17,12 @@ export default function AttachItem() {