mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-03 06:50:26 +00:00
feat(web): i18n (#12471)
This commit is contained in:
parent
0ec5f6608b
commit
812597bb8b
75 changed files with 9868 additions and 726 deletions
|
|
@ -1,12 +1,18 @@
|
|||
import type { APIEvent } from "@solidjs/start/server"
|
||||
import { localeFromCookieHeader, tag } from "~/lib/language"
|
||||
|
||||
async function handler(evt: APIEvent) {
|
||||
const req = evt.request.clone()
|
||||
const url = new URL(req.url)
|
||||
const targetUrl = `https://docs.opencode.ai${url.pathname}${url.search}`
|
||||
|
||||
const headers = new Headers(req.headers)
|
||||
const locale = localeFromCookieHeader(req.headers.get("cookie"))
|
||||
if (locale) headers.set("accept-language", tag(locale))
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: req.method,
|
||||
headers: req.headers,
|
||||
headers,
|
||||
body: req.body,
|
||||
})
|
||||
return response
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue