summaryrefslogtreecommitdiffhomepage
path: root/src/templates/language.html.tmpl
blob: ee66bf88f157b672b85b5d9f58635be2057c4c6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{{ define "content" }}
<header>
	{{ template "navbar" . }}
	<h1>{{ .T "Select Your Language" }}</h1>
</header>
<main>
	<p>
		{{ .T "Select your preferred language to use on the site." }}
	</p>
	<p>
		If you are an American user, it’s suggested that you select
		American English instead of British English. This will ensure that
		dates will be formatted with the month before the day. 
	</p>
	<hr />
	<h2>{{ .T "Eurozone Languages" }}</h2>
	{{ template "langgrid" true }}
	<h2>{{ .T "Other Languages" }}</h2>
	{{ template "langgrid" false }}
</main>
{{ end }}

{{ define "langgrid" }}
{{ $ez := . }}
<form action="/language" method="POST">
	<div class="lang-grid">
		{{ range locales }}
			{{ if eq $ez .Eurozone }}
				<button
					type="submit"
					name="locale"
					value={{ .Bcp }}
					{{ if not .Enabled }}
						disabled
					{{ end }}
				>
					<span
						lang={{ .Bcp }}
						data-code={{ .Language | toUpper }}
					>
						{{ .Name }}
					</span>
				</button>
			{{ end }}
		{{ end }}
	</div>
</form>
{{ end }}