aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2025-07-29 21:43:00 +0200
committerThomas Voss <mail@thomasvoss.com> 2025-07-29 21:43:00 +0200
commit38230599d68ae097e886222f5c2384fe6dd9b5bc (patch)
treefbb2e051564b128fb19f27ffb19d780c7429d023 /src
parentb56bc988851f219f50cf29ed52f5775fc30b6cbe (diff)
Switch dummy translations for the real-deal
Diffstat (limited to 'src')
-rw-r--r--src/http.go6
-rw-r--r--src/templates.go11
-rw-r--r--src/templates/language.html.tmpl20
3 files changed, 23 insertions, 14 deletions
diff --git a/src/http.go b/src/http.go
index 00078c9..362a2cd 100644
--- a/src/http.go
+++ b/src/http.go
@@ -61,8 +61,10 @@ func chain(xs ...middleware) middleware {
func firstHandler(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- ctx := context.WithValue(r.Context(), "td",
- &templateData{Debugp: Debugp})
+ ctx := context.WithValue(r.Context(), "td", &templateData{
+ Debugp: Debugp,
+ Printers: i18n.Printers,
+ })
next.ServeHTTP(w, r.WithContext(ctx))
})
}
diff --git a/src/templates.go b/src/templates.go
index e3a0465..ef7b0ec 100644
--- a/src/templates.go
+++ b/src/templates.go
@@ -17,6 +17,7 @@ import (
type templateData struct {
Debugp bool
Printer i18n.Printer
+ Printers map[string]i18n.Printer
Code, Type string
Mintages dbx.MintageData
Countries []country
@@ -27,11 +28,11 @@ var (
errorTmpl *template.Template
templates map[string]*template.Template
funcmap = map[string]any{
- "locales": i18n.Locales,
- "map": templateMakeMap,
- "safe": asHTML,
- "toUpper": strings.ToUpper,
- "tuple": templateMakeTuple,
+ "locales": i18n.Locales,
+ "map": templateMakeMap,
+ "safe": asHTML,
+ "toUpper": strings.ToUpper,
+ "tuple": templateMakeTuple,
}
)
diff --git a/src/templates/language.html.tmpl b/src/templates/language.html.tmpl
index 78703fc..a79e30c 100644
--- a/src/templates/language.html.tmpl
+++ b/src/templates/language.html.tmpl
@@ -21,13 +21,19 @@
const Δt = 5000; /* Total time a text is shown */
const Δf = 1000; /* Fade duration */
const texts = [
- // ["en", "Select Your Language", "Eurozone Languages", "Other Languages"],
- ["nl", "Kies uw taal", "Eurozone talen", "Andere talen"],
- ["sv", "Välj ditt språk", "Eurozonens språk", "Andra språk"],
- ["fi", "Valitse kieli", "Euroalueen kielet", "Muut kielet"],
- ["de", "Wählen Sie Ihre Sprache", "Eurozone Sprachen", "Weitere Sprachen"],
- ["el", "Επιλέξτε τη γλώσσα σας", "Γλώσσες Ευρωζώνης", "Άλλες γλώσσες"],
- ["bg", "Изберете език", "Езици на еврозоната", "Други езици"],
+ {{ $save := . }}
+ {{ $ps := .Printers }}
+ {{ range locales }}
+ {{ if (and .Enabled (ne .Bcp $save.Printer.Bcp)) }}
+ [
+ "{{ .Bcp }}",
+ {{ $p := (index $ps .Bcp) }}
+ "{{ $p.Get `Select Your Language` }}",
+ "{{ $p.Get `Eurozone Languages` }}",
+ "{{ $p.Get `Other Languages` }}",
+ ],
+ {{ end }}
+ {{ end }}
];
const updateTexts = () => {