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:
1 parent
30f7f3474a
commit
11231d8c2b
113 files changed
+8091
-1981
No files matched your search
@@ -28,22 +28,31 @@ func (p *AccountPages) RegisterNodeEngines(mux *http.ServeMux, a NodeEngineAdmin
|
||||
q := url.Values{}
|
||||
if err := a.SetNodeEngine(r.Context(), node, engine, build, admin.Email); err != nil {
|
||||
p.log.Warn("an engine build was not chosen", "admin", admin.Email, "node", node, "err", err)
|
||||
// The control plane's reason, as it gave it: in English.
|
||||
q.Set("problem", node+": "+err.Error())
|
||||
} else {
|
||||
p.log.Info("an engine build was chosen", "admin", admin.Email, "node", node, "engine", engine, "build", build)
|
||||
q.Set("notice", node+" installs "+engine+" "+buildWords(build)+
|
||||
"; the node is told now, and installs it in the background")
|
||||
// Said in the language of the person who chose, since the
|
||||
// sentence travels to the page in the address.
|
||||
q.Set("notice", buildNotice(langOf(r), node, engine, build))
|
||||
}
|
||||
http.Redirect(w, r, "/admin?"+q.Encode(), http.StatusSeeOther)
|
||||
}))
|
||||
}
|
||||
|
||||
func buildWords(b string) string {
|
||||
switch b {
|
||||
// buildNotice says what a node was told to install. A whole sentence for
|
||||
// each kind of choice, because where the build goes in it is the
|
||||
// language's business.
|
||||
func buildNotice(l *Lang, node, engine, build string) string {
|
||||
switch build {
|
||||
case "auto":
|
||||
return "in the build its hardware runs"
|
||||
return l.T("nodeengine.notice.auto", node, engine)
|
||||
case "none":
|
||||
return "no longer"
|
||||
return l.T("nodeengine.notice.none", node, engine)
|
||||
}
|
||||
return "built for " + map[string]string{"cu13": "CUDA 13", "cu129": "CUDA 12.9"}[b]
|
||||
name := map[string]string{"cu13": "CUDA 13", "cu129": "CUDA 12.9", "cu12": "CUDA 12"}[build]
|
||||
if name == "" {
|
||||
name = build
|
||||
}
|
||||
return l.T("nodeengine.notice.build", node, engine, name)
|
||||
}
|
||||
Reference in new issue
Block a user