feat: add English interface localization and fix preview crashes

This commit is contained in:
ji ruo committed 2026-11-10 20:03:14 +08:00
1 parent a05a886d3d
commit 9ccaa81497
163 files changed
+17100 -6944

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
package server
import "net/http"
// productMessage keeps the original detail alongside a stable translation key.
type productMessage struct {
Code string `json:"code"`
Params map[string]any `json:"params,omitempty"`
Message string `json:"message"`
}
// Preserve error for existing clients and add stable fields for localized UIs.
func writeProductError(w http.ResponseWriter, status int, code, message string, params map[string]any) {
payload := map[string]any{"error": message, "code": code}
if len(params) > 0 {
payload["params"] = params
}
writeJSON(w, status, payload)
}