From e14a4250efb828262347f5a4bbc4067cd71d885f Mon Sep 17 00:00:00 2001 From: grm Date: Mon, 14 Sep 2026 01:32:25 +0300 Subject: Add languages: English and Greek, chosen per blog on the Settings tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every blog and its dashboard were hard-wired to English. A blogger can now pick the language of their blog; it switches the whole dashboard and the blog's fixed text — post dates, archive months, the RSS link, the pager, the 404 page — while what the blogger wrote is left alone. The new internal/i18n package keys translations by the English string, so an untranslated key renders as English rather than blank, and TestGreekCatalogComplete scans the templates and handlers to fail when the Greek catalog misses a key or keeps a stale one. Templates are compiled once per language with t/tf/date/postdate/month closed over the language, so they need no data plumbing. The language lives in settings.language (blog migration 00002), not in the theme, so "Reset design" does not touch it. Public pages use the blog's language; management pages use the logged-in user's own blog's, so a superadmin editing someone else's blog keeps theirs; the login page follows Accept-Language. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A --- internal/web/templates/dashboard/layout.html | 102 +++++++++++++-------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'internal/web/templates/dashboard/layout.html') diff --git a/internal/web/templates/dashboard/layout.html b/internal/web/templates/dashboard/layout.html index 229ca0e..48b6778 100644 --- a/internal/web/templates/dashboard/layout.html +++ b/internal/web/templates/dashboard/layout.html @@ -1,86 +1,86 @@ -{{define "title"}}Layout · {{.Blog.Title}}{{end}} +{{define "title"}}{{t "Layout"}} · {{.Blog.Title}}{{end}} {{define "content"}} {{$t := .Data.theme}} {{$u := print "/b/" .Blog.Subdomain "/layout"}}
-

Layout

-

Decide what goes where on your blog. Every change here is saved straight away; refresh your blog ↗ to see it. Colours and fonts are on the Design tab.

+

{{t "Layout"}}

+

{{t "Decide what goes where on your blog. Every change here is saved straight away; refresh"}} {{t "your blog"}} ↗ {{t "to see it."}} {{t "Colours and fonts are on the"}} {{t "Design"}} {{t "tab."}}

-

ColumnsHeaderLeft columnMain contentRight columnFooterMenu

+

{{t "Columns"}}{{t "Header"}}{{t "Left column"}}{{t "Main content"}}{{t "Right column"}}{{t "Footer"}}{{t "Menu"}}

-

Columns

+

{{t "Columns"}}

-
Header{{if not $t.HeaderOn}} (hidden){{end}}
+
{{t "Header"}}{{if not $t.HeaderOn}} ({{t "hidden"}}){{end}}
-
Left {{$t.LeftWidth}}%
-
Main content {{$t.MainWidth}}%
-
Right {{$t.RightWidth}}%
+
{{t "Left"}} {{$t.LeftWidth}}%
+
{{t "Main content"}} {{$t.MainWidth}}%
+
{{t "Right"}} {{$t.RightWidth}}%
-
Footer{{if not $t.FooterOn}} (hidden){{end}}
+
{{t "Footer"}}{{if not $t.FooterOn}} ({{t "hidden"}}){{end}}
- - + +
-

Between 15% and 40% each; the main content takes the rest. A column only appears when it has at least one module; without columns the posts take the whole width. On phones the columns stack: main content first, then the left and right columns, then the footer.

- -

+

{{t "Between 15% and 40% each; the main content takes the rest. A column only appears when it has at least one module; without columns the posts take the whole width. On phones the columns stack: main content first, then the left and right columns, then the footer."}}

+ +

-{{template "area" (dict "area" "header" "root" . "hint" "The top of every page. Stack the title, a logo and the menu in the order you like. A banner image can be chosen on the Design tab.")}} -{{template "area" (dict "area" "left" "root" . "hint" "A narrow column beside your posts. Good for the menu, an archive or recent posts.")}} +{{template "area" (dict "area" "header" "root" . "hint" (t "The top of every page. Stack the title, a logo and the menu in the order you like. A banner image can be chosen on the Design tab."))}} +{{template "area" (dict "area" "left" "root" . "hint" (t "A narrow column beside your posts. Good for the menu, an archive or recent posts."))}}
-

Main content

-

Your posts and pages always show here. You can add your own HTML before and after them — an intro box, a newsletter form, a badge…

+

{{t "Main content"}}

+

{{t "Your posts and pages always show here. You can add your own HTML before and after them — an intro box, a newsletter form, a badge…"}}

{{range $area := .Data.areaOrder}}{{$mods := index $.Data.areas $area}} - + {{if $mods}}{{$m := index $mods 0}} - - + + {{else}} - - + + {{end}} {{end}}
{{index $.Data.areaNames $area}}
{{t (index $.Data.areaNames $area)}}{{index $.Data.names $m.Kind}}{{with modsummary $m}} — {{.}}{{end}}edit remove{{t (index $.Data.names $m.Kind)}}{{with modsummary $m}} — {{.}}{{end}}{{t "edit"}} {{t "remove"}}Nothing extra.
{{t "Nothing extra."}}
-{{template "area" (dict "area" "right" "root" . "hint" "A narrow column on the other side of your posts. Same choices as the left one.")}} -{{template "area" (dict "area" "footer" "root" . "hint" "The bottom of every page: a copyright line, the RSS link, a list of your pages.")}} +{{template "area" (dict "area" "right" "root" . "hint" (t "A narrow column on the other side of your posts. Same choices as the left one."))}} +{{template "area" (dict "area" "footer" "root" . "hint" (t "The bottom of every page: a copyright line, the RSS link, a list of your pages."))}} @@ -90,24 +90,24 @@ {{define "area"}}{{$r := .root}}{{$area := .area}}{{$u := print "/b/" $r.Blog.Subdomain "/layout"}}{{$on := $r.Data.theme.AreaOn $area}}{{$mods := index $r.Data.areas $area}}
-

{{index $r.Data.areaNames $area}}{{if not $on}} hidden{{end}}

-
+

{{t (index $r.Data.areaNames $area)}}{{if not $on}} {{t "hidden"}}{{end}}

+

{{.hint}}

{{if $mods}} {{range $mods}} - - + + {{end}} -
-
-
+
+
{{index $r.Data.names .Kind}}{{with modsummary .}} — {{.}}{{end}} - {{if and (eq .Kind "logo") (not $r.Data.theme.Logo)}}no logo chosen pick one on the Design tab{{end}}{{if modsettings .Kind}}edit {{end}}remove{{t (index $r.Data.names .Kind)}}{{with modsummary .}} — {{.}}{{end}} + {{if and (eq .Kind "logo") (not $r.Data.theme.Logo)}}{{t "no logo chosen"}} {{t "pick one on the"}} {{t "Design"}} {{t "tab."}}{{end}}{{if modsettings .Kind}}{{t "edit"}} {{end}}{{t "remove"}}
{{else}}

Nothing here yet{{if ne $area "header"}} — this area is not shown until you add a module{{end}}.

{{end}} + {{else}}

{{if ne $area "header"}}{{t "Nothing here yet — this area is not shown until you add a module."}}{{else}}{{t "Nothing here yet."}}{{end}}

{{end}}
- - + +
{{end}} -- cgit v1.2.3