The portal in English and Turkish: a catalogue per language, a switcher at the foot of every page, landing.language, Turkish numbers and dates

Every template and handler message in internal/web goes through a JSON
catalogue under internal/web/locales/<code>/, with English as the fallback.
The language is the person's choice (a cookie set by /_lang/{code}), else
Accept-Language, else landing.language. Tests refuse a key some language
lacks, a translation with other arguments than English, and template text
left in English.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-05 00:12:53 +02:00
1 parent 30f7f3474a
commit 11231d8c2b
113 files changed
+8091 -1981

No files matched your search

+23 -17
View File
@@ -86,8 +86,14 @@ model = "%[2]s"
`, base, model)
}
// connectFor builds what the page shows for a tool.
// connectFor builds what the page shows for a tool, in English.
func connectFor(tool, base, model, key string) connectView {
return connectIn(english, tool, base, model, key)
}
// connectIn builds what the page shows for a tool, its sentences in l. The
// files, commands and paths are the same in every language.
func connectIn(l *Lang, tool, base, model, key string) connectView {
v := connectView{Tool: tool, Model: model, Key: key}
for _, t := range editorTools {
if t.Key == tool {
@@ -100,23 +106,22 @@ func connectFor(tool, base, model, key string) connectView {
v.Files = []connectFile{{Path: "~/.continue/assistants/llmgw.yaml", Name: "llmgw.yaml",
Body: continueYAML(base, model, key)}}
v.Command = fmt.Sprintf("curl -fsSL '%s' | LLMGW_KEY='%s' sh", script, key)
v.Run = `In Continue, choose the "llmgw" assistant at the top of its panel.`
v.Run = l.T("connect.run.continue")
case "codex":
v.Files = []connectFile{{Path: "~/.codex/config.toml", Name: "config.toml", Body: codexTOML(base, model)}}
v.Command = fmt.Sprintf("curl -fsSL '%s' | sh", script)
v.Run = fmt.Sprintf("LLMGW_API_KEY='%s' codex --profile llmgw", key)
v.Notes = []string{
"The command adds the two blocks above to ~/.codex/config.toml, replacing any it added before, and keeps a copy of the file as it was.",
"Put export LLMGW_API_KEY=… in your shell's profile to leave it out of the command line.",
}
v.Notes = []string{l.T("connect.note.codex_blocks"), l.T("connect.note.codex_env")}
case "cline":
// The values are what Cline's own screen offers and takes, which is
// English whatever language this page is in.
v.Fields = []connectField{
{"API Provider", "OpenAI Compatible"},
{"Base URL", base + "/v1"},
{"API Key", key},
{"Model ID", model},
{l.T("connect.field.provider"), "OpenAI Compatible"},
{l.T("connect.field.base_url"), base + "/v1"},
{l.T("connect.field.key"), key},
{l.T("connect.field.model"), model},
}
v.Run = "Cline keeps these in VS Code's own secret storage, so they are set in its settings: open Cline, the gear, and fill them in."
v.Run = l.T("connect.run.cline")
}
return v
}
@@ -133,6 +138,7 @@ func (p *AccountPages) connect(w http.ResponseWriter, r *http.Request) {
http.Error(w, "bad request", http.StatusBadRequest)
return
}
l := langOf(r)
tool := r.FormValue("tool")
known := false
for _, t := range editorTools {
@@ -140,13 +146,13 @@ func (p *AccountPages) connect(w http.ResponseWriter, r *http.Request) {
}
model := strings.TrimSpace(r.FormValue("model"))
if !known || !safeModel.MatchString(model) {
p.renderProfile(w, r, sess, user, "", "choose a tool and a model")
p.renderProfile(w, r, sess, user, "", l.T("connect.err.choose"))
return
}
project := r.FormValue("context")
if project == personalValue {
if p.personalOff {
p.renderProfile(w, r, sess, user, "", "personal keys are off on this gateway; choose a project")
p.renderProfile(w, r, sess, user, "", l.T("profile.err.personal_off"))
return
}
project = ""
@@ -154,20 +160,20 @@ func (p *AccountPages) connect(w http.ResponseWriter, r *http.Request) {
name := tool + " " + time.Now().Format("2006-01-02")
secret, k, err := store.NewKey(randomKeyID(), name, project)
if err != nil {
p.renderProfile(w, r, sess, user, "", "something went wrong; try again")
p.renderProfile(w, r, sess, user, "", l.T("profile.err.try_again"))
return
}
k.CreatedAt = time.Now()
if err := p.keys.CreateUserKey(r.Context(), user.ID, k); err != nil {
msg := "something went wrong; try again"
msg := l.T("profile.err.try_again")
if err == store.ErrNotMember {
msg = "you are not a member of that project"
msg = l.T("profile.err.not_member")
}
p.renderProfile(w, r, sess, user, "", msg)
return
}
p.log.Info("a user connected an editor", "user", user.ID, "tool", tool, "key", k.ID)
c := connectFor(tool, baseURL(r), model, secret)
c := connectIn(l, tool, baseURL(r), model, secret)
p.render(w, r, sess, user, profileData{Connect: &c})
}