Skip to content

Commit e40b050

Browse files
authored
Revert "Revert translation breaking behavior (anomalyco#1342)" (anomalyco#1348)
This reverts commit 1dd639b.
1 parent 1dd639b commit e40b050

27 files changed

Lines changed: 6831 additions & 1859 deletions

‎apps/app/src/app/components/mcp-auth-modal.tsx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export default function McpAuthModal(props: McpAuthModalProps) {
168168
statusPoll = window.setInterval(async () => {
169169
if (Date.now() - startedAt >= MCP_AUTH_TIMEOUT_MS) {
170170
stopStatusPolling();
171-
setError("Request timed out.");
171+
setError(translate("mcp.auth.request_timed_out"));
172172
return;
173173
}
174174

@@ -694,7 +694,7 @@ export default function McpAuthModal(props: McpAuthModalProps) {
694694
<CheckCircle2 size={24} class="text-green-11" />
695695
</div>
696696
<div>
697-
<p class="text-sm font-medium text-gray-12">Already Connected</p>
697+
<p class="text-sm font-medium text-gray-12">{translate("mcp.auth.already_connected")}</p>
698698
<p class="text-xs text-gray-11">
699699
{translate("mcp.auth.already_connected_description", { server: serverName() })}
700700
</p>
@@ -804,7 +804,7 @@ export default function McpAuthModal(props: McpAuthModalProps) {
804804
</div>
805805
<div class="rounded-xl border border-gray-6/70 bg-gray-2/40 px-3 py-2 flex items-center gap-3">
806806
<div class="flex-1 min-w-0">
807-
<div class="text-[10px] uppercase tracking-wide text-gray-8">Authorization link</div>
807+
<div class="text-[10px] uppercase tracking-wide text-gray-8">{translate("mcp.auth.authorization_link")}</div>
808808
<div class="text-[11px] text-gray-11 font-mono truncate">
809809
{authorizationUrl()}
810810
</div>
@@ -814,7 +814,7 @@ export default function McpAuthModal(props: McpAuthModalProps) {
814814
class="text-xs"
815815
onClick={handleCopyAuthorizationUrl}
816816
>
817-
{authUrlCopied() ? "Copied" : "Copy link"}
817+
{authUrlCopied() ? translate("mcp.auth.copied") : translate("mcp.auth.copy_link")}
818818
</Button>
819819
</div>
820820
<TextInput
@@ -851,7 +851,7 @@ export default function McpAuthModal(props: McpAuthModalProps) {
851851
1
852852
</div>
853853
<div>
854-
<p class="text-sm font-medium text-gray-12">Opening your browser</p>
854+
<p class="text-sm font-medium text-gray-12">{translate("mcp.auth.step1_title")}</p>
855855
<p class="text-xs text-gray-10 mt-1">
856856
{translate("mcp.auth.step1_description", { server: serverName() })}
857857
</p>
@@ -863,7 +863,7 @@ export default function McpAuthModal(props: McpAuthModalProps) {
863863
2
864864
</div>
865865
<div>
866-
<p class="text-sm font-medium text-gray-12">Authorize OpenWork</p>
866+
<p class="text-sm font-medium text-gray-12">{translate("mcp.auth.step2_title")}</p>
867867
<p class="text-xs text-gray-10 mt-1">
868868
{translate("mcp.auth.step2_description")}
869869
</p>
@@ -875,7 +875,7 @@ export default function McpAuthModal(props: McpAuthModalProps) {
875875
3
876876
</div>
877877
<div>
878-
<p class="text-sm font-medium text-gray-12">Return here when you're done</p>
878+
<p class="text-sm font-medium text-gray-12">{translate("mcp.auth.step3_title")}</p>
879879
<p class="text-xs text-gray-10 mt-1">
880880
{translate("mcp.auth.step3_description")}
881881
</p>

‎apps/app/src/app/components/question-modal.tsx‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { QuestionInfo } from "@opencode-ai/sdk/v2/client";
44
import { Check, ChevronRight, HelpCircle } from "lucide-solid";
55

66
import Button from "./button";
7+
import { t } from "../../i18n";
78

89
export type QuestionModalProps = {
910
open: boolean;
@@ -138,10 +139,10 @@ export default function QuestionModal(props: QuestionModalProps) {
138139
</div>
139140
<div>
140141
<h3 class="text-lg font-semibold text-gray-12">
141-
{currentQuestion()!.header || "Question"}
142+
{currentQuestion()!.header || t("common.question")}
142143
</h3>
143144
<div class="text-xs text-gray-11 font-medium">
144-
Question {currentIndex() + 1} of {props.questions.length}
145+
{t("question_modal.question_counter", undefined, { current: currentIndex() + 1, total: props.questions.length })}
145146
</div>
146147
</div>
147148
</div>
@@ -186,14 +187,14 @@ export default function QuestionModal(props: QuestionModalProps) {
186187
<Show when={currentQuestion()!.custom}>
187188
<div class="mt-4 pt-4 border-t border-dls-border">
188189
<label class="block text-xs font-semibold text-dls-secondary mb-2 uppercase tracking-wide">
189-
Or type a custom answer
190+
{t("question_modal.custom_answer_label")}
190191
</label>
191192
<input
192193
type="text"
193194
value={customInput()}
194195
onInput={(e) => setCustomInput(e.currentTarget.value)}
195196
class="w-full px-4 py-3 rounded-xl bg-dls-surface border border-dls-border focus:border-dls-accent focus:ring-4 focus:ring-[rgba(var(--dls-accent-rgb),0.2)] focus:outline-none text-sm text-dls-text placeholder:text-dls-secondary transition-shadow"
196-
placeholder="Type your answer here..."
197+
placeholder={t("question_modal.custom_answer_placeholder")}
197198
onKeyDown={(e) => {
198199
if (e.key === "Enter") {
199200
if (e.isComposing || e.keyCode === 229) return;
@@ -209,15 +210,15 @@ export default function QuestionModal(props: QuestionModalProps) {
209210
<div class="p-6 border-t border-dls-border bg-dls-hover flex justify-between items-center">
210211
<div class="text-xs text-dls-secondary flex items-center gap-2">
211212
<span class="px-1.5 py-0.5 rounded border border-dls-border bg-dls-active font-mono">↑↓</span>
212-
<span>navigate</span>
213+
<span>{t("common.navigate")}</span>
213214
<span class="px-1.5 py-0.5 rounded border border-gray-6 bg-gray-3 font-mono ml-2">↵</span>
214-
<span>select</span>
215+
<span>{t("common.select")}</span>
215216
</div>
216217

217218
<div class="flex gap-2">
218219
<Show when={currentQuestion()?.multiple || currentQuestion()?.custom}>
219220
<Button onClick={handleNext} disabled={!canProceed() || props.busy} class="!px-6">
220-
{isLastQuestion() ? "Submit" : "Next"}
221+
{isLastQuestion() ? t("common.submit") : t("common.next")}
221222
<Show when={!isLastQuestion()}>
222223
<ChevronRight size={16} class="ml-1 -mr-1 opacity-60" />
223224
</Show>

‎apps/app/src/app/components/session/composer.tsx‎

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ComposerNotice, { type ComposerNotice as ComposerNoticeData } from "./com
77

88
import type { ComposerAttachment, ComposerDraft, ComposerPart, PromptMode, SlashCommandOption } from "../../types";
99
import { perfNow, recordPerfLog } from "../../lib/perf-log";
10+
import { t } from "../../../i18n";
1011

1112
type MentionOption = {
1213
id: string;
@@ -516,7 +517,7 @@ export default function Composer(props: ComposerProps) {
516517
span.dataset.pasteId = part.id;
517518
span.dataset.pasteLabel = part.label;
518519
span.dataset.pasteLines = String(part.lines);
519-
span.title = "Click to expand pasted text";
520+
span.title = t("composer.expand_pasted");
520521
span.className =
521522
"inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold bg-gray-3 text-gray-10 border border-gray-6 cursor-pointer hover:bg-gray-4 hover:text-gray-11";
522523
return span;
@@ -1058,7 +1059,7 @@ export default function Composer(props: ComposerProps) {
10581059
const addAttachments = async (files: File[]) => {
10591060
if (attachmentsDisabled()) {
10601061
props.onNotice({
1061-
title: props.attachmentsDisabledReason ?? "Attachments are unavailable.",
1062+
title: props.attachmentsDisabledReason ?? t("composer.attachments_unavailable"),
10621063
tone: "warning",
10631064
});
10641065
return;
@@ -1078,7 +1079,7 @@ export default function Composer(props: ComposerProps) {
10781079
for (const file of supportedFiles) {
10791080
if (file.size > MAX_ATTACHMENT_BYTES) {
10801081
props.onNotice({
1081-
title: `${file.name} exceeds the 8MB limit.`,
1082+
title: t("composer.file_exceeds_limit", undefined, { name: file.name }),
10821083
tone: "warning",
10831084
});
10841085
continue;
@@ -1089,7 +1090,7 @@ export default function Composer(props: ComposerProps) {
10891090
const estimatedJsonBytes = estimateInlineAttachmentBytes(processed);
10901091
if (estimatedJsonBytes > MAX_ATTACHMENT_BYTES) {
10911092
props.onNotice({
1092-
title: `${file.name} is too large after encoding. Try a smaller image.`,
1093+
title: t("composer.file_too_large_encoding", undefined, { name: file.name }),
10931094
tone: "warning",
10941095
});
10951096
continue;
@@ -1105,7 +1106,7 @@ export default function Composer(props: ComposerProps) {
11051106
});
11061107
} catch (error) {
11071108
props.onNotice({
1108-
title: error instanceof Error ? error.message : "Failed to read attachment",
1109+
title: error instanceof Error ? error.message : t("composer.failed_read_attachment"),
11091110
tone: "error",
11101111
});
11111112
}
@@ -1221,29 +1222,29 @@ export default function Composer(props: ComposerProps) {
12211222
props.onNotice({
12221223
title:
12231224
links.length === 1
1224-
? `Uploaded ${links[0].name} to the shared folder and inserted a link.`
1225-
: `Uploaded ${links.length} files to the shared folder and inserted links.`,
1225+
? t("composer.uploaded_single_file", undefined, { name: links[0].name })
1226+
: t("composer.uploaded_multiple_files", undefined, { count: links.length }),
12261227
tone: "success",
12271228
});
12281229
return;
12291230
}
12301231
}
12311232
props.onNotice({
1232-
title: "Couldn't upload to the shared folder. Inserted local links instead.",
1233+
title: t("composer.upload_failed_local_links"),
12331234
tone: "warning",
12341235
});
12351236
}
12361237

12371238
const text = formatLinks(fallbackLinks());
12381239
if (!text) {
1239-
props.onNotice({ title: "Unsupported attachment type.", tone: "warning" });
1240+
props.onNotice({ title: t("composer.unsupported_attachment_type"), tone: "warning" });
12401241
return;
12411242
}
12421243
insertPlainTextAtSelection(text);
12431244
updateMentionQuery();
12441245
updateSlashQuery();
12451246
emitDraftChange();
1246-
props.onNotice({ title: "Inserted links for unsupported files.", tone: "info" });
1247+
props.onNotice({ title: t("composer.inserted_links_unsupported"), tone: "info" });
12471248
};
12481249

12491250
const handlePaste = (event: ClipboardEvent) => {
@@ -1277,10 +1278,9 @@ export default function Composer(props: ComposerProps) {
12771278
const hasAbsoluteWindows = /(^|\s)[a-zA-Z]:\\/.test(trimmedForCheck);
12781279
if (hasFileUrl || hasAbsolutePosix || hasAbsoluteWindows) {
12791280
props.onNotice({
1280-
title:
1281-
"This is a remote worker. Sandboxes are remote too. To share files with it, upload them to the Shared folder in the sidebar.",
1281+
title: t("composer.remote_worker_paste_warning"),
12821282
tone: "warning",
1283-
actionLabel: props.onUploadInboxFiles ? "Upload to shared folder" : undefined,
1283+
actionLabel: props.onUploadInboxFiles ? t("composer.upload_to_shared_folder") : undefined,
12841284
onAction: props.onUploadInboxFiles ? () => inboxFileInputRef?.click() : undefined,
12851285
});
12861286
}
@@ -1572,7 +1572,7 @@ export default function Composer(props: ComposerProps) {
15721572
<div class="max-h-64 overflow-y-auto bg-dls-surface p-2" onMouseDown={(event: MouseEvent) => event.preventDefault()}>
15731573
<Show
15741574
when={mentionVisible().length}
1575-
fallback={<div class="px-3 py-2 text-xs text-gray-10">No matches found.</div>}
1575+
fallback={<div class="px-3 py-2 text-xs text-gray-10">{t("composer.no_matches")}</div>}
15761576
>
15771577
<For each={mentionVisible()}>
15781578
{(option: MentionOption) => {
@@ -1635,7 +1635,7 @@ export default function Composer(props: ComposerProps) {
16351635
when={slashFiltered().length}
16361636
fallback={
16371637
<div class="px-3 py-2 text-xs text-gray-10">
1638-
{slashLoading() ? "Loading commands..." : "No commands found."}
1638+
{slashLoading() ? t("composer.loading_commands") : t("composer.no_commands")}
16391639
</div>
16401640
}
16411641
>
@@ -1662,7 +1662,7 @@ export default function Composer(props: ComposerProps) {
16621662
</div>
16631663
<Show when={cmd.source && cmd.source !== "command"}>
16641664
<span class="text-[10px] uppercase tracking-wider text-gray-10 shrink-0">
1665-
{cmd.source === "skill" ? "Skill" : cmd.source === "mcp" ? "MCP" : ""}
1665+
{cmd.source === "skill" ? t("composer.skill_source") : cmd.source === "mcp" ? "MCP" : ""}
16661666
</span>
16671667
</Show>
16681668
</button>
@@ -1697,7 +1697,7 @@ export default function Composer(props: ComposerProps) {
16971697
<div class="max-w-[160px]">
16981698
<div class="truncate text-gray-11">{attachment.name}</div>
16991699
<div class="text-[10px] text-gray-10">
1700-
{attachment.kind === "image" ? "Image" : attachment.mimeType || "File"}
1700+
{attachment.kind === "image" ? t("composer.image_kind") : attachment.mimeType || t("composer.file_kind")}
17011701
</div>
17021702
</div>
17031703
<button
@@ -1721,7 +1721,7 @@ export default function Composer(props: ComposerProps) {
17211721
<div class="relative">
17221722
<Show when={!hasDraftContent()}>
17231723
<div class="absolute left-0 top-0 text-gray-9 text-[15px] leading-relaxed pointer-events-none">
1724-
Describe your task...
1724+
{t("composer.placeholder")}
17251725
</div>
17261726
</Show>
17271727
<div
@@ -1775,8 +1775,8 @@ export default function Composer(props: ComposerProps) {
17751775
disabled={attachmentsDisabled()}
17761776
title={
17771777
attachmentsDisabled()
1778-
? props.attachmentsDisabledReason ?? "Attachments are unavailable."
1779-
: "Attach files"
1778+
? props.attachmentsDisabledReason ?? t("composer.attachments_unavailable")
1779+
: t("composer.attach_files")
17801780
}
17811781
>
17821782
<Paperclip size={16} />
@@ -1794,21 +1794,21 @@ export default function Composer(props: ComposerProps) {
17941794
? "bg-gray-4 text-gray-10"
17951795
: "bg-dls-accent text-white hover:bg-[var(--dls-accent-hover)]"
17961796
}`}
1797-
title="Run task"
1797+
title={t("composer.run_task")}
17981798
>
17991799
<ArrowUp size={15} />
1800-
<span>Run task</span>
1800+
<span>{t("composer.run_task")}</span>
18011801
</button>
18021802
}
18031803
>
18041804
<button
18051805
type="button"
18061806
onClick={() => props.onStop()}
18071807
class="inline-flex items-center gap-2 rounded-full bg-gray-12 px-4 py-2 text-[13px] font-medium text-gray-1 transition-colors hover:bg-gray-11"
1808-
title="Stop"
1808+
title={t("composer.stop")}
18091809
>
18101810
<Square size={12} fill="currentColor" />
1811-
<span>Stop</span>
1811+
<span>{t("composer.stop")}</span>
18121812
</button>
18131813
</Show>
18141814
</div>
@@ -1829,7 +1829,7 @@ export default function Composer(props: ComposerProps) {
18291829
onClick={props.onToggleAgentPicker}
18301830
disabled={props.busy}
18311831
aria-expanded={props.agentPickerOpen}
1832-
title="Agent"
1832+
title={t("composer.agent_label")}
18331833
>
18341834
<span class="max-w-[140px] truncate">{props.agentLabel}</span>
18351835
<ChevronDown size={13} />
@@ -1838,14 +1838,14 @@ export default function Composer(props: ComposerProps) {
18381838
<Show when={props.agentPickerOpen}>
18391839
<div class="absolute left-0 bottom-full z-40 mb-2 w-64 overflow-hidden rounded-[18px] border border-dls-border bg-dls-surface shadow-[var(--dls-shell-shadow)]">
18401840
<div class="border-b border-dls-border px-3 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-[0.2em] text-gray-10">
1841-
Agent
1841+
{t("composer.agent_label")}
18421842
</div>
18431843

18441844
<div class="p-2 space-y-1 max-h-64 overflow-y-auto" onMouseDown={(event: MouseEvent) => event.preventDefault()}>
18451845
<Show
18461846
when={!props.agentPickerBusy}
18471847
fallback={
1848-
<div class="px-3 py-2 text-xs text-gray-10">Loading agents...</div>
1848+
<div class="px-3 py-2 text-xs text-gray-10">{t("composer.loading_agents")}</div>
18491849
}
18501850
>
18511851
<Show when={!props.agentPickerError}>
@@ -1860,7 +1860,7 @@ export default function Composer(props: ComposerProps) {
18601860
props.onSelectAgent(null);
18611861
}}
18621862
>
1863-
<span>Default agent</span>
1863+
<span>{t("composer.default_agent")}</span>
18641864
<Show when={!props.selectedAgent}>
18651865
<Check size={14} class="text-gray-10" />
18661866
</Show>
@@ -1931,7 +1931,7 @@ export default function Composer(props: ComposerProps) {
19311931
<Show when={variantMenuOpen()}>
19321932
<div class="absolute left-0 bottom-full z-40 mb-2 w-48 overflow-hidden rounded-[18px] border border-dls-border bg-dls-surface shadow-[var(--dls-shell-shadow)]">
19331933
<div class="border-b border-dls-border px-3 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-[0.2em] text-gray-10">
1934-
Behavior
1934+
{t("composer.behavior_label")}
19351935
</div>
19361936
<div class="p-2 space-y-1">
19371937
<For each={props.modelBehaviorOptions}>

0 commit comments

Comments
 (0)