#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Translate hardcoded service and error messages (#8284)
Anthony Stirlingad3541d930b6
diff --git a/frontend/editor/public/locales/en-US/translation.toml b/frontend/editor/public/locales/en-US/translation.tomlindex 4adf56ade1..d12bd5b757 100644--- a/frontend/editor/public/locales/en-US/translation.toml+++ b/frontend/editor/public/locales/en-US/translation.toml@@ -2476,8 +2476,17 @@ checking = "Checking backend status..."offline = "Backend Offline"online = "Backend Online"starting = "Backend starting up..."+unavailable = "Backend is unavailable"wait = "Please wait for the backend to finish launching and try again."+[backendHealth.restart]+attempting = "Attempting to restart... ({{attempt}}/{{max}})"+failedBody = "The local backend could not be recovered. Please restart the app."+failedTitle = "Backend failed to restart"+stoppedTitle = "Backend stopped unexpectedly"+successBody = "The local backend is back online."+successTitle = "Backend restarted"+[backendStartup]notFoundTitle = "Backend not found"retry = "Retry"@@ -4288,6 +4297,14 @@ title = "Settings Opened"message = "Stirling PDF is now your default PDF editor"title = "Default App Set"+[desktop.fileSave]+saveFilesTitle_one = "Save {{count}} file"+saveFilesTitle_other = "Save {{count}} files"++[desktop.saasError]+body = "This tool requires cloud processing but encountered an error: {{error}}. Please check your connection and try again."+title = "Cloud Processing Failed"+[desktop.titleBar]maximize = "Maximize"minimize = "Minimize"@@ -4485,7 +4502,37 @@ title = "Endpoint Statistics"[error]_value = "Error"dismissAllErrors = "Dismiss All Errors"+failedFiles = "Failed files: {{ids}}"generic = "An error occurred"+invalidOrCorruptedFiles = "Process failed due to invalid/corrupted file(s)"+networkError = "Network error"+requestError = "Request error"+requestFailed = "Request failed"+requestFallback = "There was an error processing your request."+serverError = "Server error"+unknown = "Unknown error occurred"++[error.pdfOpen]+code = "Could not open the PDF (error {{code}})."+corrupted = "The PDF file is corrupted and could not be read."+invalid = "This file is not a valid PDF or is corrupted."+pageLoadFailed = "A page in this PDF could not be loaded."+passwordProtected = "This PDF is password-protected."+unknown = "Could not open the PDF (unknown error)."+unsupportedSecurity = "This PDF uses an unsupported security scheme."++[error.processing]+cancelled = "Processing was cancelled by user."+corruption = "This PDF file appears to be corrupted or encrypted. Please try a different file."+failed = "Processing failed: {{message}}"+memory = "Insufficient memory to process this file. Try closing other applications or processing a smaller file."+network = "Network connection failed. Please check your internet connection and try again."+parsing = "Failed to process PDF: {{message}}"+timeout = "Processing timed out. This file may be too large or complex to process."++[errorBoundary]+title = "Something went wrong"+tryAgain = "Try Again"[extractImages]allowDuplicates = "Save duplicate images"@@ -4905,21 +4952,31 @@ addFolderFailed = "Could not add the folder."addFolderFailedDetail = "Could not add the folder: {{message}}"cloudDeleteFailed_one = "Couldn't delete 1 file from the cloud."cloudDeleteFailed_other = "Couldn't delete {{count}} files from the cloud."+createOutsideMount = "Cannot create a folder outside a mounted directory"deleteFolderFailed = "Could not delete folder."deleteFolderFailedDetail = "Could not delete folder: {{message}}"+diskFoldersUnsupported = "This build cannot create folders on disk"downloadFailed = "Could not download the file."duplicateFailed = "Could not duplicate the file."folderAppearanceFailed = "Could not update folder appearance."folderAppearanceFailedDetail = "Could not update folder appearance: {{message}}"+folderDetachFailed = "Folder was deleted, but some files couldn't be detached locally. Refresh to fix."+folderOperationFailed = "Folder operation failed"+folderSyncFailed = "Folder sync failed: {{message}}"+loadFilesFailed = "Failed to load files"+moveAcrossKinds = "Folders can only move within their own kind"moveFilesFailed = "Could not move files."moveFilesFailedDetail = "Could not move files: {{message}}"moveFolderFailed = "Could not move folder."moveFolderFailedDetail = "Could not move folder: {{message}}"+moveLocalFolder = "A local folder sits where its directory sits"openDiskFileFailed = "Could not open {{name}}."openDiskFileFailedDetail = "Could not open {{name}}: {{message}}"processingStatusUnavailable = "Could not refresh processing status. File locks have been released until the connection recovers."readFolderFailed = "Could not read the folder."readFolderFailedDetail = "Could not read the folder: {{message}}"+recolourLocalFolder = "Local folders cannot be recoloured yet"+removeDiskSubfolder = "Subfolders of a mounted directory are removed on disk"removeFilesFailed = "Could not remove files."removeFilesFailedDetail = "Could not remove files: {{message}}"removeFolderFailed = "Could not remove folder."@@ -5051,6 +5108,22 @@ grid = "Grid view"label = "View mode"list = "List view"+[fileStorage.unreadable]+body = "\"{{name}}\" is saved in this browser but its contents can no longer be read. Upload the file again to keep working on it."+title = "File data is unavailable"++[fileSync.openFailed]+multiple_one = "Couldn't open {{count}} file including \"{{name}}\"."+multiple_other = "Couldn't open {{count}} files including \"{{name}}\"."+single = "Couldn't open \"{{name}}\"."+singleWithStatus = "Couldn't open \"{{name}}\" (HTTP {{status}})."+title = "Some files couldn't be opened"++[fileSync.pullFailed]+body = "Showing only files cached in this browser. Refresh to retry once the connection is back."+signInTitle = "Sign-in required to load cloud files"+unreachableTitle = "Could not reach the cloud library"+[fileToPDF]tags = "transformation,format,document,picture,slide,text,conversion,office,docs,word,excel,powerpoint"title = "File to PDF"@@ -5058,6 +5131,7 @@ title = "File to PDF"[fileUpload]dropFilesHere = "Drop files here or click the upload button"dropFilesHereOpen = "Drop files here or click the open button"+droppedFileUnreadable = "Could not read a dropped file."filesAvailableCount_one = "{{count}} file available"filesAvailableCount_other = "{{count}} files available"loadFromStorage = "Load from Storage"@@ -5089,6 +5163,7 @@ passwordMustBeDifferent = "New password must be different from current password"passwordsDoNotMatch = "New passwords do not match"passwordTooShort = "Password must be at least 8 characters"reEnterNewPassword = "Re-enter new password"+setPasswordTitle = "Set Your Password"title = "First Time Login"welcomeMessage = "For security reasons, you must change your password on your first login."welcomeTitle = "Welcome!"@@ -5927,6 +6002,7 @@ signin = "Sign in"signingIn = "Signing in..."signInWith = "Sign in with"signInWithProvider = "Sign in with {{provider}}"+ssoRedirectFailed = "SSO redirect failed"title = "Sign in"unexpectedError = "Unexpected error: {{message}}"updatePassword = "Update password"@@ -6524,6 +6600,32 @@ rotateLeft = "Rotate Left"rotateRight = "Rotate Right"splitAfter = "Split After"+[pageEditor.commands]+addSplitAt = "Add split at position {{position}}"+addSplits_one = "Add {{count}} split"+addSplits_other = "Add {{count}} splits"+deletePages_one = "Delete {{count}} page"+deletePages_other = "Delete {{count}} pages"+insertFiles_one = "Insert {{count}} file after page {{page}}"+insertFiles_other = "Insert {{count}} files after page {{page}}"+insertPageBreaks_one = "Insert {{count}} page break"+insertPageBreaks_other = "Insert {{count}} page breaks"+insertPageBreaksAll = "Insert page breaks after all pages"+removeAllSplits = "Remove all splits"+removeSplitAt = "Remove split at position {{position}}"+removeSplits_one = "Remove {{count}} split"+removeSplits_other = "Remove {{count}} splits"+reorderPages = "Reorder pages"+rotatePageLeft = "Rotate page left"+rotatePageRight = "Rotate page right"+rotatePagesLeft_one = "Rotate {{count}} page left"+rotatePagesLeft_other = "Rotate {{count}} pages left"+rotatePagesRight_one = "Rotate {{count}} page right"+rotatePagesRight_other = "Rotate {{count}} pages right"+splitAllPages = "Split all pages"+toggleSplits_one = "Toggle {{count}} split position"+toggleSplits_other = "Toggle {{count}} split positions"+[pageEditor.emptyState]body = "Add files to start editing pages"title = "No PDF files loaded"@@ -6933,6 +7035,7 @@ thisPeriod = "This billing period"billingPeriod = "Billing period"cancelTeamChange = "Keep current plan"canCloseWindow = "You can now close this window."+createSessionFailed = "Failed to create checkout session"error = "Payment Error"generatingLicense = "Generating your license key..."licenseActivated = "License activated! Your license key has been saved. A confirmation email has been sent to your registered email address."@@ -6948,6 +7051,7 @@ monthly = "Monthly"paymentCanceled = "Payment was canceled. No charges were made."perMonth = "/month"perUserBlock = "per 100 users"+planPeriodUnavailable = "Selected plan period is not available"preparing = "Preparing your checkout..."redirecting = "Redirecting to secure checkout..."success = "Payment Successful!"@@ -7097,6 +7201,16 @@ freetext = "Annotation text - not page text, so it can't be edited here"stamp = "Stamp annotation - not page text, so it can't be edited here"widget = "Form field - not page text, so it can't be edited here"+[pdfTextEditor.commands]+edit = "Edit"+mergeRuns_one = "Merge {{count}} run into a paragraph"+mergeRuns_other = "Merge {{count}} runs into a paragraph"+setColour = "Set colour on {{run}}"+setOutline = "Set outline on {{run}}"+typeInto = "Type into {{run}}"+ungroupParagraph = "Ungroup paragraph {{run}}"+wrap = "Wrap {{run}}"+[pdfTextEditor.discard]body = "Opening {{name}} closes the document you are editing. Your unsaved changes will be lost."cancel = "Cancel"@@ -7112,6 +7226,9 @@ title = "Drop a PDF to open"decodeImage = "Could not decode the selected image."insertImage = "Could not insert the selected image."+[pdfTextEditor.externalEdit]+pngFileType = "PNG image"+[pdfTextEditor.find]close = "Close find bar"count = "{{current}} of {{total}}"@@ -11944,11 +12061,18 @@ useLast = "Last used server: {{serverUrl}}"[setup.server.error]configFetch = "Failed to fetch server configuration (status {{status}})"configFetchError = "Failed to fetch server configuration: {{error}}"+dnsFailed = "Cannot resolve hostname: {{hostname}}"emptyUrl = "Please enter a server URL"+httpOnly = "Server is only accessible via HTTP (not HTTPS)."+httpsOnly = "Server is only accessible via HTTPS, not HTTP."invalidUrl = "Invalid URL format. Please enter a valid URL like https://your-server.com"+methodMismatch = "Server responds to HEAD requests but not GET requests."+networkBlocked = "No internet connectivity detected. All network requests are failing."+serverUnreachable = "Cannot connect to server. Internet works but this specific server is unreachable."testFailed = "Connection test failed"unknown = "Unknown error"unreachable = "Could not connect to server"+userAgentBlocked = "Server blocks Tauri/desktop app User-Agent but allows browser User-Agent."[setup.server.error.securityDisabled]body = "This server does not have login enabled. To connect to this server, you must enable authentication:"@@ -13296,6 +13420,12 @@ renderMarkdown = "Render markdown"sortedBy = "Sorted by: {{column}}"textStats = "{{lines}} lines · {{size}}"+[viewer.nonPdf.fileType]+file = "File"+image = "Image"+spreadsheet = "Spreadsheet"+text = "Text"+[viewer.portfolio]addFile = "Add file"count_one = "{{count}} file in this portfolio"diff --git a/frontend/editor/src/core/components/onboarding/slides/FirstLoginSlide.tsx b/frontend/editor/src/core/components/onboarding/slides/FirstLoginSlide.tsxindex ec7768a11e..51c987991e 100644--- a/frontend/editor/src/core/components/onboarding/slides/FirstLoginSlide.tsx+++ b/frontend/editor/src/core/components/onboarding/slides/FirstLoginSlide.tsx@@ -2,6 +2,7 @@ import React, { useState } from "react";import { Stack, PasswordInput, Alert, Text } from "@mantine/core";import { Button } from "@app/ui/Button";import { useTranslation } from "react-i18next";+import i18n from "i18next";import { SlideConfig } from "@app/types/types";import { Icon } from "@app/ui/Icon";import { UNIFIED_CIRCLE_CONFIG } from "@app/components/onboarding/slides/unifiedBackgroundConfig";@@ -225,7 +226,7 @@ export default function FirstLoginSlide({}: FirstLoginSlideProps): SlideConfig {return {key: "first-login",- title: "Set Your Password",+ title: i18n.t("firstLogin.setPasswordTitle", "Set Your Password"),body: (<FirstLoginFormusername={username}diff --git a/frontend/editor/src/core/components/pageEditor/commands/pageCommands.ts b/frontend/editor/src/core/components/pageEditor/commands/pageCommands.tsindex 2ce10b929c..69f1f83c3d 100644--- a/frontend/editor/src/core/components/pageEditor/commands/pageCommands.ts+++ b/frontend/editor/src/core/components/pageEditor/commands/pageCommands.ts@@ -1,3 +1,4 @@+import i18n from "i18next";import { FileId } from "@app/types/file";import { PDFDocument, PDFPage, PageBreakSettings } from "@app/types/pageEditor";@@ -73,7 +74,10 @@ export class RotatePageCommand extends DOMCommand {}get description(): string {- return `Rotate page ${this.degrees > 0 ? "right" : "left"}`;+ if (this.degrees > 0) {+ return i18n.t("pageEditor.commands.rotatePageRight", "Rotate page right");+ }+ return i18n.t("pageEditor.commands.rotatePageLeft", "Rotate page left");}}@@ -201,7 +205,9 @@ export class DeletePagesCommand extends DOMCommand {}get description(): string {- return `Delete ${this.pagesToDelete.length} page(s)`;+ return i18n.t("pageEditor.commands.deletePages", "Delete {{count}} pages", {+ count: this.pagesToDelete.length,+ });}}@@ -300,7 +306,7 @@ export class ReorderPagesCommand extends DOMCommand {}get description(): string {- return `Reorder page(s)`;+ return i18n.t("pageEditor.commands.reorderPages", "Reorder pages");}}@@ -341,7 +347,18 @@ export class SplitCommand extends DOMCommand {get description(): string {const currentPositions = this.getSplitPositions();const willAdd = !currentPositions.has(this.pageId);- return `${willAdd ? "Add" : "Remove"} split at position ${this.pageNumber}`;+ if (willAdd) {+ return i18n.t(+ "pageEditor.commands.addSplitAt",+ "Add split at position {{position}}",+ { position: this.pageNumber },+ );+ }+ return i18n.t(+ "pageEditor.commands.removeSplitAt",+ "Remove split at position {{position}}",+ { position: this.pageNumber },+ );}}@@ -424,7 +441,19 @@ export class BulkRotateCommand extends DOMCommand {}get description(): string {- return `Rotate ${this.pageIds.length} page(s) ${this.degrees > 0 ? "right" : "left"}`;+ const count = this.pageIds.length;+ if (this.degrees > 0) {+ return i18n.t(+ "pageEditor.commands.rotatePagesRight",+ "Rotate {{count}} pages right",+ { count },+ );+ }+ return i18n.t(+ "pageEditor.commands.rotatePagesLeft",+ "Rotate {{count}} pages left",+ { count },+ );}}@@ -464,7 +493,11 @@ export class BulkSplitCommand extends DOMCommand {}get description(): string {- return `Toggle ${this.positions.length} split position(s)`;+ return i18n.t(+ "pageEditor.commands.toggleSplits",+ "Toggle {{count}} split positions",+ { count: this.positions.length },+ );}}@@ -513,7 +546,10 @@ export class SplitAllCommand extends DOMCommand {const hasAllSplits = Array.from(this.allPossibleSplits).every((pos) =>currentSplits.has(pos),);- return hasAllSplits ? "Remove all splits" : "Split all pages";+ if (hasAllSplits) {+ return i18n.t("pageEditor.commands.removeAllSplits", "Remove all splits");+ }+ return i18n.t("pageEditor.commands.splitAllPages", "Split all pages");}}@@ -588,7 +624,11 @@ export class PageBreakCommand extends DOMCommand {}get description(): string {- return `Insert ${this.selectedPageNumbers.length} page break(s)`;+ return i18n.t(+ "pageEditor.commands.insertPageBreaks",+ "Insert {{count}} page breaks",+ { count: this.selectedPageNumbers.length },+ );}}@@ -678,7 +718,10 @@ export class BulkPageBreakCommand extends DOMCommand {}get description(): string {- return `Insert page breaks after all pages`;+ return i18n.t(+ "pageEditor.commands.insertPageBreaksAll",+ "Insert page breaks after all pages",+ );}}@@ -994,7 +1037,11 @@ export class InsertFilesCommand extends DOMCommand {}get description(): string {- return `Insert ${this.files.length} file(s) after page ${this.insertAfterPageNumber}`;+ return i18n.t(+ "pageEditor.commands.insertFiles",+ "Insert {{count}} files after page {{page}}",+ { count: this.files.length, page: this.insertAfterPageNumber },+ );}}diff --git a/frontend/editor/src/core/components/pageEditor/hooks/useEditorCommands.ts b/frontend/editor/src/core/components/pageEditor/hooks/useEditorCommands.tsindex aca8390d64..72ee6c689f 100644--- a/frontend/editor/src/core/components/pageEditor/hooks/useEditorCommands.ts+++ b/frontend/editor/src/core/components/pageEditor/hooks/useEditorCommands.ts@@ -1,4 +1,5 @@import { useCallback, useEffect, useRef } from "react";+import i18n from "i18next";import {BulkRotateCommand,@@ -249,8 +250,16 @@ export const usePageEditorCommands = ({execute: () => setSplitPositions(newSplitPositions),undo: () => setSplitPositions(splitPositions),description: shouldRemoveSplits- ? `Remove ${selectedSplitPageIds.length} split(s)`- : `Add ${selectedSplitPageIds.length - existingSplitsCount} split(s)`,+ ? i18n.t(+ "pageEditor.commands.removeSplits",+ "Remove {{count}} splits",+ {+ count: selectedSplitPageIds.length,+ },+ )+ : i18n.t("pageEditor.commands.addSplits", "Add {{count}} splits", {+ count: noSplitsCount,+ }),};executeCommandWithTracking(smartSplitCommand);diff --git a/frontend/editor/src/core/components/shared/ErrorBoundary.tsx b/frontend/editor/src/core/components/shared/ErrorBoundary.tsxindex 1ca3659894..9fbd8e2df6 100644--- a/frontend/editor/src/core/components/shared/ErrorBoundary.tsx+++ b/frontend/editor/src/core/components/shared/ErrorBoundary.tsx@@ -1,6 +1,7 @@import React from "react";import { Text, Stack } from "@mantine/core";import { Button } from "@app/ui/Button";+import i18n from "i18next";interface ErrorBoundaryState {hasError: boolean;@@ -89,7 +90,7 @@ export default class ErrorBoundary extends React.Component<}}><Text size="lg" fw={500} c="var(--color-red-dark)">- Something went wrong+ {i18n.t("errorBoundary.title", "Something went wrong")}</Text>{process.env.NODE_ENV === "development" && this.state.error && (<>@@ -134,7 +135,7 @@ export default class ErrorBoundary extends React.Component<variant="secondary"style={{ marginTop: "var(--mantine-spacing-md)" }}>- Try Again+ {i18n.t("errorBoundary.tryAgain", "Try Again")}</Button></Stack>);diff --git a/frontend/editor/src/core/components/viewer/nonpdf/types.ts b/frontend/editor/src/core/components/viewer/nonpdf/types.tsindex d1f32ec0d4..bd592e5dd5 100644--- a/frontend/editor/src/core/components/viewer/nonpdf/types.ts+++ b/frontend/editor/src/core/components/viewer/nonpdf/types.ts@@ -1,4 +1,5 @@import React from "react";+import i18n from "i18next";import { Icon } from "@app/ui/Icon";import type { NonPdfFileType } from "@app/utils/fileUtils";@@ -29,13 +30,13 @@ export function getFileTypeMeta(switch (type) {case "image":return {- label: "Image",+ label: i18n.t("viewer.nonPdf.fileType.image", "Image"),icon: React.createElement(Icon, { name: "image", size: 20 }),...BADGE_COLORS,};case "csv":return {- label: "Spreadsheet",+ label: i18n.t("viewer.nonPdf.fileType.spreadsheet", "Spreadsheet"),icon: React.createElement(Icon, { name: "table", size: 20 }),...BADGE_COLORS,};@@ -59,14 +60,14 @@ export function getFileTypeMeta(};case "text":return {- label: "Text",+ label: i18n.t("viewer.nonPdf.fileType.text", "Text"),icon: React.createElement(Icon, { name: "file-text", size: 20 }),...BADGE_COLORS,};default: {// For unknown types, derive label from the file extension (e.g. ".docx" → "DOCX")const ext = fileName?.split(".").pop()?.toUpperCase();- const label = ext || "File";+ const label = ext || i18n.t("viewer.nonPdf.fileType.file", "File");return {label,icon: React.createElement(Icon, { name: "file-text", size: 20 }),diff --git a/frontend/editor/src/core/contexts/AppConfigContext.tsx b/frontend/editor/src/core/contexts/AppConfigContext.tsxindex 112ca92bb8..2926c00345 100644--- a/frontend/editor/src/core/contexts/AppConfigContext.tsx+++ b/frontend/editor/src/core/contexts/AppConfigContext.tsx@@ -10,6 +10,7 @@ import React, {import { useQuery, useQueryClient } from "@tanstack/react-query";import { DEFAULT_APP_CONFIG, fetchAppConfig } from "@app/api/config";import { qk } from "@app/query/keys";+import i18n from "i18next";import { CONFIG_STALE_TIME } from "@app/query/staleTime";import type { AppConfig, AppConfigBootstrapMode } from "@app/types/appConfig";import { useJwtConfigSync } from "@app/hooks/useJwtConfigSync";@@ -56,7 +57,7 @@ function errorMessage(error: unknown): string {return (axiosLike?.response?.data?.message ||axiosLike?.message ||- "Unknown error occurred"+ i18n.t("error.unknown", "Unknown error occurred"));}diff --git a/frontend/editor/src/core/contexts/FilesPageContext.tsx b/frontend/editor/src/core/contexts/FilesPageContext.tsxindex 1d293b0361..7df57f3c1c 100644--- a/frontend/editor/src/core/contexts/FilesPageContext.tsx+++ b/frontend/editor/src/core/contexts/FilesPageContext.tsx@@ -8,6 +8,7 @@ import React, {useState,} from "react";import { useTranslation } from "react-i18next";+import i18n from "i18next";import { useNavigate } from "react-router-dom";import { FileId } from "@app/types/file";@@ -222,7 +223,9 @@ export function FilesPageProvider({ children }: { children: React.ReactNode }) {if (gen !== refreshGenRef.current) return;console.error("[FilesPageContext] refresh failed", err);setFoldersError(- err instanceof Error ? err.message : "Failed to load files",+ err instanceof Error+ ? err.message+ : i18n.t("filesPage.error.loadFilesFailed", "Failed to load files"),);} finally {if (gen === refreshGenRef.current) setLoading(false);diff --git a/frontend/editor/src/core/contexts/FolderContext.tsx b/frontend/editor/src/core/contexts/FolderContext.tsxindex 1be3d70d9c..5b5551769e 100644--- a/frontend/editor/src/core/contexts/FolderContext.tsx+++ b/frontend/editor/src/core/contexts/FolderContext.tsx@@ -25,6 +25,7 @@ import React, {useState,} from "react";+import i18n from "i18next";import { folderStorage } from "@app/services/folderStorage";import { virtualFolderStorage } from "@app/services/virtualFolderStorage";import { localFolderStorage } from "@app/services/localFolderStorage";@@ -207,7 +208,12 @@ function formatServerError(err: unknown): string {response?.data?.errors?.[0]?.defaultMessage;if (msg) return status ? `${msg} (HTTP ${status})` : msg;}- return err instanceof Error ? err.message : "Folder operation failed";+ return err instanceof Error+ ? err.message+ : i18n.t(+ "filesPage.error.folderOperationFailed",+ "Folder operation failed",+ );}/**@@ -395,7 +401,13 @@ export function FolderProvider({ children }: FolderProviderProps) {// tooltips via `serverReachable`, which is enough signal.if (status === undefined || status >= 500) {console.warn("[FolderContext] pullFromServer failed", err);- setError(`Folder sync failed: ${formatServerError(err)}`);+ setError(+ i18n.t(+ "filesPage.error.folderSyncFailed",+ "Folder sync failed: {{message}}",+ { message: formatServerError(err) },+ ),+ );}}// Narrowing the ternary into a typed variable so TS keeps the literal@@ -612,11 +624,21 @@ export function FolderProvider({ children }: FolderProviderProps) {// listing would. Mount roots come from the picker, never here.const parent = parentFolderId ? foldersById.get(parentFolderId) : null;if (!parent?.directory) {- throw new Error("Cannot create a folder outside a mounted directory");+ throw new Error(+ i18n.t(+ "filesPage.error.createOutsideMount",+ "Cannot create a folder outside a mounted directory",+ ),+ );}const path = await makeDiskDirectory(parent.directory, name);if (path === null) {- throw new Error("This build cannot create folders on disk");+ throw new Error(+ i18n.t(+ "filesPage.error.diskFoldersUnsupported",+ "This build cannot create folders on disk",+ ),+ );}const record = diskSubfolderRecord(path, name, parent.id);if (mountedRef.current) {@@ -723,10 +745,20 @@ export function FolderProvider({ children }: FolderProviderProps) {async (id: FolderId, newParentId: FolderId | null) => {const kind = requireKind(id);if (newParentId !== null && requireKind(newParentId) !== kind) {- throw new Error("Folders can only move within their own kind");+ throw new Error(+ i18n.t(+ "filesPage.error.moveAcrossKinds",+ "Folders can only move within their own kind",+ ),+ );}if (kind === "local") {- throw new Error("A local folder sits where its directory sits");+ throw new Error(+ i18n.t(+ "filesPage.error.moveLocalFolder",+ "A local folder sits where its directory sits",+ ),+ );}if (kind === "virtual") {return applyOwnedRecord(@@ -758,7 +790,12 @@ export function FolderProvider({ children }: FolderProviderProps) {) => {const kind = requireKind(id);if (kind === "local") {- throw new Error("Local folders cannot be recoloured yet");+ throw new Error(+ i18n.t(+ "filesPage.error.recolourLocalFolder",+ "Local folders cannot be recoloured yet",+ ),+ );}if (kind === "virtual") {// Only the fields the picker sent: it sends one key per interaction, and the@@ -797,7 +834,10 @@ export function FolderProvider({ children }: FolderProviderProps) {if (kind === "local") {if (isDiskFolderId(id)) {throw new Error(- "Subfolders of a mounted directory are removed on disk",+ i18n.t(+ "filesPage.error.removeDiskSubfolder",+ "Subfolders of a mounted directory are removed on disk",+ ),);}// Removes the record and nothing else; the directory is the user's.@@ -887,7 +927,10 @@ export function FolderProvider({ children }: FolderProviderProps) {);if (mountedRef.current) {setError(- "Folder was deleted, but some files couldn't be detached locally. Refresh to fix.",+ i18n.t(+ "filesPage.error.folderDetachFailed",+ "Folder was deleted, but some files couldn't be detached locally. Refresh to fix.",+ ),);}}diff --git a/frontend/editor/src/core/hooks/tools/sign/useSavedSignatures.ts b/frontend/editor/src/core/hooks/tools/sign/useSavedSignatures.tsindex c4ef0b1e93..4359181965 100644--- a/frontend/editor/src/core/hooks/tools/sign/useSavedSignatures.ts+++ b/frontend/editor/src/core/hooks/tools/sign/useSavedSignatures.ts@@ -1,4 +1,5 @@import { useCallback, useEffect, useMemo, useState } from "react";+import i18n from "i18next";import { generateId } from "@app/utils/generateId";import {signatureStorageService,@@ -114,7 +115,9 @@ export const useSavedSignatures = () => {const newSignature: SavedSignature = {...payload,id: generateId(),- label: (label || "Signature").trim() || "Signature",+ label:+ (label || "").trim() ||+ i18n.t("sign.saved.defaultLabel", "Signature"),scope:scope || (storageType === "backend" ? "personal" : "localStorage"),createdAt: timestamp,@@ -157,7 +160,10 @@ export const useSavedSignatures = () => {entry.id === id? {...entry,- label: nextLabel.trim() || entry.label || "Signature",+ label:+ nextLabel.trim() ||+ entry.label ||+ i18n.t("sign.saved.defaultLabel", "Signature"),updatedAt: Date.now(),}: entry,diff --git a/frontend/editor/src/core/hooks/useEndpointConfig.ts b/frontend/editor/src/core/hooks/useEndpointConfig.tsindex 488375c853..60e0219190 100644--- a/frontend/editor/src/core/hooks/useEndpointConfig.ts+++ b/frontend/editor/src/core/hooks/useEndpointConfig.ts@@ -5,6 +5,7 @@ import {fetchEndpointsAvailability,} from "@app/api/config";import { qk } from "@app/query/keys";+import i18n from "i18next";import { CONFIG_STALE_TIME } from "@app/query/staleTime";import { useJwtConfigSync } from "@app/hooks/useJwtConfigSync";import type { EndpointAvailabilityDetails } from "@app/types/endpointAvailability";@@ -13,7 +14,9 @@ const OPTIMISTIC: EndpointAvailabilityDetails = { enabled: true, reason: null };function message(error: unknown): string | null {if (!error) return null;- return error instanceof Error ? error.message : "Unknown error occurred";+ return error instanceof Error+ ? error.message+ : i18n.t("error.unknown", "Unknown error occurred");}/** Whether one endpoint is enabled. `null` while loading and on failure. */diff --git a/frontend/editor/src/core/services/fileStorage.ts b/frontend/editor/src/core/services/fileStorage.tsindex 39759d4f43..9a356e6bc6 100644--- a/frontend/editor/src/core/services/fileStorage.ts+++ b/frontend/editor/src/core/services/fileStorage.ts@@ -17,6 +17,7 @@ import {DATABASE_CONFIGS,} from "@app/services/indexedDBManager";import { alert } from "@app/components/toast";+import i18n from "i18next";/*** Storage record - single source of truth@@ -533,10 +534,12 @@ class FileStorageService {);alert({alertType: "warning",- title: "File data is unavailable",- body:- `"${record.name}" is saved in this browser but its contents can no longer be read. ` +- "Upload the file again to keep working on it.",+ title: i18n.t("fileStorage.unreadable.title", "File data is unavailable"),+ body: i18n.t(+ "fileStorage.unreadable.body",+ '"{{name}}" is saved in this browser but its contents can no longer be read. Upload the file again to keep working on it.',+ { name: record.name },+ ),expandable: false,durationMs: 8000,});diff --git a/frontend/editor/src/core/services/fileSyncService.ts b/frontend/editor/src/core/services/fileSyncService.tsindex c34bbafa97..4b2d34baa7 100644--- a/frontend/editor/src/core/services/fileSyncService.ts+++ b/frontend/editor/src/core/services/fileSyncService.ts@@ -8,6 +8,7 @@import apiClient from "@app/services/apiClient";import { fileStorage } from "@app/services/fileStorage";import { alert } from "@app/components/toast";+import i18n from "i18next";import { StirlingFileStub, StirlingFile } from "@app/types/fileContext";import { FileId } from "@app/types/fileContext";import { FolderId, parseFolderId } from "@app/types/folder";@@ -280,9 +281,18 @@ export async function reconcileServerFiles(alertType: "warning",title:status === 401- ? "Sign-in required to load cloud files"- : "Could not reach the cloud library",- body: "Showing only files cached in this browser. Refresh to retry once the connection is back.",+ ? i18n.t(+ "fileSync.pullFailed.signInTitle",+ "Sign-in required to load cloud files",+ )+ : i18n.t(+ "fileSync.pullFailed.unreachableTitle",+ "Could not reach the cloud library",+ ),+ body: i18n.t(+ "fileSync.pullFailed.body",+ "Showing only files cached in this browser. Refresh to retry once the connection is back.",+ ),expandable: false,durationMs: 5000,});@@ -513,13 +523,36 @@ export async function materializeServerStubs(// Single summarized toast - far less noisy than per-stub alerts but// still surfaces what would otherwise be a silent drop from the grid.const first = failed[0];- const bodyText =- failed.length === 1- ? `Couldn't open "${first.name}"${first.status ? ` (HTTP ${first.status})` : ""}.`- : `Couldn't open ${failed.length} files including "${first.name}".`;+ let bodyText: string;+ if (failed.length > 1) {+ bodyText = i18n.t(+ "fileSync.openFailed.multiple",+ `Couldn't open {{count}} files including "{{name}}".`,+ {+ count: failed.length,+ name: first.name,+ defaultValue_one: `Couldn't open {{count}} file including "{{name}}".`,+ },+ );+ } else if (first.status) {+ bodyText = i18n.t(+ "fileSync.openFailed.singleWithStatus",+ `Couldn't open "{{name}}" (HTTP {{status}}).`,+ { name: first.name, status: first.status },+ );+ } else {+ bodyText = i18n.t(+ "fileSync.openFailed.single",+ `Couldn't open "{{name}}".`,+ { name: first.name },+ );+ }alert({alertType: "warning",- title: "Some files couldn't be opened",+ title: i18n.t(+ "fileSync.openFailed.title",+ "Some files couldn't be opened",+ ),body: bodyText,expandable: false,durationMs: 5000,diff --git a/frontend/editor/src/core/services/httpErrorUtils.ts b/frontend/editor/src/core/services/httpErrorUtils.tsindex c4898266c3..2ce7b17f04 100644--- a/frontend/editor/src/core/services/httpErrorUtils.ts+++ b/frontend/editor/src/core/services/httpErrorUtils.ts@@ -1,6 +1,16 @@import axios from "axios";+import i18n from "i18next";-const FRIENDLY_FALLBACK = "There was an error processing your request.";+const friendlyFallback = () =>+ i18n.t(+ "error.requestFallback",+ "There was an error processing your request.",+ );+const corruptedFilesMessage = () =>+ i18n.t(+ "error.invalidOrCorruptedFiles",+ "Process failed due to invalid/corrupted file(s)",+ );const MAX_TOAST_BODY_CHARS = 400; // avoid massive, unreadable toastsexport function clampText(s: string, max = MAX_TOAST_BODY_CHARS): string {@@ -18,11 +28,11 @@ function isUnhelpfulMessage(msg: string | null | undefined): boolean {return false;}-function titleForStatus(status?: number): string {- if (!status) return "Network error";- if (status >= 500) return "Server error";- if (status >= 400) return "Request error";- return "Request failed";+export function titleForStatus(status?: number): string {+ if (!status) return i18n.t("error.networkError", "Network error");+ if (status >= 500) return i18n.t("error.serverError", "Server error");+ if (status >= 400) return i18n.t("error.requestError", "Request error");+ return i18n.t("error.requestFailed", "Request failed");}export function extractAxiosErrorMessage(error: unknown): {@@ -59,7 +69,11 @@ export function extractAxiosErrorMessage(error: unknown): {const data = parsed;if (!data) return typeof raw === "string" ? raw : "";const ids = extractIds();- if (ids && ids.length > 0) return `Failed files: ${ids.join(", ")}`;+ if (ids && ids.length > 0) {+ return i18n.t("error.failedFiles", "Failed files: {{ids}}", {+ ids: ids.join(", "),+ });+ }const message = (data as { message?: unknown })?.message;if (message) return message as string;if (typeof raw === "string") return raw;@@ -72,26 +86,26 @@ export function extractAxiosErrorMessage(error: unknown): {const ids = extractIds();const title = titleForStatus(status);if (ids && ids.length > 0) {- return { title, body: "Process failed due to invalid/corrupted file(s)" };+ return { title, body: corruptedFilesMessage() };}if (status === 422) {- const fallbackMsg = "Process failed due to invalid/corrupted file(s)";+ const fallbackMsg = corruptedFilesMessage();const bodyMsg = isUnhelpfulMessage(body) ? fallbackMsg : body;return { title, body: bodyMsg };}- const bodyMsg = isUnhelpfulMessage(body) ? FRIENDLY_FALLBACK : body;+ const bodyMsg = isUnhelpfulMessage(body) ? friendlyFallback() : body;return { title, body: bodyMsg };}try {const msg = ((error as { message?: unknown })?.message ||String(error)) as string;return {- title: "Network error",- body: isUnhelpfulMessage(msg) ? FRIENDLY_FALLBACK : msg,+ title: titleForStatus(),+ body: isUnhelpfulMessage(msg) ? friendlyFallback() : msg,};} catch (e) {// ignore extraction errorsconsole.debug("extractAxiosErrorMessage", e);- return { title: "Network error", body: FRIENDLY_FALLBACK };+ return { title: titleForStatus(), body: friendlyFallback() };}}diff --git a/frontend/editor/src/core/services/pdfiumService.ts b/frontend/editor/src/core/services/pdfiumService.tsindex de289cf8f7..cf41fae3fb 100644--- a/frontend/editor/src/core/services/pdfiumService.ts+++ b/frontend/editor/src/core/services/pdfiumService.ts@@ -23,6 +23,7 @@ import {pdfiumWasmUrl,} from "@app/services/wasmPrecompiler";import { runPdfiumScan } from "@app/services/pdfiumScanQueue";+import i18n from "i18next";import type { FormField, WidgetCoordinates } from "@app/tools/formFill/types";export interface ExtendedPdfiumRuntime {@@ -312,19 +313,41 @@ function copyToWasmHeap(function pdfiumOpenErrorMessage(err: number): string {switch (err) {case 1:- return "Could not open the PDF (unknown error).";+ return i18n.t(+ "error.pdfOpen.unknown",+ "Could not open the PDF (unknown error).",+ );case 2:- return "This file is not a valid PDF or is corrupted.";+ return i18n.t(+ "error.pdfOpen.invalid",+ "This file is not a valid PDF or is corrupted.",+ );case 3:- return "The PDF file is corrupted and could not be read.";+ return i18n.t(+ "error.pdfOpen.corrupted",+ "The PDF file is corrupted and could not be read.",+ );case 4:- return "This PDF is password-protected.";+ return i18n.t(+ "error.pdfOpen.passwordProtected",+ "This PDF is password-protected.",+ );case 5:- return "This PDF uses an unsupported security scheme.";+ return i18n.t(+ "error.pdfOpen.unsupportedSecurity",+ "This PDF uses an unsupported security scheme.",+ );case 6:- return "A page in this PDF could not be loaded.";+ return i18n.t(+ "error.pdfOpen.pageLoadFailed",+ "A page in this PDF could not be loaded.",+ );default:- return `Could not open the PDF (error ${err}).`;+ return i18n.t(+ "error.pdfOpen.code",+ "Could not open the PDF (error {{code}}).",+ { code: err },+ );}}diff --git a/frontend/editor/src/core/services/processingErrorHandler.ts b/frontend/editor/src/core/services/processingErrorHandler.tsindex a7b1275036..5dd5970fec 100644--- a/frontend/editor/src/core/services/processingErrorHandler.ts+++ b/frontend/editor/src/core/services/processingErrorHandler.ts@@ -1,4 +1,5 @@import { ProcessingError } from "@app/types/processing";+import i18n from "i18next";export class ProcessingErrorHandler {private static readonly DEFAULT_MAX_RETRIES = 3;@@ -133,25 +134,48 @@ export class ProcessingErrorHandler {): string {switch (errorType) {case "network":- return "Network connection failed. Please check your internet connection and try again.";+ return i18n.t(+ "error.processing.network",+ "Network connection failed. Please check your internet connection and try again.",+ );case "memory":- return "Insufficient memory to process this file. Try closing other applications or processing a smaller file.";+ return i18n.t(+ "error.processing.memory",+ "Insufficient memory to process this file. Try closing other applications or processing a smaller file.",+ );case "timeout":- return "Processing timed out. This file may be too large or complex to process.";+ return i18n.t(+ "error.processing.timeout",+ "Processing timed out. This file may be too large or complex to process.",+ );case "cancelled":- return "Processing was cancelled by user.";+ return i18n.t(+ "error.processing.cancelled",+ "Processing was cancelled by user.",+ );case "corruption":- return "This PDF file appears to be corrupted or encrypted. Please try a different file.";+ return i18n.t(+ "error.processing.corruption",+ "This PDF file appears to be corrupted or encrypted. Please try a different file.",+ );case "parsing":- return `Failed to process PDF: ${originalMessage}`;+ return i18n.t(+ "error.processing.parsing",+ "Failed to process PDF: {{message}}",+ { message: originalMessage },+ );default:- return `Processing failed: ${originalMessage}`;+ return i18n.t(+ "error.processing.failed",+ "Processing failed: {{message}}",+ { message: originalMessage },+ );}}diff --git a/frontend/editor/src/core/services/specialErrorToasts.ts b/frontend/editor/src/core/services/specialErrorToasts.tsindex f2ee343803..66e7305905 100644--- a/frontend/editor/src/core/services/specialErrorToasts.ts+++ b/frontend/editor/src/core/services/specialErrorToasts.ts@@ -1,5 +1,6 @@import i18n from "i18next";import { alert } from "@app/components/toast";+import { titleForStatus } from "@app/services/httpErrorUtils";interface ErrorToastMapping {regex: RegExp;@@ -23,13 +24,6 @@ const MAPPINGS: ErrorToastMapping[] = [},];-function titleForStatus(status?: number): string {- if (!status) return "Network error";- if (status >= 500) return "Server error";- if (status >= 400) return "Request error";- return "Request failed";-}-/*** Match a raw backend error string against known patterns and show a friendly toast.* Returns true if a special toast was shown, false otherwise.diff --git a/frontend/editor/src/core/setupTests.ts b/frontend/editor/src/core/setupTests.tsindex a0a347a660..30153939e4 100644--- a/frontend/editor/src/core/setupTests.ts+++ b/frontend/editor/src/core/setupTests.ts@@ -1,11 +1,20 @@import "@testing-library/jest-dom";import { vi } from "vitest";+import i18n from "i18next";import { installFailOnConsole } from "@app/tests/failOnConsole";// jsdom is missing the same APIs WebKit is, so tests must agree with the// browser. Same module `src/index.tsx` installs.import "@app/utils/engineShims";+// Modules outside React call i18n.t directly; no resources means the English defaults render.+void i18n.init({+ lng: "en-US",+ resources: {},+ initAsync: false,+ interpolation: { escapeValue: false },+});+installFailOnConsole();// Mock localStorage for testsdiff --git a/frontend/editor/src/core/tools/pdfTextEditor/commands/CompositeCommand.ts b/frontend/editor/src/core/tools/pdfTextEditor/commands/CompositeCommand.tsindex 2f9f0282b4..1b139413b9 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/commands/CompositeCommand.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/commands/CompositeCommand.ts@@ -1,3 +1,4 @@+import i18n from "i18next";import {RolledBackError,type Command,@@ -62,6 +63,8 @@ export class CompositeCommand implements Command {}describe(): string {- return this.last.describe?.() ?? "Edit";+ return (+ this.last.describe?.() ?? i18n.t("pdfTextEditor.commands.edit", "Edit")+ );}}diff --git a/frontend/editor/src/core/tools/pdfTextEditor/commands/EditTextCommand.ts b/frontend/editor/src/core/tools/pdfTextEditor/commands/EditTextCommand.tsindex a36f067294..c3611e2272 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/commands/EditTextCommand.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/commands/EditTextCommand.ts@@ -1,3 +1,4 @@+import i18n from "i18next";import type { Command } from "@app/tools/pdfTextEditor/commands/Command";import type { EditorDocument } from "@app/tools/pdfTextEditor/model/EditorDocument";import { PdfiumTextWriter } from "@app/tools/pdfTextEditor/pdfium/PdfiumTextWriter";@@ -1208,7 +1209,9 @@ export class EditTextCommand implements Command {}describe(): string {- return `Type into ${this.runId}`;+ return i18n.t("pdfTextEditor.commands.typeInto", "Type into {{run}}", {+ run: this.runId,+ });}/** Consecutive typing on the SAME run coalesces into one undo step. */diff --git a/frontend/editor/src/core/tools/pdfTextEditor/commands/MergeRunsCommand.ts b/frontend/editor/src/core/tools/pdfTextEditor/commands/MergeRunsCommand.tsindex d0278233a5..d9ea613ed3 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/commands/MergeRunsCommand.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/commands/MergeRunsCommand.ts@@ -1,3 +1,4 @@+import i18n from "i18next";import type { Command } from "@app/tools/pdfTextEditor/commands/Command";import type { EditorDocument } from "@app/tools/pdfTextEditor/model/EditorDocument";import {@@ -151,7 +152,11 @@ export class MergeRunsCommand implements Command {}describe(): string {- return `Merge ${this.runIds.length} runs into a paragraph`;+ return i18n.t(+ "pdfTextEditor.commands.mergeRuns",+ "Merge {{count}} runs into a paragraph",+ { count: this.runIds.length },+ );}}diff --git a/frontend/editor/src/core/tools/pdfTextEditor/commands/ReflowWrapCommand.ts b/frontend/editor/src/core/tools/pdfTextEditor/commands/ReflowWrapCommand.tsindex db18820d8d..e63f8a52c9 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/commands/ReflowWrapCommand.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/commands/ReflowWrapCommand.ts@@ -1,3 +1,4 @@+import i18n from "i18next";import type { Command } from "@app/tools/pdfTextEditor/commands/Command";import type { EditorDocument } from "@app/tools/pdfTextEditor/model/EditorDocument";import type {@@ -256,7 +257,9 @@ export class ReflowWrapCommand implements Command {}describe(): string {- return `Wrap ${this.runId}`;+ return i18n.t("pdfTextEditor.commands.wrap", "Wrap {{run}}", {+ run: this.runId,+ });}// Share the edit coalesce key for this run so the auto-reflow that fires ondiff --git a/frontend/editor/src/core/tools/pdfTextEditor/commands/SetColourCommand.ts b/frontend/editor/src/core/tools/pdfTextEditor/commands/SetColourCommand.tsindex f1fab978b8..eb5634242c 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/commands/SetColourCommand.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/commands/SetColourCommand.ts@@ -1,3 +1,4 @@+import i18n from "i18next";import type { Command } from "@app/tools/pdfTextEditor/commands/Command";import type { EditorDocument } from "@app/tools/pdfTextEditor/model/EditorDocument";import type { RGBA } from "@app/tools/pdfTextEditor/types";@@ -81,7 +82,9 @@ export class SetColourCommand implements Command {}describe(): string {- return `Set colour on ${this.runId}`;+ return i18n.t("pdfTextEditor.commands.setColour", "Set colour on {{run}}", {+ run: this.runId,+ });}}diff --git a/frontend/editor/src/core/tools/pdfTextEditor/commands/SetTextOutlineCommand.ts b/frontend/editor/src/core/tools/pdfTextEditor/commands/SetTextOutlineCommand.tsindex 4a45d23f3b..b2afe4a1b6 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/commands/SetTextOutlineCommand.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/commands/SetTextOutlineCommand.ts@@ -1,3 +1,4 @@+import i18n from "i18next";import type { Command } from "@app/tools/pdfTextEditor/commands/Command";import type { EditorDocument } from "@app/tools/pdfTextEditor/model/EditorDocument";import type { RGBA } from "@app/tools/pdfTextEditor/types";@@ -137,7 +138,11 @@ export class SetTextOutlineCommand implements Command {}describe(): string {- return `Set outline on ${this.runId}`;+ return i18n.t(+ "pdfTextEditor.commands.setOutline",+ "Set outline on {{run}}",+ { run: this.runId },+ );}}diff --git a/frontend/editor/src/core/tools/pdfTextEditor/commands/UngroupParagraphCommand.ts b/frontend/editor/src/core/tools/pdfTextEditor/commands/UngroupParagraphCommand.tsindex 389bd0cafc..6346aa8ced 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/commands/UngroupParagraphCommand.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/commands/UngroupParagraphCommand.ts@@ -1,3 +1,4 @@+import i18n from "i18next";import type { Command } from "@app/tools/pdfTextEditor/commands/Command";import type { EditorDocument } from "@app/tools/pdfTextEditor/model/EditorDocument";import {@@ -152,6 +153,10 @@ export class UngroupParagraphCommand implements Command {}describe(): string {- return `Ungroup paragraph ${this.runId}`;+ return i18n.t(+ "pdfTextEditor.commands.ungroupParagraph",+ "Ungroup paragraph {{run}}",+ { run: this.runId },+ );}}diff --git a/frontend/editor/src/core/tools/pdfTextEditor/util/externalImageEdit.ts b/frontend/editor/src/core/tools/pdfTextEditor/util/externalImageEdit.tsindex 2ac6d4cd96..b7488db2f0 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/util/externalImageEdit.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/util/externalImageEdit.ts@@ -1,6 +1,8 @@// Round-trip an image through the user's own editor: save the pixels as a PNG,// then hand the bytes back every time that file is re-saved.+import i18n from "i18next";+export interface ExternalEditPixels {rgba: Uint8Array | Uint8ClampedArray;width: number;@@ -77,7 +79,15 @@ export async function startExternalImageEdit(try {handle = await picker({suggestedName,- types: [{ description: "PNG image", accept: { "image/png": [".png"] } }],+ types: [+ {+ description: i18n.t(+ "pdfTextEditor.externalEdit.pngFileType",+ "PNG image",+ ),+ accept: { "image/png": [".png"] },+ },+ ],});} catch (error) {if (isAbort(error)) return { status: "cancelled" };diff --git a/frontend/editor/src/core/utils/getDropzoneFiles.ts b/frontend/editor/src/core/utils/getDropzoneFiles.tsindex 1ed8a6e1bd..d65b487b5c 100644--- a/frontend/editor/src/core/utils/getDropzoneFiles.ts+++ b/frontend/editor/src/core/utils/getDropzoneFiles.ts@@ -1,4 +1,5 @@import type { DropzoneProps } from "@mantine/dropzone";+import i18n from "i18next";type DropEvent = Parameters<NonNullable<DropzoneProps["getFilesFromEvent"]>>[0];@@ -31,10 +32,15 @@ async function readEntryFiles(return files;}+function unreadableDropMessage(): string {+ return i18n.t(+ "fileUpload.droppedFileUnreadable",+ "Could not read a dropped file.",+ );+}+function dropErrorMessage(cause: unknown): string {- return cause instanceof Error- ? cause.message- : "Could not read a dropped file.";+ return cause instanceof Error ? cause.message : unreadableDropMessage();}/**@@ -63,7 +69,7 @@ export async function getDropzoneFiles(const entry = item.webkitGetAsEntry?.();if (entry?.isDirectory) return readEntryFiles(entry, errors);const file = item.getAsFile();- if (!file) throw new Error("Could not read a dropped file.");+ if (!file) throw new Error(unreadableDropMessage());return [file];} catch (cause) {errors.push(dropErrorMessage(cause));diff --git a/frontend/editor/src/core/utils/toolErrorHandler.ts b/frontend/editor/src/core/utils/toolErrorHandler.tsindex ddbc9646a2..da9b41adb8 100644--- a/frontend/editor/src/core/utils/toolErrorHandler.ts+++ b/frontend/editor/src/core/utils/toolErrorHandler.ts@@ -4,6 +4,7 @@import axios from "axios";import { normalizeAxiosErrorData } from "@app/services/errorUtils";+import i18n from "i18next";/** Signup gates are handled by the account modal and must not be reported as damaged files. */export function isSignupRequiredError(error: unknown): boolean {@@ -31,7 +32,10 @@ export const extractErrorMessage = (error: unknown): string => {if (error instanceof Error && error.message) {return error.message;}- return "There was an error processing your request.";+ return i18n.t(+ "error.requestFallback",+ "There was an error processing your request.",+ );};/**diff --git a/frontend/editor/src/desktop/services/backendHealthMonitor.ts b/frontend/editor/src/desktop/services/backendHealthMonitor.tsindex aeff42f47a..43454fdb8b 100644--- a/frontend/editor/src/desktop/services/backendHealthMonitor.ts+++ b/frontend/editor/src/desktop/services/backendHealthMonitor.ts@@ -91,8 +91,8 @@ class BackendHealthMonitor {console.error("[BackendHealthMonitor] Health check failed:", error);this.updateState({status: "unhealthy",- message: "Backend is unavailable",- error: "Backend offline",+ message: i18n.t("backendHealth.unavailable", "Backend is unavailable"),+ error: i18n.t("backendHealth.offline", "Backend Offline"),});return false;}diff --git a/frontend/editor/src/desktop/services/connectionModeService.ts b/frontend/editor/src/desktop/services/connectionModeService.tsindex b472e8ab1a..3ee8dfb579 100644--- a/frontend/editor/src/desktop/services/connectionModeService.ts+++ b/frontend/editor/src/desktop/services/connectionModeService.ts@@ -1,4 +1,5 @@import { invoke, isTauri } from "@tauri-apps/api/core";+import i18n from "i18next";import { fetch } from "@tauri-apps/plugin-http";import { endpointAvailabilityService } from "@app/services/endpointAvailabilityService";import { selfHostedServerMonitor } from "@app/services/selfHostedServerMonitor";@@ -358,7 +359,10 @@ export class ConnectionModeService {if (stage2Result.success) {return {success: false,- error: "Server is only accessible via HTTPS, not HTTP.",+ error: i18n.t(+ "setup.server.error.httpsOnly",+ "Server is only accessible via HTTPS, not HTTP.",+ ),errorCode: "HTTP_NOT_AVAILABLE",diagnostics,};@@ -454,7 +458,10 @@ export class ConnectionModeService {console.log(`[ConnectionModeService] ⚠️ HTTP works but HTTPS doesn't`);return {success: false,- error: "Server is only accessible via HTTP (not HTTPS).",+ error: i18n.t(+ "setup.server.error.httpOnly",+ "Server is only accessible via HTTP (not HTTPS).",+ ),errorCode: "HTTPS_NOT_AVAILABLE",diagnostics,};@@ -509,8 +516,10 @@ export class ConnectionModeService {);return {success: false,- error:+ error: i18n.t(+ "setup.server.error.networkBlocked","No internet connectivity detected. All network requests are failing.",+ ),errorCode: "NETWORK_BLOCKED",diagnostics,};@@ -544,7 +553,11 @@ export class ConnectionModeService {);return {success: false,- error: `Cannot resolve hostname: ${urlObj.hostname}`,+ error: i18n.t(+ "setup.server.error.dnsFailed",+ "Cannot resolve hostname: {{hostname}}",+ { hostname: urlObj.hostname },+ ),errorCode: "DNS_RESOLUTION_FAILED",diagnostics,};@@ -561,7 +574,10 @@ export class ConnectionModeService {);return {success: false,- error: "Server responds to HEAD requests but not GET requests.",+ error: i18n.t(+ "setup.server.error.methodMismatch",+ "Server responds to HEAD requests but not GET requests.",+ ),errorCode: "METHOD_MISMATCH",diagnostics,};@@ -580,8 +596,10 @@ export class ConnectionModeService {);return {success: false,- error:+ error: i18n.t(+ "setup.server.error.userAgentBlocked","Server blocks Tauri/desktop app User-Agent but allows browser User-Agent.",+ ),errorCode: "USER_AGENT_BLOCKED",diagnostics,};@@ -650,8 +668,10 @@ export class ConnectionModeService {return {success: false,- error:+ error: i18n.t(+ "setup.server.error.serverUnreachable","Cannot connect to server. Internet works but this specific server is unreachable.",+ ),errorCode: "SERVER_UNREACHABLE",diagnostics,};diff --git a/frontend/editor/src/desktop/services/localFileSaveService.ts b/frontend/editor/src/desktop/services/localFileSaveService.tsindex 347c4927e4..11ffca65b9 100644--- a/frontend/editor/src/desktop/services/localFileSaveService.ts+++ b/frontend/editor/src/desktop/services/localFileSaveService.ts@@ -2,6 +2,7 @@ import type {SaveResult,MultiFileSaveResult,} from "@core/services/localFileSaveService";+import i18n from "i18next";import { beginSelfWrite, endSelfWrite } from "@app/services/diskFileSync";export type { SaveResult, MultiFileSaveResult };import { assertFilesNotBlocked } from "@app/services/policyFileGuard";@@ -58,7 +59,7 @@ export async function showSaveDialog(? `${defaultDirectory}/${defaultFilename}`: defaultFilename,filters,- title: "Save As",+ title: i18n.t("workbenchBar.saveAs", "Save As"),});return selectedPath;@@ -89,7 +90,9 @@ export async function saveMultipleFilesWithPrompt(directory: true,multiple: false,defaultPath: defaultDirectory,- title: `Save ${files.length} file${files.length > 1 ? "s" : ""}`,+ title: i18n.t("desktop.fileSave.saveFilesTitle", "Save {{count}} files", {+ count: files.length,+ }),});// User cancelleddiff --git a/frontend/editor/src/desktop/services/saasErrorInterceptor.ts b/frontend/editor/src/desktop/services/saasErrorInterceptor.tsindex 0b4a100095..47535c2513 100644--- a/frontend/editor/src/desktop/services/saasErrorInterceptor.ts+++ b/frontend/editor/src/desktop/services/saasErrorInterceptor.ts@@ -1,6 +1,7 @@import { isAxiosError } from "axios";import { extractAxiosErrorMessage } from "@app/services/httpErrorUtils";import { alert } from "@app/components/toast";+import i18n from "i18next";/*** Desktop implementation: intercepts errors from SaaS backend requests@@ -24,8 +25,12 @@ export function handleSaaSError(error: unknown): boolean {alert({alertType: "error",- title: "Cloud Processing Failed",- body: `This tool requires cloud processing but encountered an error: ${originalBody}. Please check your connection and try again.`,+ title: i18n.t("desktop.saasError.title", "Cloud Processing Failed"),+ body: i18n.t(+ "desktop.saasError.body",+ "This tool requires cloud processing but encountered an error: {{error}}. Please check your connection and try again.",+ { error: originalBody },+ ),expandable: true,isPersistentPopup: false,});diff --git a/frontend/editor/src/desktop/services/tauriBackendService.ts b/frontend/editor/src/desktop/services/tauriBackendService.tsindex 31ed0119c5..906a99c1e1 100644--- a/frontend/editor/src/desktop/services/tauriBackendService.ts+++ b/frontend/editor/src/desktop/services/tauriBackendService.ts@@ -1,6 +1,7 @@import { invoke } from "@tauri-apps/api/core";import { fetch } from "@tauri-apps/plugin-http";import { alert } from "@app/components/toast";+import i18n from "i18next";export type BackendStatus = "stopped" | "starting" | "healthy" | "unhealthy";@@ -100,8 +101,14 @@ export class TauriBackendService {);alert({alertType: "error",- title: "Backend failed to restart",- body: "The local backend could not be recovered. Please restart the app.",+ title: i18n.t(+ "backendHealth.restart.failedTitle",+ "Backend failed to restart",+ ),+ body: i18n.t(+ "backendHealth.restart.failedBody",+ "The local backend could not be recovered. Please restart the app.",+ ),isPersistentPopup: true,});return;@@ -112,8 +119,18 @@ export class TauriBackendService {);alert({alertType: "warning",- title: "Backend stopped unexpectedly",- body: `Attempting to restart... (${this.restartAttempts}/${TauriBackendService.MAX_RESTART_ATTEMPTS})`,+ title: i18n.t(+ "backendHealth.restart.stoppedTitle",+ "Backend stopped unexpectedly",+ ),+ body: i18n.t(+ "backendHealth.restart.attempting",+ "Attempting to restart... ({{attempt}}/{{max}})",+ {+ attempt: this.restartAttempts,+ max: TauriBackendService.MAX_RESTART_ATTEMPTS,+ },+ ),durationMs: 5000,});this.isRecovering = true;@@ -137,8 +154,14 @@ export class TauriBackendService {console.log("[TauriBackendService] Backend restarted successfully.");alert({alertType: "success",- title: "Backend restarted",- body: "The local backend is back online.",+ title: i18n.t(+ "backendHealth.restart.successTitle",+ "Backend restarted",+ ),+ body: i18n.t(+ "backendHealth.restart.successBody",+ "The local backend is back online.",+ ),durationMs: 4000,});} catch (err) {diff --git a/frontend/editor/src/portal/setupTests.ts b/frontend/editor/src/portal/setupTests.tsindex 22d95aa1ab..94164c3e03 100644--- a/frontend/editor/src/portal/setupTests.ts+++ b/frontend/editor/src/portal/setupTests.ts@@ -1,9 +1,18 @@import "@testing-library/jest-dom";import { vi } from "vitest";+import i18n from "i18next";// The shims `src/index.tsx` installs - see core/setupTests.ts.import "@app/utils/engineShims";+// Modules outside React call i18n.t directly; no resources means the English defaults render.+void i18n.init({+ lng: "en-US",+ resources: {},+ initAsync: false,+ interpolation: { escapeValue: false },+});+// Mirrors the editor's setup: jsdom lacks a handful of browser APIs that shared// components (Mantine FocusTrap, responsive helpers) touch on render.diff --git a/frontend/editor/src/proprietary/auth/spring/springAuthClient.ts b/frontend/editor/src/proprietary/auth/spring/springAuthClient.tsindex aae634b345..227e412820 100644--- a/frontend/editor/src/proprietary/auth/spring/springAuthClient.ts+++ b/frontend/editor/src/proprietary/auth/spring/springAuthClient.ts@@ -13,6 +13,7 @@*/import { AxiosError, type AxiosRequestConfig } from "axios";+import i18n from "i18next";import { getSpringAuthConfig } from "@app/auth/config";import { JWT_STORAGE_KEY } from "@app/auth/httpClient";import { type OAuthProvider } from "@app/auth/spring/oauthTypes";@@ -494,7 +495,9 @@ class SpringAuthClient {return {error: {message:- error instanceof Error ? error.message : "SSO redirect failed",+ error instanceof Error+ ? error.message+ : i18n.t("login.ssoRedirectFailed", "SSO redirect failed"),},};}diff --git a/frontend/editor/src/proprietary/components/shared/stripeCheckout/hooks/useCheckoutSession.ts b/frontend/editor/src/proprietary/components/shared/stripeCheckout/hooks/useCheckoutSession.tsindex 757f455344..e1c527fcfc 100644--- a/frontend/editor/src/proprietary/components/shared/stripeCheckout/hooks/useCheckoutSession.ts+++ b/frontend/editor/src/proprietary/components/shared/stripeCheckout/hooks/useCheckoutSession.ts@@ -1,4 +1,5 @@import { useCallback } from "react";+import i18n from "i18next";import licenseService, { PlanTier } from "@app/services/licenseService";import {resyncExistingLicense,@@ -54,7 +55,10 @@ export const useCheckoutSession = (if (!selectedPlan) {setState({currentStage: "error",- error: "Selected plan period is not available",+ error: i18n.t(+ "payment.planPeriodUnavailable",+ "Selected plan period is not available",+ ),loading: false,});return;@@ -128,7 +132,10 @@ export const useCheckoutSession = (const errorMessage =err instanceof Error? err.message- : "Failed to create checkout session";+ : i18n.t(+ "payment.createSessionFailed",+ "Failed to create checkout session",+ );setState({currentStage: "error",error: errorMessage,diff --git a/frontend/editor/src/proprietary/components/shared/stripeCheckout/utils/checkoutUtils.ts b/frontend/editor/src/proprietary/components/shared/stripeCheckout/utils/checkoutUtils.tsindex 1045dbcd38..e6cc73224b 100644--- a/frontend/editor/src/proprietary/components/shared/stripeCheckout/utils/checkoutUtils.ts+++ b/frontend/editor/src/proprietary/components/shared/stripeCheckout/utils/checkoutUtils.ts@@ -1,4 +1,5 @@import { TFunction } from "i18next";+import i18n from "i18next";import { CheckoutStage } from "@app/components/shared/stripeCheckout/types/checkout";/**@@ -11,7 +12,10 @@ export const validateEmail = (if (!emailRegex.test(email)) {return {valid: false,- error: "Please enter a valid email address",+ error: i18n.t(+ "signup.invalidEmail",+ "Please enter a valid email address",+ ),};}return { valid: true, error: "" };diff --git a/frontend/editor/src/saas/setupTests.ts b/frontend/editor/src/saas/setupTests.tsindex 6b04e18efd..1969e24d14 100644--- a/frontend/editor/src/saas/setupTests.ts+++ b/frontend/editor/src/saas/setupTests.ts@@ -1,10 +1,19 @@import "@testing-library/jest-dom";import { vi } from "vitest";+import i18n from "i18next";import { installFailOnConsole } from "@app/tests/failOnConsole";// The shims `src/index.tsx` installs - see core/setupTests.ts.import "@app/utils/engineShims";+// Modules outside React call i18n.t directly; no resources means the English defaults render.+void i18n.init({+ lng: "en-US",+ resources: {},+ initAsync: false,+ interpolation: { escapeValue: false },+});+installFailOnConsole();// Mock localStorage for tests