summaryrefslogtreecommitdiffhomepage
path: root/packages/desktop
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-03-25 06:25:57 -0500
committerAdam <[email protected]>2026-03-25 06:25:57 -0500
commit1041ae91d1a39401fe099747e3bc093bdcdaa079 (patch)
treeca5515910ad01f76639577ef8e3a991b644a5ade /packages/desktop
parent898456a25cf2edbfc4ae4961b37424f633419dd6 (diff)
downloadopencode-1041ae91d1a39401fe099747e3bc093bdcdaa079.tar.gz
opencode-1041ae91d1a39401fe099747e3bc093bdcdaa079.zip
Reapply "fix(app): startup efficiency"
This reverts commit 898456a25cf2edbfc4ae4961b37424f633419dd6.
Diffstat (limited to 'packages/desktop')
-rw-r--r--packages/desktop/src/index.tsx19
1 files changed, 17 insertions, 2 deletions
diff --git a/packages/desktop/src/index.tsx b/packages/desktop/src/index.tsx
index e67795644..5fe88d501 100644
--- a/packages/desktop/src/index.tsx
+++ b/packages/desktop/src/index.tsx
@@ -6,6 +6,9 @@ import {
AppBaseProviders,
AppInterface,
handleNotificationClick,
+ loadLocaleDict,
+ normalizeLocale,
+ type Locale,
type Platform,
PlatformProvider,
ServerConnection,
@@ -414,6 +417,17 @@ void listenForDeepLinks()
render(() => {
const platform = createPlatform()
+ const loadLocale = async () => {
+ const current = await platform.storage?.("opencode.global.dat").getItem("language")
+ const legacy = current ? undefined : await platform.storage?.().getItem("language.v1")
+ const raw = current ?? legacy
+ if (!raw) return
+ const locale = raw.match(/"locale"\s*:\s*"([^"]+)"/)?.[1]
+ if (!locale) return
+ const next = normalizeLocale(locale)
+ if (next !== "en") await loadLocaleDict(next)
+ return next satisfies Locale
+ }
// Fetch sidecar credentials from Rust (available immediately, before health check)
const [sidecar] = createResource(() => commands.awaitInitialization(new Channel<InitStep>() as any))
@@ -423,6 +437,7 @@ render(() => {
if (url) return ServerConnection.key({ type: "http", http: { url } })
}),
)
+ const [locale] = createResource(loadLocale)
// Build the sidecar server connection once credentials arrive
const servers = () => {
@@ -465,8 +480,8 @@ render(() => {
return (
<PlatformProvider value={platform}>
- <AppBaseProviders>
- <Show when={!defaultServer.loading && !sidecar.loading}>
+ <AppBaseProviders locale={locale.latest}>
+ <Show when={!defaultServer.loading && !sidecar.loading && !locale.loading}>
{(_) => {
return (
<AppInterface