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 Library pages
Kilyn13ea91acd2c4
diff --git a/apps/web/src/features/library/copy-to-my-documents-dialog.tsx b/apps/web/src/features/library/copy-to-my-documents-dialog.tsxindex 9c095110..a3c82ae4 100644--- a/apps/web/src/features/library/copy-to-my-documents-dialog.tsx+++ b/apps/web/src/features/library/copy-to-my-documents-dialog.tsx@@ -3,19 +3,23 @@ import { useState } from "react";import { useNavigate } from "react-router";import { Button } from "@/components/ui/button";+import { commonMessages } from "@/i18n/common.messages";import { ModalDialog } from "@/components/ui/modal-dialog";import { Select, SelectItem } from "@/components/ui/select";import { teamHubData } from "@/features/teamhub/teamhub-api";import type { TeamHubClient } from "@/features/teamhub/teamhub-client";import type { TeamHubDocumentPlacementNode } from "@/features/teamhub/teamhub-types";+import { useT } from "@/i18n/use-translation";import type { LibraryRowDocument } from "./library-document-results";+import { libraryMessages as m } from "./library.messages";import type { DocumentTreeFolder } from "./my-documents-tree-helpers";/** Copies a shared Document into My pages through the canonical Duplicate command. */export function useCopyToMyDocuments(client: TeamHubClient, tenantId: string) {const queryClient = useQueryClient();const navigate = useNavigate();+ const t = useT();const [copyingDocument, setCopyingDocument] =useState<LibraryRowDocument | null>(null);const [copyPending, setCopyPending] = useState(false);@@ -48,7 +52,7 @@ export function useCopyToMyDocuments(client: TeamHubClient, tenantId: string) {setCopyError(copyDocumentError instanceof Error? copyDocumentError.message- : "The Document could not be copied.",+ : t(m.documentNotCopied),);} finally {setCopyPending(false);@@ -88,6 +92,7 @@ export function CopyToMyDocumentsDialog({onCopy: (targetFolderId?: string) => void;pending: boolean;}) {+ const t = useT();const [targetId, setTargetId] = useState("__root__");return (<ModalDialog@@ -95,11 +100,11 @@ export function CopyToMyDocumentsDialog({description={document.title}onClose={onCancel}size="sm"- title="Copy to My Documents"+ title={t(m.copyToMyDocuments)}footer={<><Button disabled={pending} onClick={onCancel} tone="secondary">- Cancel+ {t(commonMessages.cancel)}</Button><Buttonloading={pending}@@ -108,21 +113,21 @@ export function CopyToMyDocumentsDialog({}tone="primary">- Copy+ {t(commonMessages.copy)}</Button></>}><div className="px-5 py-4"><label className="block text-sm font-medium text-app-body">- Destination+ {t(m.destination)}<Select- aria-label="Copy destination"+ aria-label={t(m.copyDestination)}className="mt-1 w-full"onValueChange={setTargetId}value={targetId}>- <SelectItem value="__root__">My Documents</SelectItem>+ <SelectItem value="__root__">{t(m.myDocuments)}</SelectItem>{folders.map((folder) => (<SelectItem key={folder.id} value={folder.id}>{folderPathLabel(folder, items)}diff --git a/apps/web/src/features/library/document-delete-dialog.tsx b/apps/web/src/features/library/document-delete-dialog.tsxindex dc1bdc23..31b4761d 100644--- a/apps/web/src/features/library/document-delete-dialog.tsx+++ b/apps/web/src/features/library/document-delete-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 { libraryMessages as m } from "./library.messages";export function DocumentDeleteDialog({error,@@ -14,22 +18,28 @@ export function DocumentDeleteDialog({pending: boolean;title: string;}) {+ const t = useT();return (<ModalDialogcloseOnBackdrop={!pending}- description={`${title} will be deleted from all Rooms and shared locations. It cannot currently be restored from the product.`}+ description={t(m.deleteDocumentBody, { title })}onClose={() => {if (!pending) onCancel();}}size="sm"- title="Delete Document?"+ title={t(m.deleteDocumentTitle)}footer={<><Button disabled={pending} onClick={onCancel} tone="secondary">- Cancel+ {t(commonMessages.cancel)}</Button>- <Button loading={pending} onClick={onConfirm} tone="danger">- Delete+ <Button+ data-voice-risk="never"+ loading={pending}+ onClick={onConfirm}+ tone="danger"+ >+ {t(commonMessages.delete)}</Button></>}diff --git a/apps/web/src/features/library/document-file-types.ts b/apps/web/src/features/library/document-file-types.tsindex 1374343e..219051b3 100644--- a/apps/web/src/features/library/document-file-types.ts+++ b/apps/web/src/features/library/document-file-types.ts@@ -5,21 +5,24 @@ import {} from "./document-display-name";import type { TeamHubDocumentTreeSummary } from "@/features/teamhub/teamhub-types";+import { libraryMessages as m } from "./library.messages";++/** Each type's label is a message, worded when the filter shows it. */export const documentFileTypes = [- { value: "", label: "All types" },- { value: "md", label: "Markdown" },- { value: "pdf", label: "PDF" },- { value: "word", label: "Word" },- { value: "spreadsheet", label: "Spreadsheets (Excel / CSV)" },- { value: "presentation", label: "PowerPoint" },- { value: "html", label: "HTML" },- { value: "text", label: "Plain text" },- { value: "image", label: "Images" },- { value: "audio", label: "Audio" },- { value: "video", label: "Video" },- { value: "archive", label: "Archives" },- { value: "code", label: "Code" },- { value: "others", label: "Others" },+ { value: "", label: m.typeAll },+ { value: "md", label: m.typeMarkdown },+ { value: "pdf", label: m.typePdf },+ { value: "word", label: m.typeWord },+ { value: "spreadsheet", label: m.typeSpreadsheet },+ { value: "presentation", label: m.typePresentation },+ { value: "html", label: m.typeHtml },+ { value: "text", label: m.typeText },+ { value: "image", label: m.typeImage },+ { value: "audio", label: m.typeAudio },+ { value: "video", label: m.typeVideo },+ { value: "archive", label: m.typeArchive },+ { value: "code", label: m.typeCode },+ { value: "others", label: m.typeOthers },] as const;export function documentFileType(diff --git a/apps/web/src/features/library/library-document-results.tsx b/apps/web/src/features/library/library-document-results.tsxindex 8f504d5f..7ba92fb1 100644--- a/apps/web/src/features/library/library-document-results.tsx+++ b/apps/web/src/features/library/library-document-results.tsx@@ -12,12 +12,19 @@ import type {TeamHubDocument,TeamHubDocumentTreeSummary,} from "@/features/teamhub/teamhub-types";+import {+ formatLocale,+ type Translate,+ type Translation,+} from "@/i18n/language";+import { useT, useTranslation } from "@/i18n/use-translation";import { formatDateTime, formatUpdatedAt } from "@/lib/date-format";import { documentFileName } from "./document-display-name";import { type LibraryFolder, LibraryFolderRow } from "./library-folder-browser";import type { LibrarySection } from "./library-sidebar";import type { PendingDocumentUpload } from "./library-upload-queue";+import { libraryMessages as m } from "./library.messages";import { WorkspaceFileIcon } from "./workspace-file-icon";/** Library rows come from the smart view (with access sources) or a folder's tree items. */@@ -41,28 +48,28 @@ export function RecentDocumentCards({pending: boolean;tenantId: string;}) {+ const translation = useTranslation();+ const { t } = translation;const recentShowUnlinked = anyLinked(documents);return (- <section aria-label="Recent" className="workspace-recent">- <h3 className="workspace-recent-title">Recent</h3>+ <section aria-label={t(m.recent)} className="workspace-recent">+ <h3 className="workspace-recent-title">{t(m.recent)}</h3>{pending ? (<p className="flex items-center gap-2 py-6 text-sm text-app-muted"><Spinner size={15} />- Loading documents…+ {t(m.loadingDocuments)}</p>) : error ? (<p className="py-6 text-sm text-app-danger" role="alert">- {error.message || "Recent documents are unavailable."}+ {error.message || t(m.recentUnavailable)}</p>) : documents.length === 0 ? (- <p className="py-6 text-sm text-app-muted">- No recently updated documents- </p>+ <p className="py-6 text-sm text-app-muted">{t(m.noRecent)}</p>) : (<div className="workspace-recent-cards">{documents.map((document) => {const fileName = documentFileName(document);- const context = documentContext(document, recentShowUnlinked);+ const context = documentContext(document, recentShowUnlinked, t);return (<article className="workspace-recent-card" key={document.id}><Link@@ -85,15 +92,19 @@ export function RecentDocumentCards({</span><timedateTime={document.updated_at}- title={exactTime(document.updated_at)}+ title={exactTime(document.updated_at, translation)}>- {formatUpdatedAt(document.updated_at)}+ {formatUpdatedAt(+ document.updated_at,+ undefined,+ translation,+ )}</time></Link><DocumentActionsMenuactions={documentActions(document)}buttonClassName="workspace-file-action"- label={`Actions for ${document.title}`}+ label={t(m.actionsFor, { name: document.title })}/></article>);@@ -108,11 +119,20 @@ export function RecentDocumentCards({* Where a Document is visible. "No linked context" only says something when* some Document beside it does have a source, so a list where none do omits it.*/-function documentContext(document: LibraryRowDocument, showUnlinked: boolean) {+function documentContext(+ document: LibraryRowDocument,+ showUnlinked: boolean,+ t: Translate,+) {if (!document.from) return "";if (document.from.length)- return `Visible in ${document.from.map((source) => source.label ?? source.binding_kind).join(", ")}`;- return showUnlinked ? "No linked context" : "";+ return t(m.visibleIn, {+ // Room, Task and page names, listed as they are.+ places: document.from+ .map((source) => source.label ?? source.binding_kind)+ .join(", "),+ });+ return showUnlinked ? t(m.noLinkedContext) : "";}function anyLinked(documents: readonly LibraryRowDocument[]) {@@ -146,18 +166,19 @@ export function LibraryDocumentResults({section: LibrarySection;tenantId: string;}) {+ const t = useT();if (pending) {return (<p className="flex items-center justify-center gap-2 py-16 text-center text-sm text-app-muted"><Spinner size={16} />- Loading documents…+ {t(m.loadingDocuments)}</p>);}if (error) {return (<p className="py-16 text-center text-sm text-app-danger" role="alert">- {error.message || "Document list is unavailable."}+ {error.message || t(m.listUnavailable)}</p>);}@@ -175,7 +196,7 @@ export function LibraryDocumentResults({}return (<div- aria-label={`${activeView.label} documents`}+ aria-label={t(m.viewDocuments, { view: activeView.label })}className="workspace-file-list">{folders.map((folder) => (@@ -187,7 +208,10 @@ export function LibraryDocumentResults({))}{pendingUploads.map((upload) => (<div- aria-label={`${upload.filename} upload ${upload.status}`}+ aria-label={t(+ upload.status === "uploading" ? m.uploadUploading : m.uploadQueued,+ { filename: upload.filename },+ )}className="workspace-file-row text-app-muted"key={upload.id}role="status"@@ -213,7 +237,7 @@ export function LibraryDocumentResults({))}{documents.map((document) => (<DocumentRow- context={documentContext(document, showUnlinked)}+ context={documentContext(document, showUnlinked, t)}document={document}key={document.id}actions={documentActions(document)}@@ -230,8 +254,10 @@ export function LibraryDocumentResults({}/** The full date and time behind a relative label, shown on hover. */-function exactTime(iso: string) {- return Number.isFinite(Date.parse(iso)) ? formatDateTime(iso) : undefined;+function exactTime(iso: string, translation: Translation) {+ return Number.isFinite(Date.parse(iso))+ ? formatDateTime(iso, undefined, formatLocale(translation.language))+ : undefined;}function DocumentRow({@@ -247,6 +273,7 @@ function DocumentRow({onCopyToMyDocuments?: () => void;tenantId: string;}) {+ const t = useT();const fileName = documentFileName(document);return (<div className="workspace-file-row">@@ -267,7 +294,7 @@ function DocumentRow({<DocumentActionsMenuactions={{ ...actions, onCopyToMyDocuments }}buttonClassName="workspace-file-action"- label={`Actions for ${document.title}`}+ label={t(m.actionsFor, { name: document.title })}/></div>);@@ -278,6 +305,7 @@ function WorkspaceFileMetadata({}: {document: TeamHubDocumentTreeSummary;}) {+ const translation = useTranslation();const owner = document.owner;return (<div className="workspace-file-metadata">@@ -296,9 +324,9 @@ function WorkspaceFileMetadata({</span><timedateTime={document.updated_at}- title={exactTime(document.updated_at)}+ title={exactTime(document.updated_at, translation)}>- {formatUpdatedAt(document.updated_at)}+ {formatUpdatedAt(document.updated_at, undefined, translation)}</time></div>);diff --git a/apps/web/src/features/library/library-documents-header.tsx b/apps/web/src/features/library/library-documents-header.tsxindex 0d1dfaf9..9ad75fc7 100644--- a/apps/web/src/features/library/library-documents-header.tsx+++ b/apps/web/src/features/library/library-documents-header.tsx@@ -10,6 +10,9 @@ import { type RefObject, useRef } from "react";import { ActionMenu } from "@/components/ui/action-menu";import { buttonClassName } from "@/components/ui/button";import { Icon } from "@/components/ui/icon";+import { useT } from "@/i18n/use-translation";++import { libraryMessages as m } from "./library.messages";/** The Library heading with the New menu and its hidden file pickers. */export function LibraryDocumentsHeader({@@ -29,10 +32,11 @@ export function LibraryDocumentsHeader({onNewFolder: () => void;onUploadFolder: (files: File[]) => void;}) {+ const t = useT();const folderInputRef = useRef<HTMLInputElement>(null);return (<header className="workspace-files-heading">- <h2>Library</h2>+ <h2>{t(m.title)}</h2><div className="ml-auto flex items-center gap-1"><inputhidden@@ -66,34 +70,34 @@ export function LibraryDocumentsHeader({{disabled: createBusy,icon: <Icon icon={FileAddIcon} size={16} />,- label: "New file",+ label: t(m.newFile),onSelect: onCreateDocument,},{disabled: createBusy,icon: <Icon icon={FolderAddIcon} size={16} />,- label: "New folder",+ label: t(m.newFolder),onSelect: onNewFolder,},{disabled: createBusy,icon: <Icon icon={FileImportIcon} size={16} />,- label: "Import",+ label: t(m.importFile),onSelect: onImportPick,},{disabled: createBusy,icon: <Icon icon={FolderUploadIcon} size={16} />,- label: "Upload folder",+ label: t(m.uploadFolder),onSelect: () => folderInputRef.current?.click(),},]}- label="Create in My pages"+ label={t(m.createInMyPages)}placement="bottom-end"trigger={<><Icon icon={PlusSignIcon} size={16} />- New+ {t(m.newMenu)}</>}/>diff --git a/apps/web/src/features/library/library-documents-page.tsx b/apps/web/src/features/library/library-documents-page.tsxindex cdc12e88..b3e37717 100644--- a/apps/web/src/features/library/library-documents-page.tsx+++ b/apps/web/src/features/library/library-documents-page.tsx@@ -13,6 +13,7 @@ import type { TeamHubClient } from "@/features/teamhub/teamhub-client";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";import type { TeamHubDocumentTreeSummary } from "@/features/teamhub/teamhub-types";import { MeetingsPanel } from "@/features/memory/meetings-panel";+import { useT } from "@/i18n/use-translation";import {CopyToMyDocumentsDialog,@@ -23,6 +24,7 @@ import { RecentDocumentCards } from "./library-document-results";import { LibraryDocumentsHeader } from "./library-documents-header";import { NewFolderDialog } from "./library-folder-browser";import { LibraryFolderListing } from "./library-folder-listing";+import { libraryMessages as m } from "./library.messages";import { readDroppedUploadSources } from "./library-upload-queue";import {type WorkspaceTab,@@ -56,6 +58,7 @@ const RECENT_CARD_LIMIT = 4;export function LibraryDocumentsPage() {const { client } = useTeamHubRuntime();+ const t = useT();const params = useParams();const tenantId = requireRoomRouteParam(params.tenantId, "Tenant");const [searchParams, setSearchParams] = useSearchParams();@@ -98,8 +101,12 @@ export function LibraryDocumentsPage() {0,RECENT_CARD_LIMIT,);- const activeView =+ const view =workspaceTabs.find((candidate) => candidate.id === tab) ?? workspaceTabs[0];+ const activeView = {+ empty: view.empty ? t(view.empty) : "",+ label: t(view.label),+ };const documentActions = (document: TeamHubDocumentTreeSummary,): RoomDocumentMenuActions => ({@@ -141,7 +148,7 @@ export function LibraryDocumentsPage() {{rename.dialog}{creatingFolder ? (<NewFolderDialog- defaultName={nextFolderName(treeItems, ownedFolderId)}+ defaultName={nextFolderName(treeItems, ownedFolderId, t)}onCancel={() => setCreatingFolder(false)}onCreate={async (name) => {await treeModel.onCreateNamedFolder(name, ownedFolderId);@@ -178,7 +185,9 @@ export function LibraryDocumentsPage() {}outlinedtestId="workspace-file-drop-target"- title={`Release to upload to ${(ownedFolderId && trail.at(-1)?.name) || "My pages"}`}+ title={t(m.releaseToUploadTo, {+ folder: (ownedFolderId && trail.at(-1)?.name) || t(m.myPages),+ })}><mainclassName="workspace-content-viewport workspace-scrollbar min-w-0 flex-1 overflow-y-auto bg-app-surface [scrollbar-gutter:stable]"@@ -279,6 +288,7 @@ function DocumentHistoryDialog({onClose: () => void;tenantId: string;}) {+ const t = useT();return (<Suspensefallback={@@ -287,7 +297,7 @@ function DocumentHistoryDialog({role="status"><Spinner size={16} />- Loading history…+ {t(m.loadingHistory)}</div>}>diff --git a/apps/web/src/features/library/library-folder-browser.tsx b/apps/web/src/features/library/library-folder-browser.tsxindex 82caf38a..59beb61b 100644--- a/apps/web/src/features/library/library-folder-browser.tsx+++ b/apps/web/src/features/library/library-folder-browser.tsx@@ -4,23 +4,28 @@ import { type FormEvent, useState } from "react";import { Button } from "@/components/ui/button";import { Icon } from "@/components/ui/icon";import { ModalDialog } from "@/components/ui/modal-dialog";+import { commonMessages } from "@/i18n/common.messages";+import { useTranslation, useT } from "@/i18n/use-translation";+import { formatLocale } from "@/i18n/language";+import { dateTimeFormat } from "@/lib/date-format";import type {TeamHubDocumentPlacementNode,TeamHubDocumentTreeSummary,} from "@/features/teamhub/teamhub-types";import type { PendingDocumentUpload } from "./library-upload-queue";+import { libraryMessages as m } from "./library.messages";export type LibraryFolder = Extract<TeamHubDocumentPlacementNode,{ node_kind: "folder" }>;-const folderDateFormatter = new Intl.DateTimeFormat("en-US", {+const folderDateOptions = {day: "numeric",month: "short",year: "numeric",-});+} as const;/** Folders and Documents placed directly in one My pages folder (root when undefined). */export function folderChildren(@@ -84,9 +89,10 @@ export function LibraryFolderBreadcrumb({rootLabel: string;trail: readonly LibraryFolder[];}) {+ const t = useT();return (<nav- aria-label="Folder path"+ aria-label={t(m.folderPath)}className="mb-3 flex flex-wrap items-center gap-1 text-sm"><button@@ -125,11 +131,12 @@ export function LibraryFolderRow({folder: LibraryFolder;onOpen: (folderId: string) => void;}) {+ const { language, t } = useTranslation();const date = new Date(folder.updated_at);return (<div className="workspace-file-row"><button- aria-label={`Open folder ${folder.name}`}+ aria-label={t(m.openFolder, { name: folder.name })}className="workspace-file-name text-left"onClick={() => onOpen(folder.id)}type="button"@@ -139,14 +146,16 @@ export function LibraryFolderRow({</span><span className="min-w-0"><strong>{folder.name}</strong>- <span className="workspace-file-context">Folder</span>+ <span className="workspace-file-context">{t(m.folder)}</span></span></button><div className="workspace-file-metadata"><time dateTime={folder.updated_at} title={folder.updated_at}>{Number.isNaN(date.valueOf())? "—"- : folderDateFormatter.format(date)}+ : dateTimeFormat(folderDateOptions, formatLocale(language)).format(+ date,+ )}</time></div><span aria-hidden="true" />@@ -160,27 +169,28 @@ export function LibraryUploadSummary({}: {uploads: readonly PendingDocumentUpload[];}) {+ const t = useT();if (uploads.length === 0) return null;const current = uploads.find((upload) => upload.status === "uploading");const percent = Math.round((current?.progress ?? 0) * 100);return (<div- aria-label="Upload progress"+ aria-label={t(m.uploadProgress)}className="mb-2 rounded-lg border border-app-border px-3 py-2 text-xs text-app-muted"role="status"><div className="flex items-center justify-between gap-3"><span className="truncate">- {current ? `Uploading ${current.filename}` : "Preparing upload…"}+ {current+ ? t(m.uploadingFile, { filename: current.filename })+ : t(m.preparingUpload)}</span><span className="shrink-0">- {uploads.length === 1- ? "1 file left"- : `${uploads.length} files left`}+ {t(m.filesLeft, { count: uploads.length })}</span></div><div- aria-label="Current file upload"+ aria-label={t(m.currentFileUpload)}aria-valuemax={100}aria-valuemin={0}aria-valuenow={percent}@@ -205,6 +215,7 @@ export function NewFolderDialog({onCancel: () => void;onCreate: (name: string) => Promise<void>;}) {+ const t = useT();const [name, setName] = useState(defaultName);const [pending, setPending] = useState(false);const [error, setError] = useState<string | null>(null);@@ -221,7 +232,7 @@ export function NewFolderDialog({setError(createError instanceof Error? createError.message- : "The folder could not be created.",+ : t(m.folderNotCreated),);setPending(false);}@@ -233,7 +244,7 @@ export function NewFolderDialog({footer={<><Button disabled={pending} onClick={onCancel} tone="secondary">- Cancel+ {t(commonMessages.cancel)}</Button><Buttondisabled={!trimmed}@@ -241,7 +252,7 @@ export function NewFolderDialog({onClick={() => void submit()}tone="primary">- Create+ {t(m.create)}</Button></>}@@ -249,13 +260,13 @@ export function NewFolderDialog({if (!pending) onCancel();}}size="sm"- title="New folder"+ title={t(m.newFolder)}><form className="px-5 py-4" onSubmit={(event) => void submit(event)}><label className="block text-sm font-medium text-app-body">- Folder name+ {t(m.folderName)}<input- aria-label="Folder name"+ aria-label={t(m.folderName)}className="mt-1 h-9 w-full rounded-md border border-app-border bg-transparent px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"maxLength={255}onChange={(event) => setName(event.target.value)}diff --git a/apps/web/src/features/library/library-folder-listing.tsx b/apps/web/src/features/library/library-folder-listing.tsxindex dea0d6c4..97e03b7a 100644--- a/apps/web/src/features/library/library-folder-listing.tsx+++ b/apps/web/src/features/library/library-folder-listing.tsx@@ -1,6 +1,7 @@import type { RoomDocumentMenuActions } from "@/features/rooms/documents/room-document-actions-menu";import { Select, SelectItem } from "@/components/ui/select";import type { TeamHubDocumentTreeSummary } from "@/features/teamhub/teamhub-types";+import { useT } from "@/i18n/use-translation";import { documentFileName } from "./document-display-name";import {@@ -18,6 +19,7 @@ import {} from "./library-folder-browser";import type { PendingDocumentUpload } from "./library-upload-queue";import type { WorkspaceTab } from "./library-workspace-tabs";+import { libraryMessages as m } from "./library.messages";/*** One open folder level of My pages or Shared with me: type and sort filters,@@ -66,29 +68,30 @@ export function LibraryFolderListing({tenantId: string;trail: readonly LibraryFolder[];}) {+ const t = useT();return (<><div className="workspace-file-filters"><Select- aria-label="File type"+ aria-label={t(m.fileType)}onValueChange={onFileTypeChange}value={fileType}variant="pill">{documentFileTypes.map(({ value, label }) => (<SelectItem key={value} value={value}>- {label}+ {t(label)}</SelectItem>))}</Select><Select- aria-label="Sort documents"+ aria-label={t(m.sortDocuments)}onValueChange={onSortByChange}value={sortBy}variant="pill">- <SelectItem value="updated">Sort by last modified</SelectItem>- <SelectItem value="name">Sort by name</SelectItem>+ <SelectItem value="updated">{t(m.sortByModified)}</SelectItem>+ <SelectItem value="name">{t(m.sortByName)}</SelectItem></Select></div>{folderId ? (@@ -104,11 +107,12 @@ export function LibraryFolderListing({{error}</p><button+ data-voice-closeclassName="shrink-0 rounded-md px-1.5 text-app-muted hover:bg-app-hover hover:text-app-body"onClick={onDismissError}type="button">- Dismiss+ {t(m.dismiss)}</button></div>) : null}@@ -119,7 +123,7 @@ export function LibraryFolderListing({activeView={folderId? {- empty: "This folder is empty",+ empty: t(m.folderEmpty),label: trail.at(-1)!.name,}: activeViewdiff --git a/apps/web/src/features/library/library-sidebar.tsx b/apps/web/src/features/library/library-sidebar.tsxindex e45899fb..405f80fe 100644--- a/apps/web/src/features/library/library-sidebar.tsx+++ b/apps/web/src/features/library/library-sidebar.tsx@@ -6,9 +6,12 @@ import { Link } from "react-router";import { secondaryNavigationHeaderClass } from "@/components/ui/secondary-navigation";import { useSecondaryNavigationWidth } from "@/components/ui/use-sidebar-width";import { MeetingsSidebarTree } from "@/features/wiki/knowledge-sidebar-trees";+import { useT } from "@/i18n/use-translation";import { WikiDirectory } from "@/features/wiki/wiki-directory";+import { libraryMessages as m } from "./library.messages";+export type LibrarySection =| "my-documents"| "overview"@@ -38,9 +41,9 @@ export function LibrarySidebar({holdsOpenFile?: "wiki" | null;tenantId: string;}) {+ const t = useT();const sidebarRef = useRef<HTMLElement>(null);const wikiOnly = active === "wiki" || holdsOpenFile === "wiki";- const sidebarLabel = wikiOnly ? "Wiki" : "Library";const scrollKey = `linger:${wikiOnly ? "wiki" : "library"}-sidebar-scroll:${tenantId}`;const navigationWidth = useSecondaryNavigationWidth(tenantId);useLayoutEffect(() => {@@ -70,7 +73,10 @@ export function LibrarySidebar({const aside = (<aside- aria-label={`${sidebarLabel} sidebar`}+ aria-label={t(wikiOnly ? m.wikiSidebar : m.librarySidebar)}+ // The label follows the language, so code finds the sidebar by these.+ data-library-sidebar={wikiOnly ? undefined : ""}+ data-voice-area="sidebar"data-voice-scroll="sidebar"className={`workspace-scrollbar shrink-0 overflow-y-auto ${wikiOnly ? "overflow-x-hidden" : ""} bg-app-surface px-2 pb-3 sm:w-[calc(var(--sidebar-width)+20px)] sm:pl-[10px] sm:pr-[18px] ${mobileOpen@@ -103,14 +109,15 @@ export function LibrarySidebar({to={`/t/${encodeURIComponent(tenantId)}/library`}><Icon icon={ArrowLeft01Icon} className="shrink-0" size={16} />- <span className="truncate">Back to Library</span>+ <span className="truncate">{t(m.backToLibrary)}</span></Link>{mobileOpen && onMobileClose ? (<button- aria-label="Close Owned by Me"+ data-voice-close+ aria-label={t(m.closeOwnedByMe)}className="flex size-8 shrink-0 items-center justify-center rounded-sm text-app-muted hover:bg-app-hover hover:text-app-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-app-focus sm:hidden"onClick={onMobileClose}- title="Close Owned by Me"+ title={t(m.closeOwnedByMe)}type="button"><Icon icon={Cancel01Icon} size={16} />@@ -136,7 +143,9 @@ export function LibrarySidebar({<div className="relative hidden w-px shrink-0 bg-border sm:block"><div{...navigationWidth.handleProps}- aria-label={`Resize ${sidebarLabel} sidebar`}+ aria-label={t(+ wikiOnly ? m.resizeWikiSidebar : m.resizeLibrarySidebar,+ )}/></div></>diff --git a/apps/web/src/features/library/library-upload-queue.ts b/apps/web/src/features/library/library-upload-queue.tsindex d3396551..1ae76e43 100644--- a/apps/web/src/features/library/library-upload-queue.ts+++ b/apps/web/src/features/library/library-upload-queue.ts@@ -1,16 +1,32 @@import { useSyncExternalStore } from "react";+import type { Message } from "@/i18n/messages";++import { libraryMessages as m } from "./library.messages";+/** One file to upload and the folder path, relative to the drop target, it came from. */export interface UploadSource {file: File;folderPath: readonly string[];}+/**+ * Why something failed: TeamHub's or the browser's own words as they came, or+ * a message. The queue outlives the page, so a message is kept as it is and+ * worded in the language on screen when it is shown.+ */+export type UploadErrorText = string | Message<string>;+export interface UploadFailure {filename: string;- message: string;+ message: UploadErrorText;}+/** One reason, or the entries of a batch that failed. */+export type TenantUploadError =+ | UploadErrorText+ | { readonly failures: readonly UploadFailure[] };+/** Everything one drop or folder pick asks to upload. */export interface UploadBatch {/** Folders to recreate even when they hold no files. */@@ -33,7 +49,7 @@ export interface PendingDocumentUpload {interface TenantUploads {/** True while a batch runs, so a second batch cannot race it from another view. */active: boolean;- error: string | null;+ error: TenantUploadError | null;uploads: readonly PendingDocumentUpload[];}@@ -80,7 +96,7 @@ export const tenantUploads = {setActive(tenantId: string, active: boolean) {update(tenantId, (current) => ({ ...current, active }));},- setError(tenantId: string, error: string | null) {+ setError(tenantId: string, error: TenantUploadError | null) {update(tenantId, (current) => ({ ...current, error }));},};@@ -193,10 +209,7 @@ async function readEntry(} catch (readError) {batch.readFailures.push({filename: path,- message:- readError instanceof Error- ? readError.message- : "It could not be read.",+ message: readError instanceof Error ? readError.message : m.entryNotRead,});}}diff --git a/apps/web/src/features/library/library-workspace-tabs.tsx b/apps/web/src/features/library/library-workspace-tabs.tsxindex 6559f863..db5a3ba3 100644--- a/apps/web/src/features/library/library-workspace-tabs.tsx+++ b/apps/web/src/features/library/library-workspace-tabs.tsx@@ -1,17 +1,13 @@import { UnderlineTabs } from "@/components/ui/underline-tabs";+import { useT } from "@/i18n/use-translation";+import { libraryMessages as m } from "./library.messages";++/** Each view's texts are messages, worded when they are shown. */export const workspaceTabs = [- {- empty: "No documents created by you",- id: "owned",- label: "My pages",- },- {- empty: "No documents shared with you",- id: "shared",- label: "Shared with me",- },- { empty: "", id: "meetings", label: "Meetings" },+ { empty: m.ownedEmpty, id: "owned", label: m.myPages },+ { empty: m.sharedEmpty, id: "shared", label: m.sharedWithMe },+ { empty: undefined, id: "meetings", label: m.meetings },] as const;export type WorkspaceTab = (typeof workspaceTabs)[number]["id"];@@ -22,10 +18,11 @@ export function WorkspaceTabs({onChange: (tab: WorkspaceTab) => void;value: WorkspaceTab;}) {+ const t = useT();return (<UnderlineTabs- items={workspaceTabs}- label="Library views"+ items={workspaceTabs.map(({ id, label }) => ({ id, label: t(label) }))}+ label={t(m.libraryViews)}onChange={onChange}value={value}/>diff --git a/apps/web/src/features/library/library.messages.ts b/apps/web/src/features/library/library.messages.tsnew file mode 100644index 00000000..56b66e08--- /dev/null+++ b/apps/web/src/features/library/library.messages.ts@@ -0,0 +1,170 @@+import { defineMessages } from "@/i18n/messages";++/** The Library pages: the file list, the sidebar trees and their dialogs. */+export const libraryMessages = defineMessages("library", {+ // The Library home: heading, tabs and the New menu.+ title: "Library",+ libraryViews: "Library views",+ myPages: "My pages",+ sharedWithMe: "Shared with me",+ meetings: "Meetings",+ ownedEmpty: "No documents created by you",+ sharedEmpty: "No documents shared with you",+ newMenu: "New",+ newFile: "New file",+ newFolder: "New folder",+ importFile: "Import",+ uploadFolder: "Upload folder",+ createInMyPages: "Create in My pages",+ releaseToUploadTo: "Release to upload to {folder}",+ loadingHistory: "Loading history…",++ // Recent cards and the file list.+ recent: "Recent",+ loadingDocuments: "Loading documents…",+ recentUnavailable: "Recent documents are unavailable.",+ noRecent: "No recently updated documents",+ listUnavailable: "Document list is unavailable.",+ viewDocuments: "{view} documents",+ actionsFor: "Actions for {name}",+ visibleIn: "Visible in {places}",+ noLinkedContext: "No linked context",+ uploadQueued: "{filename} upload queued",+ uploadUploading: "{filename} upload uploading",++ // Filters and one open folder.+ fileType: "File type",+ typeAll: "All types",+ typeMarkdown: "Markdown",+ typePdf: "PDF",+ typeWord: "Word",+ typeSpreadsheet: "Spreadsheets (Excel / CSV)",+ typePresentation: "PowerPoint",+ typeHtml: "HTML",+ typeText: "Plain text",+ typeImage: "Images",+ typeAudio: "Audio",+ typeVideo: "Video",+ typeArchive: "Archives",+ typeCode: "Code",+ typeOthers: "Others",+ sortDocuments: "Sort documents",+ sortByModified: "Sort by last modified",+ sortByName: "Sort by name",+ dismiss: "Dismiss",+ folderEmpty: "This folder is empty",+ folderPath: "Folder path",+ openFolder: "Open folder {name}",+ folder: "Folder",++ // The upload queue and what went wrong in it.+ uploadProgress: "Upload progress",+ uploadingFile: "Uploading {filename}",+ preparingUpload: "Preparing upload…",+ filesLeft: { one: "{count} file left", other: "{count} files left" },+ currentFileUpload: "Current file upload",+ uploadBusy: "Wait for the current upload to finish before adding more files.",+ noSupportedFiles: "No supported files were found in the drop.",+ uploadFolderMissing: "Its folder could not be created.",+ entryNotRead: "It could not be read.",+ documentNotImported: "The document could not be imported.",+ uploadFailure: "{filename}: {message}",+ uploadFailures: {+ one: "{count} file could not be uploaded ({names}). {message}",+ other: "{count} files could not be uploaded ({names}). {message}",+ },+ uploadFailuresMore: {+ one: "{count} file could not be uploaded ({names} and {more} more). {message}",+ other:+ "{count} files could not be uploaded ({names} and {more} more). {message}",+ },++ // The sidebar beside an open Document.+ librarySidebar: "Library sidebar",+ wikiSidebar: "Wiki sidebar",+ resizeLibrarySidebar: "Resize Library sidebar",+ resizeWikiSidebar: "Resize Wiki sidebar",+ backToLibrary: "Back to Library",+ closeOwnedByMe: "Close Owned by Me",++ // The My pages tree.+ ownedByMe: "Owned by Me",+ ownedTree: "Owned by Me tree",+ expandOwned: "Expand Owned by Me",+ collapseOwned: "Collapse Owned by Me",+ createInOwned: "Create in Owned by Me",+ treeUnavailable: "The Document tree is unavailable.",+ loadingTree: "Loading tree…",+ noDocumentsYet: "No documents yet.",+ renameFolder: "Rename folder",+ rename: "Rename",+ move: "Move",+ copyLink: "Copy link",+ download: "Download",+ duplicate: "Duplicate",+ // The name a new folder starts with; once created it is the folder's name.+ defaultFolderName: "New Folder",+ defaultFolderNameNumbered: "New Folder {index}",++ // The Shared with me tree.+ sharedTree: "Shared with me tree",+ expandShared: "Expand Shared with me",+ collapseShared: "Collapse Shared with me",+ organizeShared: "Organize Shared with me",+ sharedUnavailable: "Shared with me is unavailable.",+ renameSharedFolder: "Rename shared folder",+ actionsForSharedFolder: "Actions for shared folder {name}",+ actionsForSharedDocument: "Actions for shared document {name}",+ // How a shared Document reached the reader, and with which role.+ accessSource: "{source} {role}",+ sourceDirect: "Direct",+ sourceRoom: "Room context",+ sourceTask: "Task context",+ sourceWiki: "Wiki context",+ sourceLink: "Link audience",+ sourceOwner: "Owner",+ roleViewer: "Viewer",+ roleEditor: "Editor",+ roleManager: "Manager",+ roleOwner: "Owner",++ // What an action answers when TeamHub gave no reason.+ folderNotCreated: "The folder could not be created.",+ folderNotRenamed: "The folder could not be renamed.",+ folderNotDeleted: "The folder could not be deleted.",+ documentNotCreated: "The document could not be created.",+ documentNotDuplicated: "The document could not be duplicated.",+ documentNotExported: "The document could not be exported.",+ documentNotMoved: "The document could not be moved.",+ documentNotTrashed: "The document could not be moved to trash.",+ documentNotDeleted: "The document could not be deleted.",+ itemNotMoved: "The item could not be moved.",+ fileNotRenamed: "The file could not be renamed.",+ documentNotCopied: "The Document could not be copied.",++ // Dialogs.+ create: "Create",+ folderName: "Folder name",+ renameFile: "Rename file",+ fileName: "File name",+ deleteDocumentTitle: "Delete Document?",+ deleteDocumentBody:+ "{title} will be deleted from all Rooms and shared locations. It cannot currently be restored from the product.",+ copyToMyDocuments: "Copy to My Documents",+ destination: "Destination",+ copyDestination: "Copy destination",+ myDocuments: "My Documents",+ moveTo: "Move {name} to…",+ moveDocumentTo: "Move document to…",+ moveHere: "Move here",+ searchFolders: "Search folders",+ searchFoldersPlaceholder: "Search folders…",+ clearFolderSearch: "Clear folder search",+ moveDestinationFolders: "Move destination folders",+ expandFolder: "Expand {name}",+ collapseFolder: "Collapse {name}",+ selectFolder: "Select {name}",+ current: "Current",+ noFoldersFound: "No folders found.",+ folderSearchResults: "Folder search results",+});diff --git a/apps/web/src/features/library/move-folder-picker-dialog.tsx b/apps/web/src/features/library/move-folder-picker-dialog.tsxindex 32df7882..6b6ba8df 100644--- a/apps/web/src/features/library/move-folder-picker-dialog.tsx+++ b/apps/web/src/features/library/move-folder-picker-dialog.tsx@@ -10,6 +10,10 @@ import { useMemo, useState } from "react";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 { libraryMessages as m } from "./library.messages";export interface MoveFolder {id: string;@@ -31,11 +35,13 @@ export function MoveFolderPickerDialog({currentParentId?: string;disabledFolderIds?: ReadonlySet<string>;folders: MoveFolder[];- label: string;+ /** The name of what moves; without one the title says "document". */+ label: string | undefined;onCancel: () => void;onMove: (parentId: string) => void;rootLabel: string;}) {+ const t = useT();const availableFolders = useMemo(() => folders.filter((folder) => !disabledFolderIds.has(folder.id)),[disabledFolderIds, folders],@@ -84,42 +90,42 @@ export function MoveFolderPickerDialog({closeOnBackdroponClose={onCancel}size="lg"- title={`Move ${label} to…`}+ title={label ? t(m.moveTo, { name: label }) : t(m.moveDocumentTo)}footer={<><Button onClick={onCancel} tone="secondary">- Cancel+ {t(commonMessages.cancel)}</Button><Buttondisabled={targetId === currentTargetId}onClick={() => onMove(targetId)}tone="primary">- Move here+ {t(m.moveHere)}</Button></>}><div className="px-5 py-4"><label className="relative block">- <span className="sr-only">Search folders</span>+ <span className="sr-only">{t(m.searchFolders)}</span><Iconicon={Search01Icon}className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-app-muted"size={16}/><input- aria-label="Search folders"+ aria-label={t(m.searchFolders)}className="h-10 w-full rounded-lg border border-border bg-card pl-10 pr-9 text-sm text-foreground outline-none transition-colors placeholder:text-app-placeholder hover:border-border-hover focus:border-foreground focus:ring-2 focus:ring-ring"onChange={(event) => setQuery(event.target.value)}- placeholder="Search folders…"+ placeholder={t(m.searchFoldersPlaceholder)}role="searchbox"type="text"value={query}/>{query ? (<button- aria-label="Clear folder search"+ aria-label={t(m.clearFolderSearch)}className="absolute right-2 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-sm text-app-muted hover:bg-app-hover hover:text-app-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-app-focus"onClick={() => setQuery("")}type="button"@@ -139,7 +145,7 @@ export function MoveFolderPickerDialog({targetId={targetId}/>) : (- <div aria-label="Move destination folders" role="tree">+ <div aria-label={t(m.moveDestinationFolders)} role="tree"><FolderTargetRowcurrent={currentTargetId === rootId}folderId={rootId}@@ -240,6 +246,7 @@ function FolderTargetRow({onToggle?: (folderId: string) => void;selected: boolean;}) {+ const t = useT();return (<divaria-current={current ? "location" : undefined}@@ -255,7 +262,7 @@ function FolderTargetRow({>{onToggle ? (<button- aria-label={`${expanded ? "Collapse" : "Expand"} ${name}`}+ aria-label={t(expanded ? m.collapseFolder : m.expandFolder, { name })}className="flex size-8 shrink-0 items-center justify-center rounded-sm text-app-muted hover:text-app-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-app-focus"onClick={() => onToggle(folderId)}type="button"@@ -270,7 +277,7 @@ function FolderTargetRow({<span aria-hidden="true" className="size-8 shrink-0" />)}<button- aria-label={`Select ${name}`}+ aria-label={t(m.selectFolder, { name })}className="flex min-h-10 min-w-0 flex-1 items-center gap-2 text-left outline-none focus-visible:rounded-sm focus-visible:ring-2 focus-visible:ring-app-focus"onClick={() => onSelect(folderId)}type="button"@@ -283,7 +290,9 @@ function FolderTargetRow({<span className="truncate text-sm">{name}</span></button>{current ? (- <span className="ml-2 shrink-0 text-xs text-app-muted">Current</span>+ <span className="ml-2 shrink-0 text-xs text-app-muted">+ {t(m.current)}+ </span>) : null}</div>);@@ -302,15 +311,16 @@ function FolderSearchResults({pathsById: ReadonlyMap<string, string>;targetId: string;}) {+ const t = useT();if (folders.length === 0) {return (<p className="px-3 py-10 text-center text-sm text-app-muted">- No folders found.+ {t(m.noFoldersFound)}</p>);}return (- <ul aria-label="Folder search results">+ <ul aria-label={t(m.folderSearchResults)}>{folders.map((folder) => (<liclassName={`my-0.5 rounded-md ${@@ -319,7 +329,9 @@ function FolderSearchResults({key={folder.id}><button- aria-label={`Select ${pathsById.get(folder.id) ?? folder.name}`}+ aria-label={t(m.selectFolder, {+ name: pathsById.get(folder.id) ?? folder.name,+ })}aria-pressed={targetId === folder.id}className="flex min-h-12 w-full min-w-0 items-center gap-2 px-3 text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-app-focus"onClick={() => onSelect(folder.id)}@@ -339,7 +351,9 @@ function FolderSearchResults({</span></span>{currentTargetId === folder.id ? (- <span className="shrink-0 text-xs text-app-muted">Current</span>+ <span className="shrink-0 text-xs text-app-muted">+ {t(m.current)}+ </span>) : null}</button></li>diff --git a/apps/web/src/features/library/my-documents-tree-helpers.ts b/apps/web/src/features/library/my-documents-tree-helpers.tsindex 86564e05..526d7772 100644--- a/apps/web/src/features/library/my-documents-tree-helpers.ts+++ b/apps/web/src/features/library/my-documents-tree-helpers.ts@@ -1,9 +1,15 @@import type { QueryClient } from "@tanstack/react-query";import type { TeamHubDocumentPlacementNode } from "@/features/teamhub/teamhub-types";+import { type Translate, translate } from "@/i18n/language";import { documentFileName } from "./document-display-name";-import type { UploadFailure } from "./library-upload-queue";+import type {+ TenantUploadError,+ UploadErrorText,+ UploadFailure,+} from "./library-upload-queue";+import { libraryMessages as m } from "./library.messages";export type DocumentTreeFolder = Extract<TeamHubDocumentPlacementNode,@@ -55,9 +61,14 @@ export function isFolderMoveCycle(return false;}+/**+ * The name a new folder starts with, in the language on screen. Once the+ * folder exists the name is its own and no longer follows the language.+ */export function nextFolderName(items: readonly TeamHubDocumentPlacementNode[],parentId?: string,+ t: Translate = translate,) {const rootNames = new Set(items@@ -67,9 +78,10 @@ export function nextFolderName().map((item) => item.name.toLocaleLowerCase()),);- if (!rootNames.has("new folder")) return "New Folder";+ const name = t(m.defaultFolderName);+ if (!rootNames.has(name.toLocaleLowerCase())) return name;for (let index = 2; ; index += 1) {- const candidate = `New Folder ${index}`;+ const candidate = t(m.defaultFolderNameNumbered, { index });if (!rootNames.has(candidate.toLocaleLowerCase())) return candidate;}}@@ -108,17 +120,42 @@ export function nextAvailableFolderName(}}-export function uploadFailureMessage(failures: readonly UploadFailure[]) {+/** Words a kept upload error in the language on screen. */+export function uploadErrorText(+ error: TenantUploadError,+ t: Translate = translate,+) {+ if (typeof error === "string") return error;+ return "failures" in error+ ? uploadFailureMessage(error.failures, t)+ : t(error);+}++export function uploadFailureMessage(+ failures: readonly UploadFailure[],+ t: Translate = translate,+) {+ const worded = (text: UploadErrorText) =>+ typeof text === "string" ? text : t(text);+ const [first] = failures;+ const message = worded(first!.message);if (failures.length === 1) {- const [failure] = failures;- return `${failure!.filename}: ${failure!.message}`;+ return t(m.uploadFailure, { filename: first!.filename, message });}+ // File names, listed as they are.const names = failures.slice(0, 3).map((failure) => failure.filename).join(", ");- const more = failures.length > 3 ? ` and ${failures.length - 3} more` : "";- return `${failures.length} files could not be uploaded (${names}${more}). ${failures[0]!.message}`;+ const more = failures.length - 3;+ return more > 0+ ? t(m.uploadFailuresMore, {+ count: failures.length,+ message,+ more,+ names,+ })+ : t(m.uploadFailures, { count: failures.length, message, names });}export function nextAvailableUploadFilename(diff --git a/apps/web/src/features/library/my-documents-tree-level.tsx b/apps/web/src/features/library/my-documents-tree-level.tsxindex 1fe1f91a..55c3522c 100644--- a/apps/web/src/features/library/my-documents-tree-level.tsx+++ b/apps/web/src/features/library/my-documents-tree-level.tsx@@ -28,9 +28,12 @@ import type {TeamHubDocumentPlacementNode,TeamHubDocumentTreeSummary,} from "@/features/teamhub/teamhub-types";+import { commonMessages } from "@/i18n/common.messages";+import type { Translate } from "@/i18n/language";import { documentFileName } from "./document-display-name";import { compareTreeItems } from "./document-tree-order";+import { libraryMessages as m } from "./library.messages";import {readDroppedUploadSources,type PendingDocumentUpload,@@ -84,6 +87,8 @@ export interface TreeLevelInput {pendingUploads: readonly PendingDocumentUpload[];revealDocumentId: string | null;renamingFolder: { id: string; name: string } | null;+ /** Words the menus and labels in the language on screen. */+ t: Translate;tenantId: string;}@@ -108,7 +113,7 @@ export function revealCurrentTreeNode(return;}const scrollContainer = node.closest<HTMLElement>(- 'aside[aria-label="Library sidebar"]',+ "aside[data-library-sidebar]",);if (scrollContainer) {const nodeRect = node.getBoundingClientRect();@@ -206,7 +211,9 @@ export function renderTreeLevel(input: TreeLevelInput): ReactNode[] {: renderDocumentNode(item, input),);const uploads = input.pendingUploads.flatMap((upload) =>- upload.parentId === input.parentId ? [renderUploadNode(upload)] : [],+ upload.parentId === input.parentId+ ? [renderUploadNode(upload, input.t)]+ : [],);return [...nodes, ...uploads];}@@ -291,7 +298,7 @@ function renderFolderNode(item: DocumentTreeFolder, input: TreeLevelInput) {function renderFolderRenameInput(input: TreeLevelInput) {return (<input- aria-label="Rename folder"+ aria-label={input.t(m.renameFolder)}className="h-[33px] min-w-0 flex-1 rounded-md border border-app-focus bg-app-surface px-2 text-[14px] leading-[18px] outline-none"onChange={(event) => input.onRenameChange(event.target.value)}onKeyDown={(event) => {@@ -352,39 +359,40 @@ function renderFolderLabel(},],icon: <Icon icon={FileAddIcon} size={14} />,- label: "New file",+ label: input.t(m.newFile),},{icon: <Icon icon={FolderAddIcon} size={14} />,- label: "New folder",+ label: input.t(m.newFolder),onSelect: () => input.onCreateFolder(item.id),},{icon: <Icon icon={FileImportIcon} size={14} />,- label: "Import",+ label: input.t(m.importFile),onSelect: () => input.onImportPick(item.id),},{icon: <Icon icon={PencilEdit01Icon} size={14} />,- label: "Rename",+ label: input.t(m.rename),onSelect: () => input.onBeginRename(item),separatorBefore: true,},{icon: <Icon icon={FolderExportIcon} size={14} />,- label: "Move",+ label: input.t(m.move),onSelect: () => input.onMoveBegin(item),},{danger: true,disabled: input.deletingFolderId === item.id,icon: <Icon icon={Delete02Icon} size={14} />,- label: "Delete",+ voiceRisk: "never",+ label: input.t(commonMessages.delete),onSelect: () => input.onDeleteFolder(item.id),separatorBefore: true,},]}- label={`Actions for ${item.name}`}+ label={input.t(m.actionsFor, { name: item.name })}/></>);@@ -459,50 +467,54 @@ function renderDocumentActions(items={[{icon: <Icon icon={Copy01Icon} size={14} />,- label: "Copy link",+ label: input.t(m.copyLink),onSelect: () => input.onCopyLink(document),},{disabled: !canRenameDocument(document),icon: <Icon icon={PencilEdit01Icon} size={14} />,- label: "Rename",+ label: input.t(m.rename),onSelect: () => input.onRenameDocument(document),},{disabled: !document.capabilities.export,icon: <Icon icon={Download01Icon} size={14} />,- label: "Download",+ label: input.t(m.download),onSelect: () => input.onExportDocument(document),},{disabled: !document.capabilities.duplicate,icon: <Icon icon={Copy01Icon} size={14} />,- label: "Duplicate",+ label: input.t(m.duplicate),onSelect: () => input.onDuplicateDocument(document, item.parent_id),},{icon: <Icon icon={FolderExportIcon} size={14} />,- label: "Move",+ label: input.t(m.move),onSelect: () => input.onMoveBegin(item),},{danger: true,disabled: !document.capabilities.delete,icon: <Icon icon={Delete02Icon} size={14} />,- label: "Delete",+ voiceRisk: "never",+ label: input.t(commonMessages.delete),onSelect: () => input.onTrashDocument(document),separatorBefore: true,},]}- label={`Actions for ${fileName}`}+ label={input.t(m.actionsFor, { name: fileName })}/>);}-function renderUploadNode(upload: PendingDocumentUpload) {+function renderUploadNode(upload: PendingDocumentUpload, t: Translate) {return (<div- aria-label={`${upload.filename} upload ${upload.status}`}+ aria-label={t(+ upload.status === "uploading" ? m.uploadUploading : m.uploadQueued,+ { filename: upload.filename },+ )}className="my-0.5 flex h-[33px] min-w-0 items-center gap-2 rounded-md px-2 text-[14px] leading-[18px] text-app-muted"key={upload.id}// eslint-disable-next-line jsx-a11y/role-has-required-aria-props -- selection is not tracked for this tree itemdiff --git a/apps/web/src/features/library/my-documents-tree-view.tsx b/apps/web/src/features/library/my-documents-tree-view.tsxindex e5de914c..344b88f3 100644--- a/apps/web/src/features/library/my-documents-tree-view.tsx+++ b/apps/web/src/features/library/my-documents-tree-view.tsx@@ -14,9 +14,11 @@ import type {TeamHubDocumentPlacementNode,TeamHubDocumentTreeSummary,} from "@/features/teamhub/teamhub-types";+import { useT } from "@/i18n/use-translation";import { DocumentDeleteDialog } from "./document-delete-dialog";import { documentFileName } from "./document-display-name";+import { libraryMessages as m } from "./library.messages";import {readDroppedUploadSources,type UploadBatch,@@ -168,11 +170,12 @@ function OwnedTreeHeading({onImportPick: () => void;onToggleCollection: () => void;}) {+ const t = useT();return (<div className="document-tree-heading flex items-center justify-between gap-1"><buttonaria-expanded={!collectionCollapsed}- aria-label={`${collectionCollapsed ? "Expand" : "Collapse"} Owned by Me`}+ aria-label={t(collectionCollapsed ? m.expandOwned : m.collapseOwned)}className={workspaceHeadingToggleClass}onClick={onToggleCollection}type="button"@@ -182,7 +185,7 @@ function OwnedTreeHeading({className="shrink-0 text-app-muted"size={WORKSPACE_HEADING_ICON_SIZE}/>- <span className="truncate">My pages</span>+ <span className="truncate">{t(m.myPages)}</span></button><ActionMenuplacement="right-start"@@ -192,22 +195,22 @@ function OwnedTreeHeading({children: [{ label: "md", onSelect: onCreateDocument }],disabled: createDisabled,icon: <Icon icon={FileAddIcon} size={16} />,- label: "New file",+ label: t(m.newFile),},{disabled: createDisabled,icon: <Icon icon={FolderAddIcon} size={16} />,- label: "New folder",+ label: t(m.newFolder),onSelect: onCreateFolder,},{disabled: createDisabled,icon: <Icon icon={FileImportIcon} size={16} />,- label: "Import",+ label: t(m.importFile),onSelect: onImportPick,},]}- label="Create in Owned by Me"+ label={t(m.createInOwned)}trigger={<Icon icon={PlusSignIcon} size={WORKSPACE_HEADING_ICON_SIZE} />}@@ -223,6 +226,7 @@ function OwnedTreeBody({model: MyDocumentsTreeModel;onRenameDocument: (document: TeamHubDocumentTreeSummary) => void;}) {+ const t = useT();const { movingPlacement } = model;return (<>@@ -244,7 +248,7 @@ function OwnedTreeBody({);return movingDocument? documentFileName(movingDocument)- : "document";+ : undefined;})()}onCancel={model.onMoveCancel}@@ -254,23 +258,23 @@ function OwnedTreeBody({) : null}{model.loadError ? (<p className="px-1 py-3 text-xs text-app-danger" role="alert">- {model.loadError.message || "The Document tree is unavailable."}+ {model.loadError.message || t(m.treeUnavailable)}</p>) : model.pending ? (<p className="flex items-center gap-2 px-1 py-3 text-xs text-app-muted"><Spinner size={14} />- Loading tree…+ {t(m.loadingTree)}</p>) : (<>{model.items.length === 0 && model.pendingUploads.length === 0 ? (<p className="py-3 pl-[30px] pr-2 text-xs text-muted-foreground">- No documents yet.+ {t(m.noDocumentsYet)}</p>) : (// eslint-disable-next-line jsx-a11y/interactive-supports-focus -- composite widget: focus is managed on its child items<div- aria-label="Owned by Me"+ aria-label={t(m.ownedByMe)}className="mt-2 ml-4"onKeyDown={model.onTreeKeyDown}role="tree"@@ -308,6 +312,7 @@ function OwnedTreeBody({pendingUploads: model.pendingUploads,revealDocumentId: model.revealDocumentId,renamingFolder: model.renamingFolder,+ t,tenantId: model.tenantId,})}</div>@@ -329,9 +334,10 @@ function OwnedDocumentDropZone({onEnter: () => void;onFiles: (batch: Promise<UploadBatch>) => void;}) {+ const t = useT();return (<section- aria-label="Owned by Me tree"+ aria-label={t(m.ownedTree)}onDragEnter={(event) => {if (!isExternalFileTransfer(event.dataTransfer)) return;event.preventDefault();@@ -369,11 +375,13 @@ function MovePlacementDialog({}: {folders: DocumentTreeFolder[];items: TeamHubDocumentPlacementNode[];- label: string;+ /** The name of what moves; a Document that is no longer listed has none. */+ label: string | undefined;onCancel: () => void;onMove: (parentId: string) => void;placement: TeamHubDocumentPlacementNode;}) {+ const t = useT();const disabledFolderIds = new Set<string>();if (placement.node_kind === "folder") {for (const folder of folders) {@@ -390,7 +398,7 @@ function MovePlacementDialog({label={label}onCancel={onCancel}onMove={onMove}- rootLabel="Owned by Me"+ rootLabel={t(m.ownedByMe)}/>);}diff --git a/apps/web/src/features/library/shared-documents-tree.tsx b/apps/web/src/features/library/shared-documents-tree.tsxindex 0802d7e0..98d90ebf 100644--- a/apps/web/src/features/library/shared-documents-tree.tsx+++ b/apps/web/src/features/library/shared-documents-tree.tsx@@ -37,9 +37,13 @@ import type {TeamHubDocumentPlacementNode,TeamHubDocumentTreeSummary,} from "@/features/teamhub/teamhub-types";+import { commonMessages } from "@/i18n/common.messages";+import type { Translate } from "@/i18n/language";+import { useT } from "@/i18n/use-translation";import { DocumentDeleteDialog } from "./document-delete-dialog";import { documentFileName } from "./document-display-name";+import { libraryMessages as m } from "./library.messages";import { useLibraryTreeState } from "./use-library-tree-state";import { MoveFolderPickerDialog } from "./move-folder-picker-dialog";import {@@ -79,6 +83,7 @@ function useSharedDocumentsTreeModel({}) {const { client } = useTeamHubRuntime();const navigate = useNavigate();+ const t = useT();const [trashingDocument, setTrashingDocument] =useState<TeamHubDocumentTreeSummary | null>(null);const [trashPending, setTrashPending] = useState(false);@@ -154,7 +159,7 @@ function useSharedDocumentsTreeModel({void navigate(`/t/${encodeURIComponent(tenantId)}/library`);setTrashingDocument(null);} catch (cause) {- setError(sharedTreeError(cause, "The document could not be deleted."));+ setError(sharedTreeError(cause, t(m.documentNotDeleted)));} finally {setTrashPending(false);}@@ -185,7 +190,7 @@ function useSharedDocumentsTreeModel({const content = await client.downloadLatestDocument(document.id);triggerArtifactDownload(content.blob, filename);} catch (cause) {- setError(sharedTreeError(cause, "The document could not be exported."));+ setError(sharedTreeError(cause, t(m.documentNotExported)));}}@@ -241,7 +246,7 @@ function useSharedDocumentsTreeModel({client.api.POST("/v0/tenants/{tenantId}/me/shared-document-folders", {params: { path: { tenantId } },body: {- name: nextSharedFolderName(folders),+ name: nextSharedFolderName(folders, t),...(parentId ? { parent_id: parentId } : {}),},}),@@ -257,7 +262,7 @@ function useSharedDocumentsTreeModel({setFocusedNodeId(folder.id);setRenaming({ id: folder.id, name: folder.name });} catch (cause) {- setError(sharedTreeError(cause, "The folder could not be created."));+ setError(sharedTreeError(cause, t(m.folderNotCreated)));} finally {setCreating(false);}@@ -281,7 +286,7 @@ function useSharedDocumentsTreeModel({setRenaming(null);await refresh();} catch (cause) {- setError(sharedTreeError(cause, "The folder could not be renamed."));+ setError(sharedTreeError(cause, t(m.folderNotRenamed)));}}@@ -316,7 +321,7 @@ function useSharedDocumentsTreeModel({setMoving(null);await refresh();} catch (cause) {- setError(sharedTreeError(cause, "The item could not be moved."));+ setError(sharedTreeError(cause, t(m.itemNotMoved)));}}@@ -333,7 +338,7 @@ function useSharedDocumentsTreeModel({);await refresh();} catch (cause) {- setError(sharedTreeError(cause, "The folder could not be deleted."));+ setError(sharedTreeError(cause, t(m.folderNotDeleted)));} finally {setDeletingFolderId(null);}@@ -523,8 +528,9 @@ function SharedDocumentsTreeSurface({treeError: Error | null;treePending: boolean;}) {+ const t = useT();return (- <section aria-label="Shared with me tree">+ <section aria-label={t(m.sharedTree)}>{trashingDocument ? (<DocumentDeleteDialogtitle={documentFileName(trashingDocument)}@@ -537,7 +543,9 @@ function SharedDocumentsTreeSurface({<div className="flex items-center justify-between gap-1"><buttonaria-expanded={!collectionCollapsed}- aria-label={`${collectionCollapsed ? "Expand" : "Collapse"} Shared with me`}+ aria-label={t(+ collectionCollapsed ? m.expandShared : m.collapseShared,+ )}className={workspaceHeadingToggleClass}onClick={onCollectionToggle}type="button"@@ -547,7 +555,7 @@ function SharedDocumentsTreeSurface({className="shrink-0 text-app-muted"size={WORKSPACE_HEADING_ICON_SIZE}/>- <span className="truncate">Shared with me</span>+ <span className="truncate">{t(m.sharedWithMe)}</span></button><ActionMenuplacement="right-start"@@ -556,11 +564,11 @@ function SharedDocumentsTreeSurface({{disabled: creating || treePending || treeError !== null,icon: <Icon icon={FolderAddIcon} size={16} />,- label: "New folder",+ label: t(m.newFolder),onSelect: () => onCreateFolder(),},]}- label="Organize Shared with me"+ label={t(m.organizeShared)}trigger={<Icon icon={PlusSignIcon} size={WORKSPACE_HEADING_ICON_SIZE} />}@@ -580,7 +588,7 @@ function SharedDocumentsTreeSurface({label={moving.node_kind === "folder"? moving.name- : (documentsById.get(moving.document_id)?.title ?? "document")+ : documentsById.get(moving.document_id)?.title}node={moving}onCancel={onMoveCancel}@@ -589,17 +597,17 @@ function SharedDocumentsTreeSurface({) : null}{treeError ? (<p className="px-1 py-2 text-xs text-app-danger" role="alert">- {treeError.message || "Shared with me is unavailable."}+ {treeError.message || t(m.sharedUnavailable)}</p>) : treePending ? (<p className="flex items-center gap-2 px-1 py-2 text-xs text-app-muted"><Spinner size={14} />- Loading tree…+ {t(m.loadingTree)}</p>) : items.length > 0 ? (// eslint-disable-next-line jsx-a11y/interactive-supports-focus -- composite widget: focus is managed on its child items<div- aria-label="Shared with me"+ aria-label={t(m.sharedWithMe)}className="mt-2 ml-4"onKeyDown={onTreeKeyDown}role="tree"@@ -628,6 +636,7 @@ function SharedDocumentsTreeSurface({onToggle,parentId: undefined,renaming,+ t,tenantId,})}</div>@@ -662,6 +671,7 @@ function renderSharedTreeLevel(input: {onToggle: (folderId: string) => void;parentId: string | undefined;renaming: SharedTreeRenaming;+ t: Translate;tenantId: string;}): ReactNode {const moveFromDrag = (event: DragEvent, parentId: string) => {@@ -731,7 +741,7 @@ function renderSharedTreeLevel(input: {>{isRenaming ? (<input- aria-label="Rename shared folder"+ aria-label={input.t(m.renameSharedFolder)}className="h-[33px] min-w-0 flex-1 rounded-md border border-app-focus bg-app-surface px-2 text-[14px] leading-[18px] outline-none"onChange={(event) => input.onRenameChange(event.target.value)}onKeyDown={(event) => {@@ -772,30 +782,33 @@ function renderSharedTreeLevel(input: {items={[{icon: <Icon icon={FolderAddIcon} size={14} />,- label: "New folder",+ label: input.t(m.newFolder),onSelect: () => input.onCreateFolder(item.id),},{icon: <Icon icon={PencilEdit01Icon} size={14} />,- label: "Rename",+ label: input.t(m.rename),onSelect: () => input.onBeginRename(item),separatorBefore: true,},{icon: <Icon icon={FolderExportIcon} size={14} />,- label: "Move",+ label: input.t(m.move),onSelect: () => input.onMoveBegin(item),},{danger: true,disabled: input.deletingFolderId === item.id,icon: <Icon icon={Delete02Icon} size={14} />,- label: "Delete",+ voiceRisk: "never",+ label: input.t(commonMessages.delete),onSelect: () => input.onDeleteFolder(item.id),separatorBefore: true,},]}- label={`Actions for shared folder ${item.name}`}+ label={input.t(m.actionsForSharedFolder, {+ name: item.name,+ })}trigger={<Icon icon={MoreHorizontalIcon} size={14} />}/></>@@ -812,7 +825,7 @@ function renderSharedTreeLevel(input: {const document = input.documentsById.get(item.document_id);if (!document || document.status !== "active") return null;const fileName = documentFileName(document);- const provenance = sharedAccessProvenanceLabel(document);+ const provenance = sharedAccessProvenanceLabel(document, input.t);const current = document.id === input.activeDocumentId;return (<div@@ -867,31 +880,32 @@ function renderSharedTreeLevel(input: {items={[{icon: <Icon icon={Copy01Icon} size={14} />,- label: "Copy link",+ label: input.t(m.copyLink),onSelect: () => input.onCopyLink(document),},{disabled: !document.capabilities.export,icon: <Icon icon={Download01Icon} size={14} />,- label: "Download",+ label: input.t(m.download),onSelect: () => input.onExport(document),},{icon: <Icon icon={FolderExportIcon} size={14} />,- label: "Move",+ label: input.t(m.move),onSelect: () => input.onMoveBegin(item),},...(document.capabilities.delete? [{icon: <Icon icon={Delete02Icon} size={14} />,- label: "Delete",+ voiceRisk: "never" as const,+ label: input.t(commonMessages.delete),onSelect: () => input.onTrashDocument(document),},]: []),]}- label={`Actions for shared document ${fileName}`}+ label={input.t(m.actionsForSharedDocument, { name: fileName })}trigger={<Icon icon={MoreHorizontalIcon} size={14} />}/></div>@@ -899,24 +913,37 @@ function renderSharedTreeLevel(input: {});}-function sharedAccessProvenanceLabel(document: TeamHubDocumentTreeSummary) {+const accessRoles = {+ editor: m.roleEditor,+ manager: m.roleManager,+ owner: m.roleOwner,+ viewer: m.roleViewer,+};++function sharedAccessProvenanceLabel(+ document: TeamHubDocumentTreeSummary,+ t: Translate,+) {const labels: string[] = [];for (const source of document.access_sources ?? []) {if (source.status === "active") {const sourceLabel =source.source_kind === "direct"- ? "Direct"+ ? m.sourceDirect: source.source_kind === "context"? source.provenance.binding_kind === "room"- ? "Room context"+ ? m.sourceRoom: source.provenance.binding_kind === "task"- ? "Task context"- : "Wiki context"+ ? m.sourceTask+ : m.sourceWiki: source.source_kind === "link"- ? "Link audience"- : "Owner";+ ? m.sourceLink+ : m.sourceOwner;labels.push(- `${sourceLabel} ${source.role.charAt(0).toUpperCase()}${source.role.slice(1)}`,+ t(m.accessSource, {+ role: t(accessRoles[source.role]),+ source: t(sourceLabel),+ }),);}}@@ -933,11 +960,12 @@ function SharedMoveDialog({}: {folders: SharedFolder[];items: TeamHubDocumentPlacementNode[];- label: string;+ label: string | undefined;node: TeamHubDocumentPlacementNode;onCancel: () => void;onMove: (parentId: string) => void;}) {+ const t = useT();const invalid = new Set<string>(node.node_kind === "folder"? [node.id, ...descendants(node.id, items)]@@ -951,7 +979,7 @@ function SharedMoveDialog({label={label}onCancel={onCancel}onMove={onMove}- rootLabel="Shared with me"+ rootLabel={t(m.sharedWithMe)}/>);}@@ -974,12 +1002,14 @@ function hasDragType(transfer: DataTransfer, type: string) {return Array.from(transfer.types).includes(type);}-function nextSharedFolderName(folders: SharedFolder[]) {+/** The name a new shared folder starts with, in the language on screen. */+function nextSharedFolderName(folders: SharedFolder[], t: Translate) {const names = new Set(folders.map((folder) => folder.name));- if (!names.has("New Folder")) return "New Folder";- let suffix = 2;- while (names.has(`New Folder ${suffix}`)) suffix += 1;- return `New Folder ${suffix}`;+ const name = t(m.defaultFolderName);+ if (!names.has(name)) return name;+ let index = 2;+ while (names.has(t(m.defaultFolderNameNumbered, { index }))) index += 1;+ return t(m.defaultFolderNameNumbered, { index });}function compareSharedTreeItems(diff --git a/apps/web/src/features/library/use-document-rename.tsx b/apps/web/src/features/library/use-document-rename.tsxindex 2705a3d7..db8d3616 100644--- a/apps/web/src/features/library/use-document-rename.tsx+++ b/apps/web/src/features/library/use-document-rename.tsx@@ -9,6 +9,10 @@ import { teamHubData } from "@/features/teamhub/teamhub-api";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";import type { TeamHubDocumentTreeSummary } from "@/features/teamhub/teamhub-types";import { documentQueryKey } from "@/features/rooms/room-queries";+import { commonMessages } from "@/i18n/common.messages";+import { useT } from "@/i18n/use-translation";++import { libraryMessages as m } from "./library.messages";export function canRenameDocument(document: TeamHubDocumentTreeSummary) {if (document.status !== "active") return false;@@ -21,6 +25,7 @@ export function useDocumentRename(tenantId: string) {const { client } = useTeamHubRuntime();const queryClient = useQueryClient();const navigate = useNavigate();+ const t = useT();const [document, setDocument] = useState<TeamHubDocumentTreeSummary | null>(null,);@@ -74,11 +79,7 @@ export function useDocumentRename(tenantId: string) {]);setDocument(null);} catch (cause) {- setError(- cause instanceof Error- ? cause.message- : "The file could not be renamed.",- );+ setError(cause instanceof Error ? cause.message : t(m.fileNotRenamed));} finally {setPending(false);}@@ -91,7 +92,7 @@ export function useDocumentRename(tenantId: string) {if (!pending) setDocument(null);}}size="sm"- title="Rename file"+ title={t(m.renameFile)}footer={<><Button@@ -100,7 +101,7 @@ export function useDocumentRename(tenantId: string) {tone="secondary"type="button">- Cancel+ {t(commonMessages.cancel)}</Button><Buttondisabled={!name.trim()}@@ -109,7 +110,7 @@ export function useDocumentRename(tenantId: string) {tone="primary"type="submit">- Rename+ {t(m.rename)}</Button></>}@@ -123,7 +124,7 @@ export function useDocumentRename(tenantId: string) {}}><label className="block text-sm font-medium text-app-body">- File name+ {t(m.fileName)}<input// eslint-disable-next-line jsx-a11y/no-autofocus -- the field is focused on purpose because the user just opened this dialog or inline editorautoFocusdiff --git a/apps/web/src/features/library/use-my-documents-document-actions.ts b/apps/web/src/features/library/use-my-documents-document-actions.tsindex f8133e04..dee8999e 100644--- a/apps/web/src/features/library/use-my-documents-document-actions.ts+++ b/apps/web/src/features/library/use-my-documents-document-actions.ts@@ -11,9 +11,11 @@ import type {TeamHubDocumentPlacementNode,TeamHubDocumentTreeSummary,} from "@/features/teamhub/teamhub-types";+import { useT } from "@/i18n/use-translation";import { documentFileName } from "./document-display-name";import { documentAfterRemoval } from "./document-tree-order";+import { libraryMessages as m } from "./library.messages";import {myDocumentTreeQueryKey,updateMyDocumentTreeCache,@@ -38,6 +40,7 @@ export function useMyDocumentsDocumentActions({const { client } = useTeamHubRuntime();const queryClient = useQueryClient();const navigate = useNavigate();+ const t = useT();const [trashingDocument, setTrashingDocument] =useState<TeamHubDocumentTreeSummary | null>(null);const [trashPending, setTrashPending] = useState(false);@@ -81,7 +84,7 @@ export function useMyDocumentsDocumentActions({setError(duplicateError instanceof Error? duplicateError.message- : "The document could not be duplicated.",+ : t(m.documentNotDuplicated),);}}@@ -101,7 +104,7 @@ export function useMyDocumentsDocumentActions({setError(exportError instanceof Error? exportError.message- : "The document could not be exported.",+ : t(m.documentNotExported),);}}@@ -152,7 +155,7 @@ export function useMyDocumentsDocumentActions({setError(trashError instanceof Error? trashError.message- : "The document could not be moved to trash.",+ : t(m.documentNotTrashed),);} finally {setTrashPending(false);diff --git a/apps/web/src/features/library/use-my-documents-folder-edits.ts b/apps/web/src/features/library/use-my-documents-folder-edits.tsindex 74db5305..093e1870 100644--- a/apps/web/src/features/library/use-my-documents-folder-edits.ts+++ b/apps/web/src/features/library/use-my-documents-folder-edits.ts@@ -4,6 +4,9 @@ import { useState } from "react";import { teamHubData, teamHubDone } from "@/features/teamhub/teamhub-api";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";import type { TeamHubDocumentPlacementNode } from "@/features/teamhub/teamhub-types";+import { useT } from "@/i18n/use-translation";++import { libraryMessages as m } from "./library.messages";import {myDocumentTreeQueryKey,@@ -24,6 +27,7 @@ export function useMyDocumentsFolderEdits({}: MyDocumentsFolderEditsInput) {const { client } = useTeamHubRuntime();const queryClient = useQueryClient();+ const t = useT();const [renamingFolder, setRenamingFolder] = useState<{id: string;name: string;@@ -69,9 +73,7 @@ export function useMyDocumentsFolderEdits({} catch (moveError) {rollback();setError(- moveError instanceof Error- ? moveError.message- : "The document could not be moved.",+ moveError instanceof Error ? moveError.message : t(m.documentNotMoved),);}}@@ -110,7 +112,7 @@ export function useMyDocumentsFolderEdits({setError(renameError instanceof Error? renameError.message- : "The folder could not be renamed.",+ : t(m.folderNotRenamed),);}}@@ -137,7 +139,7 @@ export function useMyDocumentsFolderEdits({setError(deleteError instanceof Error? deleteError.message- : "The folder could not be deleted.",+ : t(m.folderNotDeleted),);} finally {setDeletingFolderId(null);diff --git a/apps/web/src/features/library/use-my-documents-tree-create.ts b/apps/web/src/features/library/use-my-documents-tree-create.tsindex 7da0ec48..a2325c8a 100644--- a/apps/web/src/features/library/use-my-documents-tree-create.ts+++ b/apps/web/src/features/library/use-my-documents-tree-create.ts@@ -6,7 +6,9 @@ import { documentQueryKey } from "@/features/rooms/room-queries";import { teamHubData } from "@/features/teamhub/teamhub-api";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";import type { TeamHubDocumentPlacementNode } from "@/features/teamhub/teamhub-types";+import { useT } from "@/i18n/use-translation";+import { libraryMessages as m } from "./library.messages";import { nextFolderName } from "./my-documents-tree-helpers";export type MyDocumentsCreating = "document" | "folder" | "import" | null;@@ -34,6 +36,7 @@ export function useMyDocumentsTreeCreate({const { client } = useTeamHubRuntime();const queryClient = useQueryClient();const navigate = useNavigate();+ const t = useT();const importRef = useRef<HTMLInputElement>(null);const importTargetRef = useRef<string | undefined>(undefined);const [creating, setCreating] = useState<MyDocumentsCreating>(null);@@ -47,7 +50,7 @@ export function useMyDocumentsTreeCreate({client.api.POST("/v0/tenants/{tenantId}/me/document-folders", {params: { path: { tenantId } },body: {- name: nextFolderName(items, parentId),+ name: nextFolderName(items, parentId, t),...(parentId ? { parent_id: parentId } : {}),},}),@@ -60,7 +63,7 @@ export function useMyDocumentsTreeCreate({setError(createError instanceof Error? createError.message- : "The folder could not be created.",+ : t(m.folderNotCreated),);} finally {setCreating(null);@@ -102,7 +105,7 @@ export function useMyDocumentsTreeCreate({setError(createError instanceof Error? createError.message- : "The document could not be created.",+ : t(m.documentNotCreated),);} finally {setCreating(null);diff --git a/apps/web/src/features/library/use-my-documents-uploads.ts b/apps/web/src/features/library/use-my-documents-uploads.tsindex 86b15b34..cab5d07a 100644--- a/apps/web/src/features/library/use-my-documents-uploads.ts+++ b/apps/web/src/features/library/use-my-documents-uploads.ts@@ -9,8 +9,10 @@ import {import { teamHubData } from "@/features/teamhub/teamhub-api";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";import type { TeamHubDocumentPlacementNode } from "@/features/teamhub/teamhub-types";+import { useT } from "@/i18n/use-translation";import { documentUploadRepresentationFormat } from "./document-upload-representation";+import { libraryMessages as m } from "./library.messages";import {fileUploadBatch,tenantUploads,@@ -26,7 +28,7 @@ import {nextAvailableUploadFilename,nextPaint,runSequentially,- uploadFailureMessage,+ uploadErrorText,usedDocumentFilenames,} from "./my-documents-tree-helpers";import type { MyDocumentsCreating } from "./use-my-documents-tree-create";@@ -63,13 +65,14 @@ export function useMyDocumentsUploads({}: MyDocumentsUploadsInput) {const { client } = useTeamHubRuntime();const navigate = useNavigate();+ const t = useT();const [revealDocumentId, setRevealDocumentId] = useState<string | null>(null);const [externalDrop, setExternalDrop] = useState<ExternalDocumentDrop | null>(null,);const {active: uploadsActive,- error: uploadError,+ error: keptUploadError,uploads: pendingUploads,} = useTenantUploads(tenantId);// An upload outlives this view; it must not navigate a reader who moved on.@@ -101,10 +104,7 @@ export function useMyDocumentsUploads({setExternalDrop(null);if (creating) return;if (uploadsActive) {- tenantUploads.setError(- tenantId,- "Wait for the current upload to finish before adding more files.",- );+ tenantUploads.setError(tenantId, m.uploadBusy);return;}setError(null);@@ -117,8 +117,8 @@ export function useMyDocumentsUploads({tenantUploads.setError(tenantId,batch.readFailures.length > 0- ? uploadFailureMessage(batch.readFailures)- : "No supported files were found in the drop.",+ ? { failures: batch.readFailures }+ : m.noSupportedFiles,);return;}@@ -145,7 +145,11 @@ export function useMyDocumentsUploads({try {const key = folderKey(folderPath);if (!folderIds.has(key)) {- throw new Error("Its folder could not be created.");+ failures.push({+ filename: upload.filename,+ message: m.uploadFolderMissing,+ });+ return;}const targetId = folderIds.get(key);const document = await client.uploadPersonalWikiDocument(@@ -171,7 +175,7 @@ export function useMyDocumentsUploads({message:uploadError instanceof Error? uploadError.message- : "The document could not be imported.",+ : m.documentNotImported,});} finally {tenantUploads.remove(tenantId, new Set([upload.id]));@@ -179,7 +183,7 @@ export function useMyDocumentsUploads({},);if (failures.length > 0) {- tenantUploads.setError(tenantId, uploadFailureMessage(failures));+ tenantUploads.setError(tenantId, { failures });} else if (openUploadedDocument &&uploadedDocumentId &&@@ -194,7 +198,7 @@ export function useMyDocumentsUploads({tenantId,importError instanceof Error? importError.message- : "The document could not be imported.",+ : m.documentNotImported,);} finally {tenantUploads.remove(@@ -225,7 +229,8 @@ export function useMyDocumentsUploads({pendingUploads,revealDocumentId,setExternalDrop,- uploadError,+ // Worded here, so a kept error follows the language on screen.+ uploadError: keptUploadError ? uploadErrorText(keptUploadError, t) : null,uploadsActive,};}@@ -330,7 +335,7 @@ async function createUploadFolders(message:createError instanceof Error? createError.message- : "The folder could not be created.",+ : m.folderNotCreated,});}});diff --git a/apps/web/src/i18n/locales/zh-CN.glossary.md b/apps/web/src/i18n/locales/zh-CN.glossary.mdindex 88dc75c6..903aa35e 100644--- a/apps/web/src/i18n/locales/zh-CN.glossary.md+++ b/apps/web/src/i18n/locales/zh-CN.glossary.md@@ -137,6 +137,16 @@ elsewhere.| Official template | 官方模板 | || Docs | 文档 | The short form of Documents in search. || Search scope | 搜索范围 | Messages, Members, Docs or Rooms. |+| Folder | 文件夹 | |+| Upload / Import | 上传 / 导入 | |+| Rename | 重命名 | |+| Move (a file or folder) | 移动 | |+| Duplicate | 创建副本 | A copy beside the original. |+| Owned by Me / My Documents | 我的页面 | Older names of My pages. |+| Viewer / Editor / Manager | 查看者 / 编辑者 / 管理者 | Roles on a shared Document. |+| Expand / Collapse | 展开 / 收起 | Never `关闭` for folding a tree. |+| Trash | 回收站 | |+| Archives (file type) | 压缩包 | Compressed files; `归档` is the archive action. |## Stylediff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.jsonindex 10cf7771..06494883 100644--- a/apps/web/src/i18n/locales/zh-CN.json+++ b/apps/web/src/i18n/locales/zh-CN.json@@ -1710,5 +1710,149 @@"legendScope": "按类型搜索","openFailed": "无法打开这个对话。","openFailedUnknown": "无法打开对话。"+ },+ "library": {+ "title": "资料库",+ "libraryViews": "资料库视图",+ "myPages": "我的页面",+ "sharedWithMe": "与我共享",+ "meetings": "会议",+ "ownedEmpty": "你还没有创建文档",+ "sharedEmpty": "还没有与你共享的文档",+ "newMenu": "新建",+ "newFile": "新建文件",+ "newFolder": "新建文件夹",+ "importFile": "导入",+ "uploadFolder": "上传文件夹",+ "createInMyPages": "在“我的页面”中新建",+ "releaseToUploadTo": "松开即可上传到“{folder}”",+ "loadingHistory": "正在加载历史记录…",+ "recent": "最近",+ "loadingDocuments": "正在加载文档…",+ "recentUnavailable": "最近的文档不可用。",+ "noRecent": "最近没有更新过的文档",+ "listUnavailable": "文档列表不可用。",+ "viewDocuments": "“{view}”中的文档",+ "actionsFor": "{name} 的操作",+ "visibleIn": "可见于 {places}",+ "noLinkedContext": "未关联上下文",+ "uploadQueued": "{filename} 等待上传",+ "uploadUploading": "{filename} 正在上传",+ "fileType": "文件类型",+ "typeAll": "全部类型",+ "typeMarkdown": "Markdown",+ "typePdf": "PDF",+ "typeWord": "Word",+ "typeSpreadsheet": "表格(Excel / CSV)",+ "typePresentation": "PowerPoint",+ "typeHtml": "HTML",+ "typeText": "纯文本",+ "typeImage": "图片",+ "typeAudio": "音频",+ "typeVideo": "视频",+ "typeArchive": "压缩包",+ "typeCode": "代码",+ "typeOthers": "其他",+ "sortDocuments": "文档排序",+ "sortByModified": "按最后修改时间排序",+ "sortByName": "按名称排序",+ "dismiss": "关闭",+ "folderEmpty": "这个文件夹是空的",+ "folderPath": "文件夹路径",+ "openFolder": "打开文件夹 {name}",+ "folder": "文件夹",+ "uploadProgress": "上传进度",+ "uploadingFile": "正在上传 {filename}",+ "preparingUpload": "正在准备上传…",+ "filesLeft": { "other": "还剩 {count} 个文件" },+ "currentFileUpload": "当前文件的上传进度",+ "uploadBusy": "请等当前上传完成后再添加文件。",+ "noSupportedFiles": "拖入的内容里没有支持的文件。",+ "uploadFolderMissing": "无法创建它所在的文件夹。",+ "entryNotRead": "无法读取。",+ "documentNotImported": "无法导入文档。",+ "uploadFailure": "{filename}:{message}",+ "uploadFailures": {+ "other": "{count} 个文件未能上传({names})。{message}"+ },+ "uploadFailuresMore": {+ "other": "{count} 个文件未能上传({names},以及另外 {more} 个)。{message}"+ },+ "librarySidebar": "资料库侧边栏",+ "wikiSidebar": "Wiki 侧边栏",+ "resizeLibrarySidebar": "调整资料库侧边栏宽度",+ "resizeWikiSidebar": "调整 Wiki 侧边栏宽度",+ "backToLibrary": "返回资料库",+ "closeOwnedByMe": "关闭我的页面",+ "ownedByMe": "我的页面",+ "ownedTree": "我的页面目录树",+ "expandOwned": "展开我的页面",+ "collapseOwned": "收起我的页面",+ "createInOwned": "在“我的页面”中新建",+ "treeUnavailable": "文档目录树不可用。",+ "loadingTree": "正在加载目录树…",+ "noDocumentsYet": "还没有文档。",+ "renameFolder": "重命名文件夹",+ "rename": "重命名",+ "move": "移动",+ "copyLink": "复制链接",+ "download": "下载",+ "duplicate": "创建副本",+ "defaultFolderName": "新建文件夹",+ "defaultFolderNameNumbered": "新建文件夹 {index}",+ "sharedTree": "与我共享目录树",+ "expandShared": "展开与我共享",+ "collapseShared": "收起与我共享",+ "organizeShared": "整理“与我共享”",+ "sharedUnavailable": "“与我共享”不可用。",+ "renameSharedFolder": "重命名共享文件夹",+ "actionsForSharedFolder": "共享文件夹 {name} 的操作",+ "actionsForSharedDocument": "共享文档 {name} 的操作",+ "accessSource": "{source}({role})",+ "sourceDirect": "直接共享",+ "sourceRoom": "Room 上下文",+ "sourceTask": "任务上下文",+ "sourceWiki": "Wiki 上下文",+ "sourceLink": "链接共享",+ "sourceOwner": "所有者",+ "roleViewer": "查看者",+ "roleEditor": "编辑者",+ "roleManager": "管理者",+ "roleOwner": "所有者",+ "folderNotCreated": "无法创建文件夹。",+ "folderNotRenamed": "无法重命名文件夹。",+ "folderNotDeleted": "无法删除文件夹。",+ "documentNotCreated": "无法创建文档。",+ "documentNotDuplicated": "无法创建文档副本。",+ "documentNotExported": "无法导出文档。",+ "documentNotMoved": "无法移动文档。",+ "documentNotTrashed": "无法将文档移到回收站。",+ "documentNotDeleted": "无法删除文档。",+ "itemNotMoved": "无法移动这一项。",+ "fileNotRenamed": "无法重命名文件。",+ "documentNotCopied": "无法复制文档。",+ "create": "创建",+ "folderName": "文件夹名称",+ "renameFile": "重命名文件",+ "fileName": "文件名",+ "deleteDocumentTitle": "删除文档?",+ "deleteDocumentBody": "{title} 将从所有 Room 和共享位置中删除,目前无法在产品内恢复。",+ "copyToMyDocuments": "复制到我的页面",+ "destination": "目标位置",+ "copyDestination": "复制的目标位置",+ "myDocuments": "我的页面",+ "moveTo": "将 {name} 移动到…",+ "moveDocumentTo": "将文档移动到…",+ "moveHere": "移动到这里",+ "searchFolders": "搜索文件夹",+ "searchFoldersPlaceholder": "搜索文件夹…",+ "clearFolderSearch": "清除文件夹搜索",+ "moveDestinationFolders": "可移动到的文件夹",+ "expandFolder": "展开 {name}",+ "collapseFolder": "收起 {name}",+ "selectFolder": "选择 {name}",+ "current": "当前位置",+ "noFoldersFound": "没有找到文件夹。",+ "folderSearchResults": "文件夹搜索结果"}}