From 76aa2491d942380871b5c73771c001263899fca0 Mon Sep 17 00:00:00 2001 From: Tim Biggs Date: Wed, 18 Nov 2026 16:10:23 +0000 Subject: [PATCH 1/4] fix(fork): translate fork feature copy Upstream's new t3code/no-untranslated-copy rule flags the English copy in fork-only features, so the pre-commit lint fails on those files. Wrap that copy with gt(), and msg() and translate it into every app locale. Shell input and the device name sent to the push host stay English with a disable comment. The power state hooks also get reasons for their effects, and a stale eslint directive goes, since the hook lints the whole file. Co-Authored-By: Claude Opus 5.5 --- .../connection/ConnectionsNewRouteScreen.tsx | 13 +- .../device-runtime/AgentAccessRouteScreen.tsx | 63 +++-- .../DeviceRuntimeSetupScreen.tsx | 189 ++++++++----- .../features/device-runtime/device-runtime.ts | 7 +- .../fork-push/ForkPushSettingsSection.tsx | 69 +++-- .../src/features/fork-push/registrar.ts | 9 +- .../features/phone/PhoneFolderShortcuts.tsx | 21 +- .../src/features/phone/PhoneServerChip.tsx | 15 +- .../phone/PhoneServerSettingsSection.tsx | 46 +-- .../features/phone/PhoneSetupRouteScreen.tsx | 6 +- .../features/phone/PhoneSharingSection.tsx | 173 ++++++++---- apps/mobile/src/features/phone/SetupStep.tsx | 11 +- .../phone/confirmPhoneServerReplacement.ts | 16 +- .../phone/phone-sharing-controller.ts | 30 +- .../features/power/EnvironmentPowerChips.tsx | 12 +- .../power/EnvironmentPowerSettingsSection.tsx | 59 ++-- .../features/power/EnvironmentPowerSheet.tsx | 53 ++-- .../power/environment-power-commands.ts | 11 +- .../features/power/environment-power-state.ts | 10 +- .../src/features/power/environment-power.ts | 43 +-- .../features/settings/SettingsRouteScreen.tsx | 2 +- apps/mobile/src/i18n/translations/de.json | 261 +++++++++++++++++- apps/mobile/src/i18n/translations/en.json | 261 +++++++++++++++++- apps/mobile/src/i18n/translations/es.json | 261 +++++++++++++++++- apps/mobile/src/i18n/translations/fr.json | 261 +++++++++++++++++- apps/mobile/src/i18n/translations/ja.json | 261 +++++++++++++++++- apps/mobile/src/i18n/translations/ko.json | 261 +++++++++++++++++- apps/mobile/src/i18n/translations/pt-BR.json | 261 +++++++++++++++++- apps/mobile/src/i18n/translations/ru.json | 261 +++++++++++++++++- apps/mobile/src/i18n/translations/sv.json | 261 +++++++++++++++++- apps/mobile/src/i18n/translations/zh.json | 261 +++++++++++++++++- .../state/use-remote-environment-registry.ts | 44 ++- apps/web/src/components/chat/ChatComposer.tsx | 4 +- apps/web/src/i18n/translations/de.json | 2 + apps/web/src/i18n/translations/en.json | 2 + apps/web/src/i18n/translations/es.json | 2 + apps/web/src/i18n/translations/fr.json | 2 + apps/web/src/i18n/translations/ja.json | 2 + apps/web/src/i18n/translations/ko.json | 2 + apps/web/src/i18n/translations/pt-BR.json | 2 + apps/web/src/i18n/translations/ru.json | 2 + apps/web/src/i18n/translations/sv.json | 2 + apps/web/src/i18n/translations/zh.json | 2 + 43 files changed, 3115 insertions(+), 421 deletions(-) diff --git a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx index 55b1c26bc465..39b139652c07 100644 --- a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx +++ b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx @@ -422,20 +422,21 @@ function PhoneSection() { ); const [supported] = useState(supportsDeviceRuntime); const rippleStyle = useResolveClassNames("bg-subtle-strong"); + const gt = useGT(); const description = !supported - ? "Needs a 64-bit phone" + ? gt("Needs a 64-bit phone") : phone - ? `Set up as ${phone.environmentLabel}` - : "Claude Code on this phone, no other computer needed"; + ? gt("Set up as {name}", { name: phone.environmentLabel }) + : gt("Claude Code on this phone, no other computer needed"); return ( - Or run on this phone + Or run on this phone - Run agents on this phone + Run agents on this phone {description} diff --git a/apps/mobile/src/features/device-runtime/AgentAccessRouteScreen.tsx b/apps/mobile/src/features/device-runtime/AgentAccessRouteScreen.tsx index 6628d2ee00e6..5a9609ab0f58 100644 --- a/apps/mobile/src/features/device-runtime/AgentAccessRouteScreen.tsx +++ b/apps/mobile/src/features/device-runtime/AgentAccessRouteScreen.tsx @@ -1,3 +1,4 @@ +import { msg, T, useGT, useMessages } from "gt-react-native"; import { useCallback, useEffect, useState } from "react"; import { AppState, Linking, PermissionsAndroid } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; @@ -12,18 +13,18 @@ import { deviceRuntime, type AgentAccessCategory, type AgentAccessPolicy } from const CATEGORIES: Readonly> = { - location: { label: "Location", commands: "termux-location, termux-telephony-cellinfo" }, - camera: { label: "Camera", commands: "termux-camera-photo" }, - microphone: { label: "Microphone", commands: "termux-microphone-record" }, - contacts: { label: "Contacts", commands: "termux-contact-list" }, - sms: { label: "Text messages", commands: "termux-sms-list, termux-sms-send" }, - "call-log": { label: "Call log", commands: "termux-call-log" }, + location: { label: msg("Location"), commands: "termux-location, termux-telephony-cellinfo" }, + camera: { label: msg("Camera"), commands: "termux-camera-photo" }, + microphone: { label: msg("Microphone"), commands: "termux-microphone-record" }, + contacts: { label: msg("Contacts"), commands: "termux-contact-list" }, + sms: { label: msg("Text messages"), commands: "termux-sms-list, termux-sms-send" }, + "call-log": { label: msg("Call log"), commands: "termux-call-log" }, phone: { - label: "Phone calls and device info", + label: msg("Phone calls and device info"), commands: "termux-telephony-call, termux-telephony-deviceinfo", }, - notifications: { label: "Notifications", commands: "termux-notification-list" }, - apps: { label: "Other apps", commands: "am (also termux-am), pm" }, + notifications: { label: msg("Notifications"), commands: "termux-notification-list" }, + apps: { label: msg("Other apps"), commands: "am (also termux-am), pm" }, }; const POLICIES: ReadonlyArray<{ @@ -33,11 +34,19 @@ const POLICIES: ReadonlyArray<{ }> = [ { policy: "ask", - label: "Ask each time", - description: "This phone asks you before each command runs.", + label: msg("Ask each time"), + description: msg("This phone asks you before each command runs."), + }, + { + policy: "allow", + label: msg("Always allow"), + description: msg("Agents use it without asking."), + }, + { + policy: "deny", + label: msg("Never", { $context: "agent access policy" }), + description: msg("These commands are refused."), }, - { policy: "allow", label: "Always allow", description: "Agents use it without asking." }, - { policy: "deny", label: "Never", description: "These commands are refused." }, ]; /** Asks Android for what a category needs; notification access is a system settings page. */ @@ -60,6 +69,8 @@ function requestAndroidAccess(category: AgentAccessCategory): Promise { /** Settings → Agent access: what agents on this phone may reach through Android. */ export function AgentAccessRouteScreen() { const insets = useSafeAreaInsets(); + const gt = useGT(); + const m = useMessages(); const read = useCallback(() => deviceRuntime?.getAgentAccess() ?? [], []); const [categories, setCategories] = useState(read); // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- re-reads grants made in Android's settings @@ -79,7 +90,7 @@ export function AgentAccessRouteScreen() { }; return ( - + - Agents on this phone reach Android through termux-* commands. These need your say: with - Ask each time, this phone asks you before each one runs, even when another device started - it. Nobody answering within a minute counts as no. This covers those commands. It isn't a - hard barrier against someone using a terminal on this phone's server. + + Agents on this phone reach Android through termux-* commands. These need your say: with + Ask each time, this phone asks you before each one runs, even when another device + started it. Nobody answering within a minute counts as no. This covers those commands. + It isn't a hard barrier against someone using a terminal on this phone's server. + {categories.map((category) => { const meta = CATEGORIES[category.id]; @@ -98,20 +111,22 @@ export function AgentAccessRouteScreen() { return ( {POLICIES.map((choice, index) => ( 0} onPress={() => choose(category, choice.policy)} @@ -120,7 +135,7 @@ export function AgentAccessRouteScreen() { {category.policy !== "deny" && !category.granted ? ( void requestAndroidAccess(category).then(() => setCategories(read())) } diff --git a/apps/mobile/src/features/device-runtime/DeviceRuntimeSetupScreen.tsx b/apps/mobile/src/features/device-runtime/DeviceRuntimeSetupScreen.tsx index 6474e766ba18..e35408ca5585 100644 --- a/apps/mobile/src/features/device-runtime/DeviceRuntimeSetupScreen.tsx +++ b/apps/mobile/src/features/device-runtime/DeviceRuntimeSetupScreen.tsx @@ -1,4 +1,5 @@ import { useFocusEffect, useNavigation } from "@react-navigation/native"; +import { msg, T, useGT, useMessages } from "gt-react-native"; import { useCallback, useEffect, useState, type ReactNode } from "react"; import { Linking, PermissionsAndroid, Platform, View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; @@ -35,9 +36,9 @@ type StepId = "install" | "signIn" | "connect"; const STEPS: ReadonlyArray = ["install", "signIn", "connect"]; const STEP_TITLES: Record = { - install: "Install Ubuntu, Claude Code and T3 Code", - signIn: "Sign in to Claude", - connect: "Connect this phone", + install: msg("Install Ubuntu, Claude Code and T3 Code"), + signIn: msg("Sign in to Claude"), + connect: msg("Connect this phone"), }; /** Progress shows in a notification while T3 Code is in the background; Android 13+ asks first. */ @@ -71,6 +72,8 @@ function errorText(error: unknown, fallback: string): string { export function DeviceRuntimeSetupScreen() { const native = requireDeviceRuntime(); const navigation = useNavigation(); + const gt = useGT(); + const m = useMessages(); const insets = useSafeAreaInsets(); const { status, refresh } = useDeviceRuntimeStatus(); const [inspection, setInspection] = useState(null); @@ -91,8 +94,10 @@ export function DeviceRuntimeSetupScreen() { } inspectDeviceRuntime() .then(setInspection) - .catch((cause: unknown) => setError(errorText(cause, "Couldn't check the installation."))); - }, [native]); + .catch((cause: unknown) => + setError(errorText(cause, gt("Couldn't check the installation."))), + ); + }, [native, gt]); useFocusEffect( useCallback(() => { @@ -134,7 +139,7 @@ export function DeviceRuntimeSetupScreen() { setBusy(label); setError(null); return action() - .catch((cause: unknown) => setError(errorText(cause, "That didn't finish."))) + .catch((cause: unknown) => setError(errorText(cause, gt("That didn't finish.")))) .then(() => { setBusy(null); refresh(); @@ -153,12 +158,14 @@ export function DeviceRuntimeSetupScreen() { }; const reinstall = () => Dialog.alert( - "Reinstall?", - "Deletes Ubuntu with everything in it, including the threads and Claude sign-in on this phone, then installs it again.", + gt("Reinstall?"), + gt( + "Deletes Ubuntu with everything in it, including the threads and Claude sign-in on this phone, then installs it again.", + ), [ - { text: "Cancel", style: "cancel" }, + { text: gt("Cancel"), style: "cancel" }, { - text: "Reinstall", + text: gt("Reinstall"), style: "destructive", onPress: () => void run("install", async () => { @@ -175,12 +182,14 @@ export function DeviceRuntimeSetupScreen() { ); const remove = () => Dialog.alert( - "Remove from this phone?", - "Stops the server and deletes Ubuntu with everything in it, including the threads and Claude sign-in on this phone.", + gt("Remove from this phone?"), + gt( + "Stops the server and deletes Ubuntu with everything in it, including the threads and Claude sign-in on this phone.", + ), [ - { text: "Cancel", style: "cancel" }, + { text: gt("Cancel"), style: "cancel" }, { - text: "Remove", + text: gt("Remove"), style: "destructive", onPress: () => void run("remove", async () => { @@ -189,7 +198,7 @@ export function DeviceRuntimeSetupScreen() { await stopPhoneServerWhenSettled(); await native.remove(); await forgetDeviceServer(); - if (stillListed) Dialog.alert("Removed from this phone", stillListed); + if (stillListed) Dialog.alert(gt("Removed from this phone"), stillListed); navigation.goBack(); }), }, @@ -203,10 +212,12 @@ export function DeviceRuntimeSetupScreen() { : undefined, signIn: inspection?.claudeSignedIn ? inspection.claudePlan - ? `Signed in · ${inspection.claudePlan}` - : "Signed in" + ? gt("Signed in · {plan}", { plan: inspection.claudePlan }) + : gt("Signed in") + : undefined, + connect: environment + ? gt("Connected as {environment}", { environment: environment.environmentLabel }) : undefined, - connect: environment ? `Connected as ${environment.environmentLabel}` : undefined, }; const body: Record = { install: ( @@ -225,9 +236,11 @@ export function DeviceRuntimeSetupScreen() { ), connect: ( <> - Starts T3 Code's server on this phone and adds it to your environments. + + Starts T3 Code's server on this phone and adds it to your environments. +