From 5642e4e84e58dbc953eac500db9b2976fe273cb6 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Mon, 9 Nov 2026 03:02:05 -0800 Subject: [PATCH] fix(mobile): localize the folder and uncertain-create messages in the workspace composer --- .../components/new-workspace-create-copy.ts | 22 +++++++++++++++++++ .../use-new-workspace-create-submit.ts | 14 ++++-------- mobile/src/i18n/en-runtime-required.json | 8 +++---- mobile/src/i18n/locales/en.json | 5 +++++ 4 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 mobile/src/components/new-workspace-create-copy.ts diff --git a/mobile/src/components/new-workspace-create-copy.ts b/mobile/src/components/new-workspace-create-copy.ts new file mode 100644 index 00000000000..77a9e3cf7e3 --- /dev/null +++ b/mobile/src/components/new-workspace-create-copy.ts @@ -0,0 +1,22 @@ +import { translate } from '../i18n/mobile-i18n' + +/** A create whose reply was lost, or whose resend was refused: it may exist, so another could be a second one. */ +export function uncertainCreateMessage(inFolder: boolean): string { + return inFolder + ? translate( + 'components.newWorkspaceCreateSubmit.uncertainFolderCreate', + 'This worktree may have been created. Check the folder before creating another.' + ) + : translate( + 'components.newWorkspaceCreateSubmit.uncertainCreate', + 'This workspace may have been created. Check your workspaces before creating another.' + ) +} + +/** The folder screen still owns a create for this repository. */ +export function folderCreateBusyMessage(): string { + return translate( + 'components.newWorkspaceCreateSubmit.folderCreateBusy', + 'A worktree in this repository is still being created or checked. It shows in the folder once it lands.' + ) +} diff --git a/mobile/src/components/use-new-workspace-create-submit.ts b/mobile/src/components/use-new-workspace-create-submit.ts index ae1f624a4c4..3ee45a87b10 100644 --- a/mobile/src/components/use-new-workspace-create-submit.ts +++ b/mobile/src/components/use-new-workspace-create-submit.ts @@ -3,6 +3,7 @@ import { useRef, useState, type Dispatch, type SetStateAction } from 'react' import type { PersistedTrustedOrcaHooks } from '../../../src/shared/orca-yaml-hook-types' import type { RetiredNameRegistry } from '../../../src/shared/worktree/retired-name-registry' import type { RpcClient } from '../transport/rpc/rpc-client-contract' +import { folderCreateBusyMessage, uncertainCreateMessage } from './new-workspace-create-copy' import { triggerError, triggerSuccess } from '../platform/haptics' import type { WorktreeCreateParent } from '../tasks/worktree-create-retry' import { createBlankWorkspace } from '../tasks/blank-workspace-create' @@ -44,11 +45,6 @@ type CreateOptions = { type Composer = ReturnType -const UNCERTAIN_FOLDER_CREATE = - 'This worktree may have been created. Check the folder before creating another.' -const UNCERTAIN_CREATE = - 'This workspace may have been created. Check your workspaces before creating another.' - export function useNewWorkspaceCreateSubmit(args: { client: RpcClient | null repos: readonly MobileWorkspaceRepo[] @@ -115,9 +111,7 @@ export function useNewWorkspaceCreateSubmit(args: { let outcome: Parameters[0] = 'cancelled' try { if (admission === null) { - args.setError( - 'A worktree in this repository is still being created or checked. It shows in the folder once it lands.' - ) + args.setError(folderCreateBusyMessage()) return } if (args.sshGate.requiresConnection) { @@ -231,7 +225,7 @@ export function useNewWorkspaceCreateSubmit(args: { outcome = result.replayed ? 'uncertain' : 'failed' if (outcome === 'uncertain') { // Not a failure to retry: creating again could make a second one. - args.setError(folder ? UNCERTAIN_FOLDER_CREATE : UNCERTAIN_CREATE) + args.setError(uncertainCreateMessage(folder !== undefined)) return } if (presenting()) { @@ -251,7 +245,7 @@ export function useNewWorkspaceCreateSubmit(args: { outcome = isRpcDeliveryUnknown(error) ? 'uncertain' : 'failed' if (folder && outcome === 'uncertain') { // The folder screen refreshes and holds it until its list shows it; sending again could create a second one. - args.setError(UNCERTAIN_FOLDER_CREATE) + args.setError(uncertainCreateMessage(true)) return } if (presenting()) { diff --git a/mobile/src/i18n/en-runtime-required.json b/mobile/src/i18n/en-runtime-required.json index 4823302acd9..8b93c0f35a0 100644 --- a/mobile/src/i18n/en-runtime-required.json +++ b/mobile/src/i18n/en-runtime-required.json @@ -303,12 +303,12 @@ "uncommittedFiles_other": "{{count}} uncommitted" }, "failure": { - "forkOriginalMissing": "{{agent}} could not find this response in the original chat. Open it and fork from there.", - "forkOriginalUnavailable": "{{agent}} cannot fork this response in the original chat. Open it and fork from there.", - "forkOriginalMissingNamed": "{{agent}} could not find this response in \"{{detail}}\". Open that chat and fork from there.", - "forkOriginalUnavailableNamed": "{{agent}} cannot fork this response in \"{{detail}}\". Open that chat and fork from there.", "forkOriginalLatestOnly": "{{agent}} can only fork the latest response in the original chat. Open that chat and fork its latest response once it has finished.", "forkOriginalLatestOnlyNamed": "{{agent}} can only fork the latest response in \"{{detail}}\". Open that chat and fork its latest response once it has finished.", + "forkOriginalMissing": "{{agent}} could not find this response in the original chat. Open it and fork from there.", + "forkOriginalMissingNamed": "{{agent}} could not find this response in \"{{detail}}\". Open that chat and fork from there.", + "forkOriginalUnavailable": "{{agent}} cannot fork this response in the original chat. Open it and fork from there.", + "forkOriginalUnavailableNamed": "{{agent}} cannot fork this response in \"{{detail}}\". Open that chat and fork from there.", "pluginInputRequired": "{{agent}} stopped because the \"{{plugin}}\" plugin is waiting for input in a terminal pane. Disable the plugin for chat sessions, or run the task in a {{agent}} terminal." }, "fileReader": { diff --git a/mobile/src/i18n/locales/en.json b/mobile/src/i18n/locales/en.json index 8badeb51c66..fe22d8a6406 100644 --- a/mobile/src/i18n/locales/en.json +++ b/mobile/src/i18n/locales/en.json @@ -1430,6 +1430,11 @@ }, "offlineAsOfTime": { "yesterday": "yesterday, {{time}}" + }, + "newWorkspaceCreateSubmit": { + "uncertainFolderCreate": "This worktree may have been created. Check the folder before creating another.", + "uncertainCreate": "This workspace may have been created. Check your workspaces before creating another.", + "folderCreateBusy": "A worktree in this repository is still being created or checked. It shows in the folder once it lands." } }, "pullRequest": {