aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/templates/dashboard/section_form.html
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2026-09-14 01:32:25 +0300
committergrm <grm@eyesin.space>2026-09-14 01:32:25 +0300
commite14a4250efb828262347f5a4bbc4067cd71d885f (patch)
tree3fcf6512f3b030b06c818ff4a224677a026d3b1b /internal/web/templates/dashboard/section_form.html
parent282d2ab3e0fb3a74f32160a231225773001acd14 (diff)
downloadblogspace-e14a4250efb828262347f5a4bbc4067cd71d885f.tar.gz
blogspace-e14a4250efb828262347f5a4bbc4067cd71d885f.tar.bz2
blogspace-e14a4250efb828262347f5a4bbc4067cd71d885f.zip
Add languages: English and Greek, chosen per blog on the Settings tab
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A
Diffstat (limited to 'internal/web/templates/dashboard/section_form.html')
-rw-r--r--internal/web/templates/dashboard/section_form.html40
1 files changed, 20 insertions, 20 deletions
diff --git a/internal/web/templates/dashboard/section_form.html b/internal/web/templates/dashboard/section_form.html
index 7eeaf7c..bc3ba34 100644
--- a/internal/web/templates/dashboard/section_form.html
+++ b/internal/web/templates/dashboard/section_form.html
@@ -1,35 +1,35 @@
-{{define "title"}}{{if .Data.section.ID}}Edit announcement{{else}}New announcement{{end}} · {{.Blog.Title}}{{end}}
+{{define "title"}}{{if .Data.section.ID}}{{t "Edit announcement"}}{{else}}{{t "New announcement"}}{{end}} · {{.Blog.Title}}{{end}}
{{define "content"}}
{{$s := .Data.section}}
<div class="card">
- <h1>{{if $s.ID}}Edit announcement{{else}}New announcement{{end}}</h1>
+ <h1>{{if $s.ID}}{{t "Edit announcement"}}{{else}}{{t "New announcement"}}{{end}}</h1>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="_csrf" value="{{.CSRF}}">
- <label>Title <span class="muted">(optional)</span><br><input name="title" value="{{$s.Title}}" maxlength="120" autofocus placeholder="Next meeting"></label>
+ <label>{{t "Title"}} <span class="muted">({{t "optional"}})</span><br><input name="title" value="{{$s.Title}}" maxlength="120" autofocus placeholder="{{t "Next meeting"}}"></label>
<div class="row">
- <label>Where<br><select name="column">
- <option value="main"{{if eq $s.Column "main"}} selected{{end}}>Main content (with the posts)</option>
- <option value="left"{{if eq $s.Column "left"}} selected{{end}}>Left column</option>
- <option value="right"{{if eq $s.Column "right"}} selected{{end}}>Right column</option>
+ <label>{{t "Where"}}<br><select name="column">
+ <option value="main"{{if eq $s.Column "main"}} selected{{end}}>{{t "Main content (with the posts)"}}</option>
+ <option value="left"{{if eq $s.Column "left"}} selected{{end}}>{{t "Left column"}}</option>
+ <option value="right"{{if eq $s.Column "right"}} selected{{end}}>{{t "Right column"}}</option>
</select></label>
- <label>Position<br><select name="position">
- <option value="top"{{if eq $s.Position "top"}} selected{{end}}>At the top</option>
- <option value="bottom"{{if eq $s.Position "bottom"}} selected{{end}}>At the bottom</option>
+ <label>{{t "Position"}}<br><select name="position">
+ <option value="top"{{if eq $s.Position "top"}} selected{{end}}>{{t "At the top"}}</option>
+ <option value="bottom"{{if eq $s.Position "bottom"}} selected{{end}}>{{t "At the bottom"}}</option>
</select></label>
- <label>Look<br><select name="style">
- <option value="note"{{if eq $s.Style "note"}} selected{{end}}>Highlighted</option>
- <option value="warning"{{if eq $s.Style "warning"}} selected{{end}}>Warning</option>
- <option value="plain"{{if eq $s.Style "plain"}} selected{{end}}>Plain</option>
+ <label>{{t "Look"}}<br><select name="style">
+ <option value="note"{{if eq $s.Style "note"}} selected{{end}}>{{t "Highlighted"}}</option>
+ <option value="warning"{{if eq $s.Style "warning"}} selected{{end}}>{{t "Warning"}}</option>
+ <option value="plain"{{if eq $s.Style "plain"}} selected{{end}}>{{t "Plain"}}</option>
</select></label>
</div>
- <p class="muted small">"Top" of a side column means above its modules, "bottom" below them. If that column is not shown on your blog (see <a href="/b/{{.Blog.Subdomain}}/layout">Layout</a>) the announcement moves to the main content instead.</p>
- <label for="ed-body">Text <span class="muted">(Markdown)</span></label>
+ <p class="muted small">{{t "“Top” of a side column means above its modules, “bottom” below them. If that column is not shown on your blog (see"}} <a href="/b/{{.Blog.Subdomain}}/layout">{{t "Layout"}}</a>) {{t "the announcement moves to the main content instead."}}</p>
+ <label for="ed-body">{{t "Text"}} <span class="muted">(Markdown)</span></label>
{{template "editor" (dict "name" "body" "value" $s.BodyMD "rows" 10 "tall" false "upload" (print "/b/" .Blog.Subdomain "/images/upload") "csrf" .CSRF)}}
- <label class="check"><input type="checkbox" name="enabled"{{if $s.Enabled}} checked{{end}}> Shown on the blog</label>
+ <label class="check"><input type="checkbox" name="enabled"{{if $s.Enabled}} checked{{end}}> {{t "Shown on the blog"}}</label>
<p class="actionrow">
- <button type="submit">Save</button>
- <a class="btn secondary" href="{{.BlogURL}}" target="_blank">View blog &#8599;</a>
- <a href="/b/{{.Blog.Subdomain}}/announcements">Back to announcements</a>
+ <button type="submit">{{t "Save"}}</button>
+ <a class="btn secondary" href="{{.BlogURL}}" target="_blank">{{t "View blog"}} &#8599;</a>
+ <a href="/b/{{.Blog.Subdomain}}/announcements">{{t "Back to announcements"}}</a>
</p>
</form>
</div>