wip(app): i18n

This commit is contained in:
Adam
2026-01-20 10:10:43 -06:00
parent 7a359ff67c
commit 7e8e4d9938
5 changed files with 195 additions and 94 deletions

View File

@@ -4,6 +4,7 @@ import { Portal } from "solid-js/web"
import { useParams } from "@solidjs/router"
import { useLayout } from "@/context/layout"
import { useCommand } from "@/context/command"
import { useLanguage } from "@/context/language"
// import { useServer } from "@/context/server"
// import { useDialog } from "@opencode-ai/ui/context/dialog"
import { usePlatform } from "@/context/platform"
@@ -29,6 +30,7 @@ export function SessionHeader() {
// const dialog = useDialog()
const sync = useSync()
const platform = usePlatform()
const language = useLanguage()
const projectDirectory = createMemo(() => base64Decode(params.dir ?? ""))
const project = createMemo(() => {
@@ -138,7 +140,7 @@ export function SessionHeader() {
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-visible">
<Icon name="magnifying-glass" size="normal" class="icon-base shrink-0" />
<span class="flex-1 min-w-0 text-14-regular text-text-weak truncate h-4.5 flex items-center">
Search {name()}
{language.t("session.header.search.placeholder", { project: name() })}
</span>
</div>
@@ -181,7 +183,7 @@ export function SessionHeader() {
}}
aria-hidden={!showReview()}
>
<TooltipKeybind title="Toggle review" keybind={command.keybind("review.toggle")}>
<TooltipKeybind title={language.t("command.review.toggle")} keybind={command.keybind("review.toggle")}>
<Button
variant="ghost"
class="group/review-toggle size-6 p-0"
@@ -209,7 +211,7 @@ export function SessionHeader() {
</div>
<TooltipKeybind
class="hidden md:block shrink-0"
title="Toggle terminal"
title={language.t("command.terminal.toggle")}
keybind={command.keybind("terminal.toggle")}
>
<Button
@@ -245,20 +247,20 @@ export function SessionHeader() {
aria-hidden={!showShare()}
>
<Popover
title="Publish on web"
title={language.t("session.share.popover.title")}
description={
shareUrl()
? "This session is public on the web. It is accessible to anyone with the link."
: "Share session publicly on the web. It will be accessible to anyone with the link."
? language.t("session.share.popover.description.shared")
: language.t("session.share.popover.description.unshared")
}
trigger={
<Tooltip class="shrink-0" value="Share session">
<Tooltip class="shrink-0" value={language.t("command.session.share")}>
<Button
variant="secondary"
classList={{ "rounded-r-none": shareUrl() !== undefined }}
style={{ scale: 1 }}
>
Share
{language.t("session.share.action.share")}
</Button>
</Tooltip>
}
@@ -275,7 +277,9 @@ export function SessionHeader() {
onClick={shareSession}
disabled={state.share}
>
{state.share ? "Publishing..." : "Publish"}
{state.share
? language.t("session.share.action.publishing")
: language.t("session.share.action.publish")}
</Button>
</div>
}
@@ -290,7 +294,9 @@ export function SessionHeader() {
onClick={unshareSession}
disabled={state.unshare}
>
{state.unshare ? "Unpublishing..." : "Unpublish"}
{state.unshare
? language.t("session.share.action.unpublishing")
: language.t("session.share.action.unpublish")}
</Button>
<Button
size="large"
@@ -299,7 +305,7 @@ export function SessionHeader() {
onClick={viewShare}
disabled={state.unshare}
>
View
{language.t("session.share.action.view")}
</Button>
</div>
</div>
@@ -307,7 +313,13 @@ export function SessionHeader() {
</div>
</Popover>
<Show when={shareUrl()} fallback={<div class="size-6" aria-hidden="true" />}>
<Tooltip value={state.copied ? "Copied" : "Copy link"} placement="top" gutter={8}>
<Tooltip
value={
state.copied ? language.t("session.share.copy.copied") : language.t("session.share.copy.copyLink")
}
placement="top"
gutter={8}
>
<IconButton
icon={state.copied ? "check" : "copy"}
variant="secondary"