From 7a359ff67c7e5cd86b638d8512e023ad2cf16b86 Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Tue, 20 Jan 2026 09:38:18 -0600 Subject: wip(app): i18n --- .../app/src/components/dialog-connect-provider.tsx | 82 +++++++++++++--------- 1 file changed, 47 insertions(+), 35 deletions(-) (limited to 'packages/app/src/components') diff --git a/packages/app/src/components/dialog-connect-provider.tsx b/packages/app/src/components/dialog-connect-provider.tsx index 789a5d3b7..fa72ccef3 100644 --- a/packages/app/src/components/dialog-connect-provider.tsx +++ b/packages/app/src/components/dialog-connect-provider.tsx @@ -14,6 +14,7 @@ import { iife } from "@opencode-ai/util/iife" import { createMemo, Match, onCleanup, onMount, Switch } from "solid-js" import { createStore, produce } from "solid-js/store" import { Link } from "@/components/link" +import { useLanguage } from "@/context/language" import { useGlobalSDK } from "@/context/global-sdk" import { useGlobalSync } from "@/context/global-sync" import { usePlatform } from "@/context/platform" @@ -25,6 +26,7 @@ export function DialogConnectProvider(props: { provider: string }) { const globalSync = useGlobalSync() const globalSDK = useGlobalSDK() const platform = usePlatform() + const language = useLanguage() const provider = createMemo(() => globalSync.data.provider.all.find((x) => x.id === props.provider)!) const methods = createMemo( () => @@ -44,6 +46,12 @@ export function DialogConnectProvider(props: { provider: string }) { const method = createMemo(() => (store.methodIndex !== undefined ? methods().at(store.methodIndex!) : undefined)) + const methodLabel = (value?: { type?: string; label?: string }) => { + if (!value) return "" + if (value.type === "api") return language.t("provider.connect.method.apiKey") + return value.label ?? "" + } + async function selectMethod(index: number) { const method = methods()[index] setStore( @@ -112,8 +120,8 @@ export function DialogConnectProvider(props: { provider: string }) { showToast({ variant: "success", icon: "circle-check", - title: `${provider().name} connected`, - description: `${provider().name} models are now available to use.`, + title: language.t("provider.connect.toast.connected.title", { provider: provider().name }), + description: language.t("provider.connect.toast.connected.description", { provider: provider().name }), }) } @@ -142,16 +150,18 @@ export function DialogConnectProvider(props: { provider: string }) {
- Login with Claude Pro/Max + {language.t("provider.connect.title.anthropicProMax")} - Connect {provider().name} + {language.t("provider.connect.title", { provider: provider().name })}
-
Select login method for {provider().name}.
+
+ {language.t("provider.connect.selectMethod", { provider: provider().name })} +
{ @@ -169,7 +179,7 @@ export function DialogConnectProvider(props: { provider: string }) {
- {i.label} + {methodLabel(i)}
)}
@@ -179,7 +189,7 @@ export function DialogConnectProvider(props: { provider: string }) {
- Authorization in progress... + {language.t("provider.connect.status.inProgress")}
@@ -187,7 +197,7 @@ export function DialogConnectProvider(props: { provider: string }) {
- Authorization failed: {store.error} + {language.t("provider.connect.status.failed", { error: store.error ?? "" })}
@@ -206,7 +216,7 @@ export function DialogConnectProvider(props: { provider: string }) { const apiKey = formData.get("apiKey") as string if (!apiKey?.trim()) { - setFormStore("error", "API key is required") + setFormStore("error", language.t("provider.connect.apiKey.required")) return } @@ -226,26 +236,20 @@ export function DialogConnectProvider(props: { provider: string }) {
+
{language.t("provider.connect.opencodeZen.line1")}
+
{language.t("provider.connect.opencodeZen.line2")}
- OpenCode Zen gives you access to a curated set of reliable optimized models for coding - agents. -
-
- With a single API key you'll get access to models such as Claude, GPT, Gemini, GLM and more. -
-
- Visit{" "} + {language.t("provider.connect.opencodeZen.visit.prefix")} opencode.ai/zen - {" "} - to collect your API key. + + {language.t("provider.connect.opencodeZen.visit.suffix")}
- Enter your {provider().name} API key to connect your account and use {provider().name} models - in OpenCode. + {language.t("provider.connect.apiKey.description", { provider: provider().name })}
@@ -253,8 +257,8 @@ export function DialogConnectProvider(props: { provider: string }) {
@@ -292,7 +296,7 @@ export function DialogConnectProvider(props: { provider: string }) { const code = formData.get("code") as string if (!code?.trim()) { - setFormStore("error", "Authorization code is required") + setFormStore("error", language.t("provider.connect.oauth.code.required")) return } @@ -306,21 +310,22 @@ export function DialogConnectProvider(props: { provider: string }) { await complete() return } - setFormStore("error", "Invalid authorization code") + setFormStore("error", language.t("provider.connect.oauth.code.invalid")) } return (
- Visit this link to collect your authorization - code to connect your account and use {provider().name} models in OpenCode. + {language.t("provider.connect.oauth.code.visit.prefix")} + {language.t("provider.connect.oauth.code.visit.link")} + {language.t("provider.connect.oauth.code.visit.suffix", { provider: provider().name })}
@@ -361,13 +366,20 @@ export function DialogConnectProvider(props: { provider: string }) { return (
- Visit this link and enter the code below to - connect your account and use {provider().name} models in OpenCode. + {language.t("provider.connect.oauth.auto.visit.prefix")} + {language.t("provider.connect.oauth.auto.visit.link")} + {language.t("provider.connect.oauth.auto.visit.suffix", { provider: provider().name })}
- +
- Waiting for authorization... + {language.t("provider.connect.status.waiting")}
) -- cgit v1.2.3