Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
feat(web): translate the Room and Agent dialogs of the Messages list
Kilynde83fae45896
diff --git a/apps/web/src/features/rooms/members/delete-agent-dialog.tsx b/apps/web/src/features/rooms/members/delete-agent-dialog.tsxindex cb51dc08..94424fcd 100644--- a/apps/web/src/features/rooms/members/delete-agent-dialog.tsx+++ b/apps/web/src/features/rooms/members/delete-agent-dialog.tsx@@ -1,5 +1,9 @@import { Button } from "@/components/ui/button";import { ModalDialog } from "@/components/ui/modal-dialog";+import { commonMessages } from "@/i18n/common.messages";+import { useT } from "@/i18n/use-translation";++import { roomDialogMessages as m } from "../room-dialogs.messages";export function DeleteAgentDialog({agentName,@@ -14,22 +18,27 @@ export function DeleteAgentDialog({onClose: () => void;onDelete: () => void;}) {- const title = `Remove ${agentName}?`;+ const t = useT();return (<ModalDialog- description="The Agent will be removed from every Room and your direct chat with it will be deleted. Messages in shared Rooms stay available."+ description={t(m.removeAgentDescription)}onClose={() => {if (!isPending) onClose();}}size="sm"- title={title}+ title={t(m.removeAgentTitle, { name: agentName })}footer={<><Button disabled={isPending} onClick={onClose}>- Cancel+ {t(commonMessages.cancel)}</Button>- <Button loading={isPending} onClick={onDelete} tone="danger">- Remove Agent+ <Button+ data-voice-risk="never"+ loading={isPending}+ onClick={onDelete}+ tone="danger"+ >+ {t(m.removeAgent)}</Button></>}diff --git a/apps/web/src/features/rooms/room-create-dialog.tsx b/apps/web/src/features/rooms/room-create-dialog.tsxindex 45539180..2486e493 100644--- a/apps/web/src/features/rooms/room-create-dialog.tsx+++ b/apps/web/src/features/rooms/room-create-dialog.tsx@@ -4,11 +4,13 @@ import { useNavigate } from "react-router";import { Button } from "@/components/ui/button";import { ModalDialog } from "@/components/ui/modal-dialog";-import { classifyTeamHubCommandFailure } from "@/features/teamhub/teamhub-command-outcome";import { teamHubData } from "@/features/teamhub/teamhub-api";+import { TeamHubError } from "@/features/teamhub/teamhub-client";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";import type { TeamHubRoomCreateInput } from "@/features/teamhub/teamhub-types";+import { useT } from "@/i18n/use-translation";+import { roomDialogMessages as m } from "./room-dialogs.messages";import { requireRoomScope, tenantRoomsQueryOptions } from "./room-queries";export function RoomCreateDialog({@@ -19,6 +21,7 @@ export function RoomCreateDialog({tenantId: string;}) {const { client } = useTeamHubRuntime();+ const t = useT();const queryClient = useQueryClient();const navigate = useNavigate();const nameInputRef = useRef<HTMLInputElement>(null);@@ -55,24 +58,22 @@ export function RoomCreateDialog({trimmedName.toLocaleLowerCase(),);+ // TeamHub's own message is shown as it is; an unknown outcome is worded here.const failure = createRoom.error- ? classifyTeamHubCommandFailure(- createRoom.error,- "this Room was created",- "Check your Rooms before you retry.",- )- : null;+ ? createRoom.error instanceof TeamHubError+ ? createRoom.error.message+ : t(m.createUnconfirmed)+ : undefined;// Names only have to be unique among the Rooms this Human is in, so the// conflicting Room is always one they can see.- const nameTakenMessage =- "You already have a Room with this name. Choose a different name.";+ const nameTakenMessage = t(m.nameTaken);const failureMessage = duplicateName? nameTakenMessage: createRoom.error instanceof Error &&"code" in createRoom.error &&createRoom.error.code === "ROOM_NAME_TAKEN"? nameTakenMessage- : failure?.message;+ : failure;useEffect(() => {nameInputRef.current?.focus();@@ -93,7 +94,7 @@ export function RoomCreateDialog({<ModalDialogonClose={onClose}size="md"- title="Create Room"+ title={t(m.createRoom)}footer={<Buttondisabled={!trimmedName || duplicateName}@@ -102,14 +103,14 @@ export function RoomCreateDialog({tone="primary"type="submit">- Create Room+ {t(m.createRoom)}</Button>}><form className="px-5 py-4" id={formId} onSubmit={handleSubmit}><label className="block"><span className="mb-1.5 block text-sm font-medium text-app-ink">- Room name+ {t(m.roomName)}</span><inputaria-invalid={duplicateName || undefined}@@ -119,7 +120,7 @@ export function RoomCreateDialog({disabled={createRoom.isPending}maxLength={120}onChange={(event) => setName(event.target.value)}- placeholder="Room name"+ placeholder={t(m.roomName)}ref={nameInputRef}value={name}/>diff --git a/apps/web/src/features/rooms/room-delete-dialog.tsx b/apps/web/src/features/rooms/room-delete-dialog.tsxindex 654f0f4c..c9ad7a3a 100644--- a/apps/web/src/features/rooms/room-delete-dialog.tsx+++ b/apps/web/src/features/rooms/room-delete-dialog.tsx@@ -6,14 +6,17 @@ import { useNavigate } from "react-router";import { Button } from "@/components/ui/button";import { ModalDialog } from "@/components/ui/modal-dialog";-import { classifyTeamHubCommandFailure } from "@/features/teamhub/teamhub-command-outcome";import { teamHubDone } from "@/features/teamhub/teamhub-api";+import { TeamHubError } from "@/features/teamhub/teamhub-client";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";import type {TeamHubRoom,TeamHubRoomPage,} from "@/features/teamhub/teamhub-types";+import { commonMessages } from "@/i18n/common.messages";+import { RichMessage, useT } from "@/i18n/use-translation";+import { roomDialogMessages as m } from "./room-dialogs.messages";import { roomQueryKey, tenantRoomsQueryKey } from "./room-queries";export function RoomDeleteDialog({@@ -26,6 +29,7 @@ export function RoomDeleteDialog({tenantId: string;}) {const { client } = useTeamHubRuntime();+ const t = useT();const navigate = useNavigate();const queryClient = useQueryClient();const confirmationInputRef = useRef<HTMLInputElement>(null);@@ -77,13 +81,12 @@ export function RoomDeleteDialog({await navigate(`/t/${tenantId}/rooms`, { replace: true });},});+ // TeamHub's own message is shown as it is; an unknown outcome is worded here.const failure = deleteRoom.error- ? classifyTeamHubCommandFailure(- deleteRoom.error,- "this Room was deleted",- "Check your Rooms before you retry.",- )- : null;+ ? deleteRoom.error instanceof TeamHubError+ ? deleteRoom.error.message+ : t(m.deleteUnconfirmed)+ : undefined;useEffect(() => {confirmationInputRef.current?.focus();@@ -99,20 +102,21 @@ export function RoomDeleteDialog({return (<ModalDialog- description="Every member will lose access to this Room. Its messages, files, and history will no longer be available."+ description={t(m.deleteRoomDescription)}onClose={() => {if (!deleteRoom.isPending) {onClose();}}}size="sm"- title="Delete Room"+ title={t(m.deleteRoom)}footer={<><Button disabled={deleteRoom.isPending} onClick={onClose}>- Cancel+ {t(commonMessages.cancel)}</Button><Button+ data-voice-risk="never"disabled={confirmation !== room.name}form={formId}loading={deleteRoom.isPending}@@ -120,7 +124,7 @@ export function RoomDeleteDialog({type="submit"><Icon icon={Delete02Icon} size={16} />- Delete Room+ {t(m.deleteRoom)}</Button></>}@@ -128,10 +132,14 @@ export function RoomDeleteDialog({<form className="px-5 py-4" id={formId} onSubmit={handleSubmit}><label className="block"><span className="mb-1.5 block text-sm font-medium text-app-ink">- Type <strong>{room.name}</strong> to confirm+ <RichMessage+ message={m.typeToConfirm}+ tags={{ name: (text) => <strong>{text}</strong> }}+ values={{ name: room.name }}+ /></span><input- aria-label="Room name confirmation"+ aria-label={t(m.confirmationLabel)}autoComplete="off"className="ui-field-control w-full"disabled={deleteRoom.isPending}@@ -143,7 +151,7 @@ export function RoomDeleteDialog({{failure ? (<p className="mt-3 text-sm text-app-danger" role="alert">- {failure.message}+ {failure}</p>) : null}</form>diff --git a/apps/web/src/features/rooms/room-dialogs.messages.ts b/apps/web/src/features/rooms/room-dialogs.messages.tsnew file mode 100644index 00000000..0be821e1--- /dev/null+++ b/apps/web/src/features/rooms/room-dialogs.messages.ts@@ -0,0 +1,21 @@+import { defineMessages } from "@/i18n/messages";++/** The dialogs the Messages list opens: create a Room, delete a Room, remove an Agent. */+export const roomDialogMessages = defineMessages("roomDialogs", {+ createRoom: "Create Room",+ roomName: "Room name",+ nameTaken: "You already have a Room with this name. Choose a different name.",+ createUnconfirmed:+ "TeamHub did not confirm whether this Room was created. Check your Rooms before you retry.",+ deleteRoom: "Delete Room",+ deleteRoomDescription:+ "Every member will lose access to this Room. Its messages, files, and history will no longer be available.",+ deleteUnconfirmed:+ "TeamHub did not confirm whether this Room was deleted. Check your Rooms before you retry.",+ typeToConfirm: "Type <name>{name}</name> to confirm",+ confirmationLabel: "Room name confirmation",+ removeAgentTitle: "Remove {name}?",+ removeAgentDescription:+ "The Agent will be removed from every Room and your direct chat with it will be deleted. Messages in shared Rooms stay available.",+ removeAgent: "Remove Agent",+});diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.jsonindex e6934b93..f7bd4c51 100644--- a/apps/web/src/i18n/locales/zh-CN.json+++ b/apps/web/src/i18n/locales/zh-CN.json@@ -1591,5 +1591,19 @@"targetUses": "使用 {summary}。","targetUsesModelMissing": "使用 {summary}。那台电脑上没有 {model}。","targetUsesReasoningWas": "使用 {summary}。原来的思考强度是{effort}。"+ },+ "roomDialogs": {+ "createRoom": "创建 Room",+ "roomName": "Room 名称",+ "nameTaken": "你已经有一个同名的 Room,请换一个名称。",+ "createUnconfirmed": "TeamHub 未确认这个 Room 是否已创建。重试前请先查看你的 Room。",+ "deleteRoom": "删除 Room",+ "deleteRoomDescription": "所有成员都将无法再进入这个 Room,其中的消息、文件和历史记录也将无法再查看。",+ "deleteUnconfirmed": "TeamHub 未确认这个 Room 是否已删除。重试前请先查看你的 Room。",+ "typeToConfirm": "输入 <name>{name}</name> 以确认",+ "confirmationLabel": "确认 Room 名称",+ "removeAgentTitle": "移除 {name}?",+ "removeAgentDescription": "这个 Agent 将从所有 Room 中移除,你与它的私聊也会被删除。共享 Room 里的消息仍会保留。",+ "removeAgent": "移除 Agent"}}