diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.go | 2 | ||||
-rw-r--r-- | src/email/email.go | 4 | ||||
-rw-r--r-- | src/http.go | 57 | ||||
-rw-r--r-- | src/i18n/i18n.go | 7 | ||||
-rw-r--r-- | src/templates.go | 80 | ||||
-rw-r--r-- | src/templates/-base.html.tmpl | 41 | ||||
-rw-r--r-- | src/templates/banknotes-codes.html.tmpl | 2 | ||||
-rw-r--r-- | src/templates/banknotes.html.tmpl | 6 | ||||
-rw-r--r-- | src/templates/coins-designs-be.html.tmpl | 4 | ||||
-rw-r--r-- | src/templates/coins-designs-ee.html.tmpl | 4 | ||||
-rw-r--r-- | src/templates/coins.html.tmpl | 6 | ||||
-rw-r--r-- | src/templates/collecting-crh.html.tmpl | 347 | ||||
-rw-r--r-- | src/templates/collecting.html.tmpl | 37 | ||||
-rw-r--r-- | src/templates/jargon.html.tmpl | 113 | ||||
-rw-r--r-- | src/templates/language.html.tmpl | 74 |
15 files changed, 411 insertions, 373 deletions
@@ -8,6 +8,8 @@ import ( . "git.thomasvoss.com/euro-cash.eu/pkg/try" ) +var Debugp bool + func Restart() { path := Try2(os.Executable()) atexit.Exec() diff --git a/src/email/email.go b/src/email/email.go index a1f7f0b..16a4813 100644 --- a/src/email/email.go +++ b/src/email/email.go @@ -4,10 +4,10 @@ package email import ( "crypto/tls" + "errors" "fmt" - "math/rand/v2" "log" - "errors" + "math/rand/v2" "net/smtp" "strconv" "time" diff --git a/src/http.go b/src/http.go index b0d5bcd..ac6f6da 100644 --- a/src/http.go +++ b/src/http.go @@ -10,6 +10,8 @@ import ( "net/http" "slices" "strconv" + "strings" + "time" . "git.thomasvoss.com/euro-cash.eu/pkg/try" @@ -34,7 +36,11 @@ func Run(port int) { mux.Handle("GET /favicon.ico", fs) mux.Handle("GET /fonts/", fs) mux.Handle("GET /storage/", fs) - mux.Handle("GET /style.min.css", fs) + if Debugp { + mux.Handle("GET /style.css", fs) + } else { + mux.Handle("GET /style.min.css", fs) + } mux.Handle("GET /coins/designs", mwareC(final)) mux.Handle("GET /coins/mintages", mwareM(final)) mux.Handle("GET /collecting/crh", mwareC(final)) @@ -57,7 +63,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{}) + ctx := context.WithValue(r.Context(), "td", &templateData{ + Debugp: Debugp, + Printers: i18n.Printers, + }) next.ServeHTTP(w, r.WithContext(ctx)) }) } @@ -81,8 +90,9 @@ func finalHandler(w http.ResponseWriter, r *http.Request) { original page they came from. */ if path == "/language" { http.SetCookie(w, &http.Cookie{ - Name: "redirect", - Value: cmp.Or(r.Referer(), "/"), + Name: "redirect", + Value: cmp.Or(r.Referer(), "/"), + Expires: time.Now().Add(24 * time.Hour), }) } @@ -101,15 +111,16 @@ func i18nHandler(next http.Handler) http.Handler { } td := r.Context().Value("td").(*templateData) - td.Printer = cmp.Or(p, i18n.DefaultPrinter) if p == pZero { + td.Printer = bestFitLanguage(r.Header.Get("Accept-Language")) http.SetCookie(w, &http.Cookie{ Name: "redirect", Value: r.URL.Path, }) templates["/language"].Execute(w, td) } else { + td.Printer = p next.ServeHTTP(w, r) } }) @@ -188,3 +199,39 @@ func throwError(status int, err error, w http.ResponseWriter, r *http.Request) { Msg: http.StatusText(status), }) } + +func bestFitLanguage(qry string) i18n.Printer { + type option struct { + bcp string + quality float64 + } + var xs []option + + for subqry := range strings.SplitSeq(qry, ",") { + var o option + subqry = strings.TrimSpace(subqry) + parts := strings.Split(subqry, ";") + o.bcp = strings.ToLower(parts[0]) + if len(parts) == 1 { + o.quality = 1 + } else { + n, err := fmt.Sscanf(parts[1], "q=%f", &o.quality) + if n != 1 || err != nil { + /* Malformed query string; just give up */ + return i18n.DefaultPrinter + } + } + xs = append(xs, o) + } + + slices.SortFunc(xs, func(x, y option) int { + return cmp.Compare(y.quality, x.quality) + }) + + for _, x := range xs { + if p, ok := i18n.Printers[x.bcp]; ok { + return p + } + } + return i18n.DefaultPrinter +} diff --git a/src/i18n/i18n.go b/src/i18n/i18n.go index cf82630..ebd849a 100644 --- a/src/i18n/i18n.go +++ b/src/i18n/i18n.go @@ -212,7 +212,7 @@ var ( Name: "Nederlands", DateFormat: "2-1-2006", Eurozone: true, - Enabled: false, + Enabled: true, GroupSeparator: '.', DecimalSeparator: ',', MonetaryPre: [2]string{"€ ", "€ -"}, @@ -309,7 +309,8 @@ func Init() { Printers[li.Bcp] = Printer{li, gl} } - DefaultPrinter = Printers["en"] + gotext.FallbackLocale = "en" + DefaultPrinter = Printers[gotext.FallbackLocale] } func Locales() []LocaleInfo { @@ -356,7 +357,7 @@ func (p Printer) Mftoa(n float64) string { func (p Printer) Sprintf(format string, args ...map[string]any) string { var bob strings.Builder vars := map[string]any{ - "-": "a", + "-": "a", "Null": "", } for _, arg := range args { diff --git a/src/templates.go b/src/templates.go index 353c755..d6b82b8 100644 --- a/src/templates.go +++ b/src/templates.go @@ -1,7 +1,7 @@ package app import ( - "fmt" + "bytes" "html/template" "io/fs" "log" @@ -15,7 +15,9 @@ import ( ) type templateData struct { + Debugp bool Printer i18n.Printer + Printers map[string]i18n.Printer Code, Type string Mintages dbx.MintageData Countries []country @@ -26,16 +28,17 @@ var ( errorTmpl *template.Template templates map[string]*template.Template funcmap = map[string]any{ - "locales": i18n.Locales, - "safe": asHTML, - "sprintf": fmt.Sprintf, - "toUpper": strings.ToUpper, - "tuple": templateMakeTuple, - "map": templateMakeMap, + "ifElse": ifElse, + "locales": i18n.Locales, + "map": templateMakeMap, + "safe": asHTML, + "toUpper": strings.ToUpper, + "tuple": templateMakeTuple, + "makeHeaderWithTranslations": makeHeaderWithTranslations, } ) -func BuildTemplates(dir fs.FS, debugp bool) { +func BuildTemplates(dir fs.FS) { ents := Try2(fs.ReadDir(dir, ".")) notFoundTmpl = buildTemplate(dir, "-404") errorTmpl = buildTemplate(dir, "-error") @@ -44,7 +47,7 @@ func BuildTemplates(dir fs.FS, debugp bool) { for _, e := range ents { name := e.Name() buildAndSetTemplate(dir, name) - if debugp { + if Debugp { go watch.FileFS(dir, name, func() { defer func() { if p := recover(); p != nil { @@ -76,10 +79,9 @@ func buildTemplate(dir fs.FS, name string) *template.Template { for i, s := range names { names[i] = s + ".html.tmpl" } - return template.Must(template. - New("-base.html.tmpl"). - Funcs(funcmap). - ParseFS(dir, names[:]...)) + t := template.New("-base.html.tmpl").Funcs(funcmap) + t = t.Funcs(includeIfExists(t)) + return template.Must(t.ParseFS(dir, names[:]...)) } func asHTML(s string) template.HTML { @@ -107,6 +109,58 @@ func templateMakeMap(args ...any) map[string]any { return m } +func includeIfExists(tmpl *template.Template) template.FuncMap { + return template.FuncMap{ + "includeIfExists": func(name string, data any) (template.HTML, error) { + t := tmpl.Lookup(name) + if t == nil { + return "", nil + } + var buf bytes.Buffer + err := t.Execute(&buf, data) + return template.HTML(buf.String()), err + }, + } +} + +func ifElse(b bool, x, y any) any { + if b { + return x + } + return y +} + +func makeHeaderWithTranslations(tag string, text string, + translations ...[]any) template.HTML { + var bob strings.Builder + bob.WriteByte('<') + bob.WriteString(tag) + bob.WriteByte('>') + bob.WriteString(text) + + /* TODO: Assert that the pairs are [2]string */ + for _, pair := range translations { + if text == pair[1] { + continue + } + bob.WriteString(`<br><span class="translation"`) + if pair[0].(string) != "" { + bob.WriteString(` lang="`) + bob.WriteString(pair[0].(string)) + bob.WriteString(`">`) + } else { + bob.WriteByte('>') + } + bob.WriteString(pair[1].(string)) + bob.WriteString("</span>") + } + + bob.WriteString("</") + bob.WriteString(tag) + bob.WriteByte('>') + return template.HTML(bob.String()) +} + func (td templateData) Get(fmt string, args ...map[string]any) template.HTML { return template.HTML(td.Printer.Get(fmt, args...)) } diff --git a/src/templates/-base.html.tmpl b/src/templates/-base.html.tmpl index 388561b..42ec216 100644 --- a/src/templates/-base.html.tmpl +++ b/src/templates/-base.html.tmpl @@ -1,32 +1,39 @@ <!DOCTYPE html> -<html lang={{ .Printer.Bcp }}> +<html lang="{{ .Printer.Bcp }}"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> + {{ if .Debugp }} + <link href="/style.css" type="text/css" rel="stylesheet"> + {{ else }} <link href="/style.min.css" type="text/css" rel="stylesheet"> - <title>{{ .Get "Euro Cash" }}</title> + {{ end }} + <title>{{ .Get "Euro Cash Wiki" }}</title> <script type="text/javascript"> const $ = q => document.querySelector(q); const $$ = q => document.querySelectorAll(q); - const validate = theme => - ["light", "dark"].includes(theme) ? theme : "light"; - const toggle = theme => - theme == "light" ? "dark" : "light"; + (() => { + const validate = theme => + ["light", "dark"].includes(theme) ? theme : "light"; + const toggle = theme => + theme == "light" ? "dark" : "light"; - const setTheme = theme => { - localStorage.setItem("theme", theme); - $("html").setAttribute("data-theme", theme); - $(`#nav-icon-theme-${theme}`).style.display = ""; - $(`#nav-icon-theme-${toggle(theme)}`).style.display = "none"; - }; + const setTheme = theme => { + localStorage.setItem("theme", theme); + $("html").setAttribute("data-theme", theme); + $(`#nav-icon-theme-${theme}`).style.display = ""; + $(`#nav-icon-theme-${toggle(theme)}`).style.display = "none"; + }; - document.addEventListener("DOMContentLoaded", _ => { - $("#theme-button").onclick = () => - setTheme(toggle(validate(localStorage.getItem("theme")))); - setTheme(validate(localStorage.getItem("theme"))); - }); + document.addEventListener("DOMContentLoaded", _ => { + $("#theme-button").onclick = () => + setTheme(toggle(validate(localStorage.getItem("theme")))); + setTheme(validate(localStorage.getItem("theme"))); + }); + })(); </script> + {{ includeIfExists "header" . }} </head> <body> {{ template "content" . }} diff --git a/src/templates/banknotes-codes.html.tmpl b/src/templates/banknotes-codes.html.tmpl index 9136c32..ea17307 100644 --- a/src/templates/banknotes-codes.html.tmpl +++ b/src/templates/banknotes-codes.html.tmpl @@ -312,7 +312,7 @@ <summary>{{ $p.GetN "{N} Euro" "{N} Euro" $d $args }}</summary> <img class="big" - src={{ sprintf "/codes/%s-%03d.jpg" (index . 2) $d }} + src={{ printf "/codes/%s-%03d.jpg" (index . 2) $d }} alt={{ $p.GetN "Printer code on a {N} euro bill" "Printer code on a {N} euro bill" $d $args }} > </details> diff --git a/src/templates/banknotes.html.tmpl b/src/templates/banknotes.html.tmpl index 7349dcf..a35fe25 100644 --- a/src/templates/banknotes.html.tmpl +++ b/src/templates/banknotes.html.tmpl @@ -16,7 +16,7 @@ <h3>{{ .Get "Designs" }}</h3> </header> <main> - {{ .Get "View the different Euro-note designs!" }} + {{ .Get "View the different Euro-note designs" }} </main> </article> </a> @@ -26,7 +26,7 @@ <h3>{{ .Get "Location Codes" }}</h3> </header> <main> - {{ .Get "Find out where your notes were printed!" }} + {{ .Get "Find out where your notes were printed" }} </main> </article> </a> @@ -36,7 +36,7 @@ <h3>{{ .Get "Test Notes" }}</h3> </header> <main> - {{ .Get "Learn about the special test notes!" }} + {{ .Get "Learn about the special test notes" }} </main> </article> </a> diff --git a/src/templates/coins-designs-be.html.tmpl b/src/templates/coins-designs-be.html.tmpl index 54a2d9d..9063a3a 100644 --- a/src/templates/coins-designs-be.html.tmpl +++ b/src/templates/coins-designs-be.html.tmpl @@ -19,14 +19,14 @@ > </div> <p> - {{ .Get "Since 1999 Belgium has released three series of euro coins, with each series having a single design repeated on all denominations. Starting in 1999 the Belgian euro coins featured the portrait of King Albert II with the {Link:L}royal monogram{-:E} in the outer ring of the coins." + {{ .Get "Since 1999 Belgium has released three series of euro coins, with each series having a single design repeated on all denominations. Starting in 1999 the Belgian euro coins featured the portrait of King Albert II with the {Link:L}royal monogram{-:E} in the outer ring of the coins." (map "Link" "https://www.wikipedia.org/wiki/Royal_cypher") }} </p> <p> {{ .Get "In 2008 a second series of coins was released featuring a slightly modified design in which the royal monogram was moved to the inner portion of the coin along with the year of mintage in order to comply with the European Commission’s guidelines. The country code ‘BE’ was also added to the design underneath the royal monogram." }} </p> <p> - {{ .Get "After his accession to the throne, Belgium began a third series of coins in 2014 featuring the portrait of King Philippe. As is customary with coins bearing the portraits of monarchs, the direction in which the portrait faces was flipped to face right instead of left." }} + {{ .Get "After his accession to the throne, Belgium began a third series of coins in 2014 featuring the portrait of King Philippe. As is customary with coins bearing the portraits of monarchs, the direction in which the portrait faces was flipped to face right instead of left." }} </p> </main> {{ end }} diff --git a/src/templates/coins-designs-ee.html.tmpl b/src/templates/coins-designs-ee.html.tmpl index a6a62e9..f6d6354 100644 --- a/src/templates/coins-designs-ee.html.tmpl +++ b/src/templates/coins-designs-ee.html.tmpl @@ -19,7 +19,7 @@ (map "EVLink" "https://en.wikipedia.org/wiki/Eurovision_Song_Contest" ) }} </p> <p> - {{ .Get "In June 2024 a public design competition was announced with a deadline for the 19th of October. In total 134 designs were submitted by the deadline and 10 designs were selected by a jury. These 10 designs were then voted on in a public vote over the course of one week. In total 45,453 people voted and the current design won with a total of 12,482 votes (27.46%)." }} + {{ .Get "In June 2004 a public design competition was announced with a deadline for the 19th of October. In total 134 designs were submitted by the deadline and 10 designs were selected by a jury. These 10 designs were then voted on in a public vote over the course of one week. In total 45,453 people voted and the current design won with a total of 12,482 votes (27.46%)." }} </p> <p> {{ .Get "The winner of the contest was awarded 50,000 KR (€3,196) while the other finalists were each awarded 20,000 KR (€1,278)." }} @@ -152,4 +152,4 @@ </tfoot> </table> </main> -{{ end }}
\ No newline at end of file +{{ end }} diff --git a/src/templates/coins.html.tmpl b/src/templates/coins.html.tmpl index 6fbdf15..6319c22 100644 --- a/src/templates/coins.html.tmpl +++ b/src/templates/coins.html.tmpl @@ -16,7 +16,7 @@ <h3>{{ .Get "Designs" }}</h3> </header> <main> - {{ .Get "View the 600+ different Euro-coin designs!" }} + {{ .Get "View the 600+ different Euro-coin designs" }} </main> </article> </a> @@ -26,7 +26,7 @@ <h3>{{ .Get "Mintages" }}</h3> </header> <main> - {{ .Get "View the mintage figures of all the Euro coins!" }} + {{ .Get "View the mintage figures of all the Euro coins" }} </main> </article> </a> @@ -36,7 +36,7 @@ <h3>{{ .Get "Varieties" }}</h3> </header> <main> - {{ .Get "View all the known Euro varieties!" }} + {{ .Get "View all the known Euro varieties" }} </main> </article> </a> diff --git a/src/templates/collecting-crh.html.tmpl b/src/templates/collecting-crh.html.tmpl index bbca883..5e91e7b 100644 --- a/src/templates/collecting-crh.html.tmpl +++ b/src/templates/collecting-crh.html.tmpl @@ -1,207 +1,145 @@ {{ define "content" }} <header> {{ template "navbar" . }} - <h1>{{ .T "Coin Roll Hunting" }}</h1> + <h1>{{ .Get "Coin Roll Hunting" }}</h1> </header> <main> - <h2>{{ .T "What is Coin Roll Hunting?" }}</h2> + <h2>{{ .Get "What is Coin Roll Hunting?" }}</h2> <p> - {{ .T ` - Coin roll hunting is a popular method of coin collecting in which - you withdrawal cash from your bank in the form of coins which you - then search through to find new additions to your collection. Once - you’ve searched through all your coins, you will typically deposit - your left over coins at the bank and withdrawal new coins. - ` }} + {{ .Get "Coin roll hunting is a popular method of coin collecting in which you withdraw cash from your bank in the form of coins and then search through those coins to find new additions to your collection. Once you’ve searched through all your coins, you will typically deposit your left over coins at the bank and withdraw new coins." }} </p> <p> - {{ .T ` - This type of coin collecting is often called ‘Coin Roll Hunting’ - due to the fact that coins are often withdrawn in paper-wrapped - rolls. You may however find that your coins come in plastic bags - instead (common in countries like Ireland). - ` }} + {{ .Get "This type of coin collecting is often called ‘coin roll hunting’ (abbreviated to ‘CRH’) due to the fact that banks will often provide you with coins in the form of paper-wrapped rolls. You may however find that your coins come in plastic bags instead (common in countries like Ireland)." }} </p> <p> - {{ .T ` - Depending on your bank and branch, the process of obtaining coins - may differ. Some banks require you speak to a teller, others have - coin machines. Some banks may also require that you are a customer - or even to have a business account. If you aren’t sure about if - you can get coins we suggest you contact your bank, although - further down this page we also have information about the - withdrawal of coins in various countries and major banks. - ` }} + {{ .Get "Depending on your bank and branch, the process of obtaining coins may differ. Some banks require you speak to a teller while others have coin machines. Some banks may also require that you are a customer or even that you have a business account. If you aren’t sure about if you can get coins we suggest you contact your bank, although further down this page we also have additional information about the withdrawal of coins in various countries and major banks." }} </p> - <h2>{{ .T "Getting Started" }}</h2> + <h2>{{ .Get "Getting Started" }}</h2> <p> - {{ .T ` - To get started with coin roll hunting you should first contact your - bank or check their website to find details regarding coin - withdrawal. You will then typically need to go to the bank to pick - up your coins. Depending on your bank you may be able to - withdrawal coins from a machine, although often you can pick up - your coins from the banks tellers. You will also often need to pay - a small fee for each roll, although some banks don’t charge fees. - ` }} + {{ .Get "To get started with coin roll hunting you should first contact your bank or check their website to find details regarding coin withdrawal. You will then typically need to go to the bank to pick up your coins. Depending on your bank you may be able to withdrawal coins from a machine. Most banks will charge you a small fee per roll and/or transaction." }} </p> <p> - {{ .T ` - It is also important to find details regarding the deposit of - coins. Depositing coins often also requires the payment of a fee - — one which is typically more expensive than the withdrawal fees. - If depositing your coins is too expensive you can always exchange - your left over coins at shops for banknotes. It is often cheaper - (or even free) to deposit banknotes. - ` }} + {{ .Get "It is also important to find details regarding the deposit of coins. Depositing coins often also requires the payment of a fee — one which is typically more expensive than the withdrawal fees. If depositing your coins is too expensive you can always exchange your left over coins at shops for banknotes. It is often cheaper (or even free) to deposit banknotes." }} </p> <p> - {{ .T ` - In some countries such as Austria it is even common to be able to - withdrawal new coins from your account by exchanging the left over - coins you already have. - ` }} + {{ .Get "In some countries such as Austria it is even common to be able to withdraw new coins from your account using other coins." }} </p> - <h2>{{ .T "Country-Specific Details" }}</h2> + <h2>{{ .Get "Country-Specific Details" }}</h2> <p> - {{ .T ` - Below you can find all sorts of country-specific information we - have regarding obtaining coin rolls. We lack a lot of information - for many of the countries, so if you have any additional - information such as your banks fees, the availability of coin roll - machines, etc. feel free to contact us! You can find our contact - information %shere%s.` - `<a href="/about" target="_blank">` `</a>` | safe - }} + {{ .Get "Below you can find country-specific details we have regarding obtaining coin rolls. We lack a lot of information for many of the countries, so if you have any additional information such as your banks fees, the availability of coin roll machines, etc. feel free to contact us! You can find our contact information {Link:l}here{-:E}." + (map "Link" "/about") }} </p> <p> - {{ .T ` - Be aware of the face that the information below is prone to being - outdated, and as such may not reflect the current reality. - ` }} + {{ .Get "Be aware of the fact that the information below may be outdated or inaccurate. Many of the details are self-reported." }} </p> {{ $p := .Printer }} {{ range .Countries }} - <details id={{ .Code }}> - <summary>{{ $p.T .Name }}</summary> + <details id="{{ .Code }}"> + <summary>{{ $p.Get .Name }}</summary> {{ if eq .Code "ad" }} <p> - {{ $p.T ` - Coin rolls can be obtained from Andbank, Crèdit Andorrà, and - MoraBanc. All three of these banks require that you are a - customer to get rolls. There have however been reports of - individuals managing to get rolls without any fees and without - being a customer by simply asking kindly at the bank. - ` }} + {{ $p.Get "Coin rolls can be obtained from Andbank, Creand and MoraBanc. All three of these banks require that you are a customer to get rolls, however there have been reports of individuals managing to get rolls without any fees and without being a customer by simply asking kindly at the bank." }} </p> {{ else if eq .Code "at" }} + {{/* TRANSLATORS: The OeNB prefers ‘Oe’ over ‘Ö’ */}} + {{ makeHeaderWithTranslations "h3" + ($p.Get "Austrian National Bank") + (tuple "de" "Oesterreichische Nationalbank") }} <p> - {{ $p.T ` - The Austrian National Bank does not distribute circulated rolls - but sells rolls of commemorative coins at face value on release - as well as uncirculated rolls for all denominations. - ` }} + {{ $p.Get "The Austrian National Bank does not distribute circulated rolls but sells rolls of commemorative coins at face value on release as well as uncirculated rolls for all denominations." }} </p> - <h3>Bank Austria</h3> + {{ makeHeaderWithTranslations "h3" + ($p.Get "Bank Austria") + (tuple "de" "Bank Austria") }} <p> - {{ $p.T ` - There is a fee of %s per roll. Rolls can be purchased with - cash at machines. These machines are available to everyone, - but not in all branches. Look for the ‘Münzrollengeber’ filter - option %shere%s.` - ($p.M 0.20) - `<a - href="https://filialen.bankaustria.at/de/" - target="_blank" - >` - `</a>` | safe - }} + {{ $link := ifElse (eq $p.Language "de") + "https://filialen.bankaustria.at/de" + "https://filialen.bankaustria.at/en" }} + {{/* TRANSLATORS: On the German page the filter is called ‘Münzrollengeber’. For other languages we link to the English site, so mention the English filter name surrounded by ‘{EnglishStart:r}’ and ‘{EnglishEnd:E}’, and also translate it in parenthesis to your language. For example the Swedish page might say: ‘”{EnglishStart:r}coin roll dispenser{EnglishEnd:E}” (svenska: ”myntrullsautomat”)’ */}} + {{ $p.Get "There is a fee of {€0,20:m} per roll which can be purchased with cash at machines. These machines are available to everyone but not in all branches. Look for the ‘coin roll dispenser’ filter option {Link:L}here{-:E}." + (map "€0,20" 0.20 "Link" $link "EnglishStart" + `<span lang="en"><em>` "EnglishEnd" "em,span") | safe }} </p> - <h3>Erste Bank</h3> + {{ makeHeaderWithTranslations "h3" + ($p.Get "Erste Bank") + (tuple "de" "Erste Bank") }} <p> - {{ $p.T ` - There is a fee of %s per roll. You must be a customer to use - machines to get rolls. Rolls have no fees when purchased at - counters, but counters redirect you to machines if they work; - counters accept cash. You must present an Erste Bank card to - buy rolls from machines, but you can pay with cash.` - ($p.M 0.10) - }} + {{ $p.Get "There is a fee of {€0,10:m} per roll. You must be a customer to use machines to get rolls. Rolls have no fees when purchased at counters, but you will probably be redirected to the machines if they work. You must present an Erste Bank card to buy rolls from machines, however payment in cash is still accepted." + (map "€0,10" 0.10) }} </p> <p> - {{ $p.T ` - Depositing coins is free for up to %s a day, at which point you - pay 1%% for any additional deposited coins. You must also be a - customer. Depositing coins is free for all Erste Bank - customers at Dornbirner Sparkasse with no limit.` - ($p.M 100) - }} + {{ $p.Get "Depositing coins is free up to {€100:m} a day, at which point you pay 1% for any additionally deposited coins. You must also be a customer. Depositing coins is free for all Erste Bank customers at Dornbirner Sparkasse with no limit." + (map "€100" 100) }} </p> - <h3>Raiffeisenbank</h3> + {{ makeHeaderWithTranslations "h3" + ($p.Get "Raiffeisen Bank") + (tuple "de" "Raiffeisen Bank") }} <p> - {{ $p.T ` - There is a fee of %s per roll if you aren’t a customer, and %s - otherwise. Coin deposits are free if you’re a customer.` - ($p.M 1.00) ($p.M 0.30) - }} + {{ $p.Get "There is a fee of {€1:m} per roll if you aren’t a customer and {€0,30:m} otherwise. Coin deposits are free for customers." + (map "€1" 1 "€0,30" 0.30) }} </p> - <h3>Volksbank</h3> - <p> - {{ $p.T ` - Reportedly fee-less with no need of being a customer, but this - is unconfirmed. - ` }} - </p> + {{/* + {{ makeHeaderWithTranslations "h3" + ($p.Get "Volksbank") + (tuple "de" "Volksbank") }} + */}} + {{ else if eq .Code "be" }} - <h3>Argenta</h3> + + {{/* TRANSLATORS: Name of a bank */}} + {{ makeHeaderWithTranslations "h3" + ($p.Get "Argenta") + (tuple "" "Argenta") }} <p> - {{ $p.T "There is a %s fee with no limit on the number of rolls." - ($p.M 1.50) - }} + {{ $p.Get "There is a {€1,50:m} fee per transaction with no limit on the number of rolls you may take." + (map "€1,50" 1.50) }} </p> - <h3>{{ $p.T "Belgian Central Bank" }}</h3> + {{ makeHeaderWithTranslations "h3" + ($p.Get "National Bank of Belgium") + (tuple "nl" "Nationale Bank van België") + (tuple "fr" "Banque nationale de Belgique") + (tuple "de" "Belgische Nationalbank") }} <p> - {{ $p.T ` - You can visit the Belgian Central Bank in Brussels as an EU - citizen. You can order coin rolls for no fee up to %s in - value. They seem to distribute uncirculated coins (no - commemoratives).` - ($p.M 2000) - }} + {{ $p.Get "You can visit the National Bank of Belgium in Brussels as an EU citizen. You can order coin rolls for no fee up to {€2000:m} in value. They seem to distribute only uncirculated coins and no commemoratives." + (map "€2000" 2000) }} </p> - <h3>KBC</h3> + {{ makeHeaderWithTranslations "h3" + ($p.Get "KBC Bank") + (tuple "" "KBC Bank") }} <p> - {{ $p.T ` - Free for customers but getting coin rolls is still difficult - sometimes. Non-customers cannot get rolls. - ` }} + {{ $p.Get "Rolls can be obtained with no fee by customers only" }} </p> - <h3>Belfius</h3> + {{/* TRANSLATORS: Name of a bank */}} + {{ makeHeaderWithTranslations "h3" + ($p.Get "Belfius") + (tuple "" "Belfius") }} <p> - {{ $p.T ` - Free for customers when you order through their online - platform. - ` }} + {{ $p.Get "Rolls can be obtained with no fee when you order through their online platform." }} </p> + {{ else if eq .Code "cy" }} - <h3>{{ $p.T "Bank of Cyprus" }}</h3> + + {{ makeHeaderWithTranslations "h3" + ($p.Get "Bank of Cyprus") + (tuple "el" "Τράπεζα Κύπρου") + (tuple "tr" "Kıbrıs Bankası") }} <p> - {{ $p.T ` + {{ $p.Get ` At the Bank of Cyprus it is possible to buy bags of coins without being a customer, and without paying any additional fees. Depending on the branch you visit you may have coin roll @@ -212,18 +150,20 @@ ($p.M 2.00) }} </p> + {{ else if eq .Code "de" }} + <p> - {{ $p.T ` + {{ $p.Get ` Coin roll availability may vary across banks and branches, as well as the price. You must be a customer to purchase coin rolls unless specified otherwise. ` }} </p> - <h3>{{ $p.T "German Federal Bank (Deutsche Bundesbank)" }}</h3> + <h3>{{ $p.Get "German Federal Bank (Deutsche Bundesbank)" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` You can obtain regular- and commemorative coins for face value including 5-, 10-, and 20 euro coins. You do not need to be a customer although depending on your branch you may need to make @@ -234,14 +174,14 @@ <h3>Deutsche Post</h3> <p> - {{ $p.T ` + {{ $p.Get ` Hand-rolled coin rolls can be obtained with no additional fees. ` }} </p> <h3>Sparkasse</h3> <p> - {{ $p.T ` + {{ $p.Get ` Coin rolls can be obtained for a fee of %s–%s per roll. The amount varies per branch.` ($p.M 0.50) ($p.M 1.50) @@ -250,23 +190,23 @@ <h3>Volksbank</h3> <p> - {{ $p.T ` + {{ $p.Get ` Coin rolls can be obtained for a fee of %s per roll.` ($p.M 0.25) }} </p> {{ else if eq .Code "ee" }} <p> - {{ $p.T ` + {{ $p.Get ` Obtaining coin rolls in Estonia is typically quite difficult, and often expensive. You also often need to make an appointment in advance. ` }} </p> - <h3>{{ $p.T "Central Bank of Estonia Museum" }}</h3> + <h3>{{ $p.Get "Central Bank of Estonia Museum" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` You can purchase commemorative coins (even those released years ago) at face value. It is also an interesting museum to visit in general. @@ -274,11 +214,11 @@ </p> {{ else if eq .Code "es" }} <h3>Banco Santander</h3> - <p>{{ $p.T "Coin rolls are free but you must be a customer." }}</p> + <p>{{ $p.Get "Coin rolls are free but you must be a customer." }}</p> - <h3>{{ $p.T "Bank of Spain" }}</h3> + <h3>{{ $p.Get "Bank of Spain" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` You can purchase individual coins and commemorative coin rolls (even those of other countries). You can watch %shere%s to see how to do it.` @@ -294,19 +234,19 @@ <dl> <dt>Alicante</dt> <dd> - {{ $p.T ` + {{ $p.Get ` Coin rolls have a fee of %s for 5 rolls. This seems to vary by region.` ($p.M 2.00) }} </dd> <dt>Madrid</dt> - <dd>{{ $p.T "Coin rolls have no fees." }}</dd> + <dd>{{ $p.Get "Coin rolls have no fees." }}</dd> </dl> - <h3>{{ $p.T "La Caixa" }}</h3> + <h3>{{ $p.Get "La Caixa" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` Coin rolls have no fees and can be purchased with cash. You do not need to be a customer, although this needs to be re-verified. @@ -314,25 +254,25 @@ </p> {{ else if eq .Code "fi" }} <p> - {{ $p.T ` + {{ $p.Get ` Finland has no coin roll machines, but you can find vending machines or coin exchange machines (albeit they are rare). ` }} </p> <h3>Aktia</h3> - <p>{{ $p.T "Coin rolls can be obtained with no fees." }}</p> + <p>{{ $p.Get "Coin rolls can be obtained with no fees." }}</p> - <h3>{{ $p.T "Bank of Finland" }}</h3> + <h3>{{ $p.Get "Bank of Finland" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` It is probably not possible to obtain coin rolls, but this is not confirmed. ` }} </p> {{ else if eq .Code "fr" }} <p> - {{ $p.T ` + {{ $p.Get ` Coin roll machines are uncommon, only some banks have them and you need to be a customer. You may also need to order them in advance. @@ -341,15 +281,15 @@ <h3>Caisse d’Épargne</h3> <p> - {{ $p.T ` + {{ $p.Get ` Coin rolls can be obtained with no fee. You must be a customer. ` }} </p> - <h3>CIC {{ $p.T "and" }} Crédit Mutuel</h3> + <h3>CIC {{ $p.Get "and" }} Crédit Mutuel</h3> <p> - {{ $p.T ` + {{ $p.Get ` Free coin rolls if you are a customer or %s per roll if you are not a customer. There are coin roll machines.` ($p.M 1.00) @@ -358,7 +298,7 @@ <h3>Crédit Agricole</h3> <p> - {{ $p.T ` + {{ $p.Get ` Coin rolls can be obtained with no fee. You must be a customer. ` }} @@ -366,15 +306,15 @@ <h3>Le Crédit Lyonnais (LCL)</h3> <p> - {{ $p.T ` + {{ $p.Get ` There are coin roll machines but it is not yet known if you need to be a customer or if there are fees. ` }} </p> {{ else if eq .Code "gr" }} - <h3>{{ $p.T "Bank of Greece (Τράπεζα της Ελλάδος)" }}</h3> + <h3>{{ $p.Get "Bank of Greece (Τράπεζα της Ελλάδος)" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` Fee-less coin rolls for everyone (you will need to show ID). The latest commemorative coins are also sold for face value. ` }} @@ -382,7 +322,7 @@ <h3>Piraeus Bank</h3> <p> - {{ $p.T ` + {{ $p.Get ` Fee-less coin bags for everyone (no ID necessary). Smaller denominations are often not given out, and the coin bags you recieve are very large (there are reports of %s bags containing @@ -392,7 +332,7 @@ </p> {{ else if eq .Code "ie" }} <p> - {{ $p.T ` + {{ $p.Get ` In general, coin rolls are available at banks with a fee of %s per roll; rolls could potentially have no fee if you only need a few.` @@ -402,45 +342,45 @@ {{ else if eq .Code "it" }} <h3>Banca Cambiano</h3> <p> - {{ $p.T ` + {{ $p.Get ` There are coin roll machines but it is unknown if you need to be a customer or if there are additional fees. ` }} </p> - <h3>{{ $p.T "Bank of Italy" }}</h3> + <h3>{{ $p.Get "Bank of Italy" }}</h3> <p> - {{ $p.T "Coin rolls are available to everyone." }} + {{ $p.Get "Coin rolls are available to everyone." }} </p> {{ else if eq .Code "lt" }} <h3>ExchangeLT</h3> - <p>{{ $p.T "Works, but with very high fees (5%% of cost)." }}</p> + <p>{{ $p.Get "Works, but with very high fees (5%% of cost)." }}</p> <h3>Top Exchange</h3> <p> - {{ $p.T "Fee of %s per roll of 2 euro coins." ($p.M 2.00) }} + {{ $p.Get "Fee of %s per roll of 2 euro coins." ($p.M 2.00) }} </p> <h3>Lietuvos Bankas</h3> <p> - {{ $p.T ` + {{ $p.Get ` As far as we are aware, Lietuvos Bankas only distributes coin rolls to businesses. ` }} </p> <p> - {{ $p.T ` + {{ $p.Get ` It may be worth checking out payout machines to exchange banknotes into coins. ` }} </p> {{ else if eq .Code "lu" }} <h3> - {{ $p.T "Luxembourgish Central Bank (Banque Centrale du Luxembourg)" }} + {{ $p.Get "Luxembourgish Central Bank (Banque Centrale du Luxembourg)" }} </h3> <p> - {{ $p.T ` + {{ $p.Get ` We currently have no information regarding regular coins, however their webshop sells commemorative coins (for a high premium, but better than most resellers). Commemorative coins @@ -450,22 +390,22 @@ <h3>Dexia-Bank</h3> <p> - {{ $p.T ` + {{ $p.Get ` You should be able to get coin rolls with no additional fees. ` }} </p> {{ else if eq .Code "lv" }} <p> - {{ $p.T ` + {{ $p.Get ` In general coin rolls are sold with a fee of %s per roll, but we’re lacking a lot of information.` ($p.M 0.60) }} </p> {{ else if eq .Code "mt" }} - <h3>{{ $p.T "Bank of Valletta and HSBC Bank Malta" }}</h3> + <h3>{{ $p.Get "Bank of Valletta and HSBC Bank Malta" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` You can get rolls for a fee of %s per roll. You must order coin rolls through their online platform, and you must be a customer.` @@ -474,7 +414,7 @@ </p> {{ else if eq .Code "nl" }} <p> - {{ $p.T ` + {{ $p.Get ` Banks in the Netherlands do not carry cash, and as such it’s not possible to obtain rolls from bank tellers. Obtaining coins from the Dutch Central Bank (De Nederlandsche Bank) is @@ -492,7 +432,7 @@ </p> <p> - {{ $p.T ` + {{ $p.Get ` In order to be able to use a Geldmaat coin machine, you must be a customer of either ABN AMRO, ING, or Rabobank. You also cannot pay by cash, only card payments are allowed. All three @@ -503,25 +443,25 @@ <dl> <dt>ABN AMRO</dt> - <dd>{{ $p.T "%s per roll." ($p.M 0.30) }}</dd> + <dd>{{ $p.Get "%s per roll." ($p.M 0.30) }}</dd> <dt>ING</dt> <dd> - {{ $p.T "Base fee of %s + %s per roll." + {{ $p.Get "Base fee of %s + %s per roll." ($p.M 7.00) ($p.M 0.35) }} </dd> <dt>Rabobank</dt> <dd> - {{ $p.T "Base fee of %s + %s per roll." + {{ $p.Get "Base fee of %s + %s per roll." ($p.M 7.00) ($p.M 0.50) }} </dd> </dl> <p> - {{ $p.T ` + {{ $p.Get ` One- and two-cent coins have been removed from circulation and cannot be obtained. ` }} @@ -529,33 +469,33 @@ {{ else if eq .Code "pt" }} <h3>Banco Comercial Português</h3> <p> - {{ $p.T ` + {{ $p.Get ` Coin bags are sold with no additional fees to bank customers. ` }} </p> - <h3>{{ $p.T "Bank of Portugal (Banco de Portugal)" }}</h3> + <h3>{{ $p.Get "Bank of Portugal (Banco de Portugal)" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` Coin bags are sold with no additional fees to everyone. ` }} </p> {{ else if eq .Code "si" }} <p> - {{ $p.T "In general there is a %s fee for coin rolls." ($p.M 1.20) }} + {{ $p.Get "In general there is a %s fee for coin rolls." ($p.M 1.20) }} </p> - <h3>{{ $p.T "Bank of Slovenia (Banka Slovenije)" }}</h3> + <h3>{{ $p.Get "Bank of Slovenia (Banka Slovenije)" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` You can purchase commemorative coins for face value, and coin rolls are sold with no fees to everyone. ` }} </p> {{ else if eq .Code "sk" }} - <h3>{{ $p.T "National Bank of Slovakia (Národná banka Slovenska)" }}</h3> + <h3>{{ $p.Get "National Bank of Slovakia (Národná banka Slovenska)" }}</h3> <p> - {{ $p.T ` + {{ $p.Get ` You may be able to get uncirculated rolls, but this is not yet confirmed. ` }} @@ -563,7 +503,7 @@ <h3>Tatra Banka</h3> <p> - {{ $p.T ` + {{ $p.Get ` You can get an unlimited number of rolls for a %s fee. You must be a customer of the bank.` ($p.M 5.00) @@ -571,18 +511,15 @@ </p> {{ else if eq .Code "va" }} <p> - {{ $p.T ` + {{ $p.Get ` Ask the Pope nicely and he’ll probably give you some Vatican coins for free. ` }} </p> {{ else }} <p> - {{ $p.T ` - We currently have no information regarding coin roll hunting in - %s.` - ($p.T .Name) - }} + {{ $p.Get "We currently have no information regarding coin roll hunting in {Country}." + (map "Country" ($p.Get .Name)) }} </p> {{ end }} </details> diff --git a/src/templates/collecting.html.tmpl b/src/templates/collecting.html.tmpl index aacb442..fd14184 100644 --- a/src/templates/collecting.html.tmpl +++ b/src/templates/collecting.html.tmpl @@ -1,16 +1,11 @@ {{ define "content" }} <header> {{ template "navbar" . }} - <h1>{{ .T "Euro Coin Collecting" }}</h1> + <h1>{{ .Get "Euro Coin Collecting" }}</h1> </header> <main> <p> - {{ .T ` - On this section of the site you can find everything there is - to know about collecting Euro coins. If this is a hobby that - interests you, join the Discord server linked at the top of - the page! - ` }} + {{ .Get "On this section of the site you can find everything there is to know about collecting Euro coins. If this is a hobby that interests you, join the Discord server linked at the top of the page!" }} </p> <hr> <section> @@ -18,25 +13,20 @@ <a class="no-deco" href="/collecting/crh"> <article> <header> - <h3>{{ .T "Coin Roll Hunting" }}</h3> + <h3>{{ .Get "Coin Roll Hunting" }}</h3> </header> <main> - {{ .T ` - Learn about collecting coins from coin rolls! - ` }} + {{ .Get "Learn about collecting coins from coin rolls" }} </main> </article> </a> <a class="no-deco" href="/collecting/storage"> <article> <header> - <h3>{{ .T "Coin Storage" }}</h3> + <h3>{{ .Get "Coin Storage" }}</h3> </header> <main> - {{ .T ` - Learn about the different methods to storing - your collection! - `}} + {{ .Get "Learn about the different methods to storing your collection" }} </main> </article> </a> @@ -44,14 +34,10 @@ <a class="no-deco" href="#"> <article> <header> - <h3>{{ .T "Shop Hunting" }}</h3> + <h3>{{ .Get "Shop Hunting" }}</h3> </header> <main> - {{ .T ` - Learn about how to collect coins from - shop-keepers and other people who deal in - cash! - ` }} + {{ .Get "Learn about how to collect coins from shops" }} </main> </article> </a> @@ -60,13 +46,10 @@ <a class="no-deco" href="/collecting/vending"> <article> <header> - <h3>{{ .T "Vending Machine Hunting" }}</h3> + <h3>{{ .Get "Vending Machine Hunting" }}</h3> </header> <main> - {{ .T ` - Learn about collecting coins from vending - machines! - ` }} + {{ .Get "Learn about collecting coins from vending machines" }} </main> </article> </a> diff --git a/src/templates/jargon.html.tmpl b/src/templates/jargon.html.tmpl index 0dd1947..23847a4 100644 --- a/src/templates/jargon.html.tmpl +++ b/src/templates/jargon.html.tmpl @@ -1,114 +1,61 @@ {{ define "content" }} <header> {{ template "navbar" . }} - <h1>{{ .T "Euro Cash Jargon" }}</h1> + <h1>{{ .Get "Euro Cash Jargon" }}</h1> </header> <main> <p> - {{ .T ` - Both on this website and in other euro-cash-related forums there - are many terms you will come across that you may not immediately - understand. This page will hopefully get you up to speed with the - most important and frequently-used terminology. - ` }} + {{ .Get "Both on this website and in other related forums you will come across many terms that you may not be familiar with. This page will hopefully get you up to speed with the most important and frequently-used terminology." }} </p> <p> - {{ .T ` - All terms defined below can be used as clickable links which - highlight the selected term. It is recommended to use these links - when sharing this page with others, so that the relevant terms are - highlighted. - ` }} + {{ .Get "All terms defined below can be used as clickable links which highlight the selected term. It is recommended to use these links when sharing this page with others, so that the relevant terms are highlighted." }} </p> <hr /> - <!-- TODO: Sort these jargon entries in alphabetical order according to - the users locale --> - <h2>{{ .T "General Terms" }}</h2> + <!-- TODO: Sort these jargon entries in alphabetical order according + to the users locale --> + <h2>{{ .Get "General Terms" }}</h2> <dl> - {{ template "jargon/dt" (tuple "au" (.T "AU — Almost Uncirculated")) }} + {{ template "jargon/dt" (tuple "au" (.Get "AU — Almost Uncirculated")) }} <dd> - {{ .T ` - AU coins are coins that are in extremely good condition as a - result of limited use in circulation. Unlike the term ‘UNC’, this - term is a description of the coins quality, not its usage. AU - coins often appear to retain most of their original luster as - well as possessing little-to-no scratches or other forms of - post-mint damage (PMD). - ` }} + {{ .Get "AU coins are coins that are in extremely good condition as a result of limited use in circulation. Unlike the term ‘UNC’, this term is a description of the coins quality, not its usage. AU coins often appear to retain most of their original luster as well as possessing little to no scratches or other forms of post-mint damage (PMD)." }} </dd> - {{ template "jargon/dt" (tuple "bu" (.T "BU — Brilliantly Uncirculated")) }} + + {{ template "jargon/dt" (tuple "bu" (.Get "BU — Brilliantly Uncirculated")) }} <dd> - {{ .T ` - BU is a general term to refer to coins from coincards and - -sets. These are different from UNC coins in that they are - typically handled with more care during the minting process and - are struck with higher-quality dies than the coins minted for - coin rolls resulting in a higher-quality end product. You may - also see these coins referred to by the French term ‘fleur de - coin’. - ` }} + {{ .Get "BU is a general term to refer to coins from coincards and sets. These are different from UNC coins in that they are typically handled with more care during the minting process and are struck with higher-quality dies than coins minted for general circulation, resulting in a higher-quality coin." }} </dd> - {{ template "jargon/dt" (tuple "nifc" (.T "NIFC — Not Intended For Circulation")) }} + + {{ template "jargon/dt" (tuple "nifc" (.Get "NIFC — Not Intended For Circulation")) }} <dd> <p> - {{ .T ` - NIFC coins are coins minted without the intention of being put - into general circulation. These coins are typically minted with - the purpose of being put into coincards or coin-sets to be sold - to collectors. Occasionally they are also handed out to - collectors for face value at banks. - ` }} + {{ .Get "NIFC coins are coins minted without the intention of being put into general circulation. These coins are typically minted with the purpose of being put into coincards or sets to be sold to collectors. Occasionally they are also handed out to collectors for face value at banks." }} </p> <p> - {{ .T ` - While uncommon, NIFC coins are occasionally found in - circulation. This can happen for a variety of reasons such as - someone depositing their coin collection (known as a - ‘collection dump’), or a collector’s child spending their rare - coins on an ice cream. Some coin mints have also been known to - put NIFC coins that have gone unsold for multiple years into - circulation. - ` }} + {{ .Get "While uncommon, NIFC coins are occasionally found in circulation. This can happen for a variety of reasons such as someone depositing their coin collection (known as a ‘collection dump’) or a collector’s child spending their rare coins on an ice cream. Some coin mints have also been known to put NIFCs that have gone unsold for multiple years into circulation." }} </p> </dd> - {{ template "jargon/dt" (tuple "pmd" (.T "PMD — Post-Mint Damage")) }} + + {{ template "jargon/dt" (tuple "pmd" (.Get "PMD — Post-Mint Damage")) }} <dd> - {{ .T ` - Post-mint damage is any damage that a coin has sustained outside - of the minting process, such as through being dropped on the - ground, hit against a table, etc. - ` }} + {{ .Get "Post-mint damage is any damage that a coin has sustained outside of the minting process, such as through being dropped on the ground, hit against a table, etc." }} </dd> - {{ template "jargon/dt" (tuple "relief" (.T "Relief")) }} + + {{ template "jargon/dt" (tuple "relief" (.Get "Relief")) }} <dd> - {{ ` - Relief is a term that is used to describe how 3-dimensional a - coin is. Coins with a higher relief have designs that make - greater use of the 3rd dimension while coins with lower relief - have designs that appear more flat. - ` }} + {{ "Relief is a term that is used to describe how 3-dimensional a coin is. Coins with a higher relief have designs that make greater use of the 3rd dimension while coins with lower relief have designs that appear more flat." }} </dd> - {{ template "jargon/dt" (tuple "unc" (.T "UNC — Uncirculated")) }} + + {{ template "jargon/dt" (tuple "unc" (.Get "UNC — Uncirculated")) }} <dd> - {{ .T ` - Uncirculated coins are coins that have never been used in a - monetary exchange. The term ‘UNC’ is often mistakenly used to - refer to coins in very good condition, but this is incorrect. A - coin in poor condition that has never been circulated is still - considered an ‘UNC’ coin. - ` }} + {{ .Get "Uncirculated coins are coins that have never been used in a monetary exchange. The term ‘UNC’ is often mistakenly used to refer to coins in very good condition, but this is incorrect. A coin in poor condition that has never been circulated is still considered an ‘UNC’ coin." }} </dd> </dl> - <h2>{{ .T "Collector-Specific Terms" }}</h2> + + <h2>{{ .Get "Collector-Specific Terms" }}</h2> <dl> - {{ template "jargon/dt" (tuple "crh" (.T "CRH — Coin Roll Hunting")) }} + {{ template "jargon/dt" (tuple "crh" (.Get "CRH — Coin Roll Hunting")) }} <dd> - {{ .T ` - Coin roll hunting is a general term for the activity of searching - through coin rolls and -bags to find coins for a collection. Coin - rolls and bags are often obtained at banks or coin roll - machines. - ` }} + {{ .Get "Coin roll hunting is a general term for the activity of collecting coins by searching through coin rolls and -bags. Coin rolls and -bags are often obtained at banks or coin roll machines." }} </dd> </dl> </main> @@ -116,8 +63,8 @@ {{ define "jargon/dt" }} <dt> - <a id={{ index . 0 }} href=#{{ index . 0 }}> + <a id="{{ index . 0 }}" href="#{{ index . 0 }}"> {{ index . 1 }} </a> </dt> -{{ end }} +{{ end }}
\ No newline at end of file diff --git a/src/templates/language.html.tmpl b/src/templates/language.html.tmpl index 13a8e85..e3b6fcd 100644 --- a/src/templates/language.html.tmpl +++ b/src/templates/language.html.tmpl @@ -1,16 +1,76 @@ +{{ define "header" }} +<style> + .lang-fade-in-out { + transition: opacity 1s; + + &.hide { + opacity: 0; + } + } +</style> + +<script> + (() => { + let i = -1; + let nodes; + const Δt = 5000; /* Total time a text is shown */ + const Δf = 1000; /* Fade duration */ + const texts = [ + {{ $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 change = () => { + nodes.forEach(n => n.classList.add("hide")); + setTimeout(() => { + i = (i + 1) % texts.length; + nodes.forEach((n, j) => { + const [lang, ...strs] = texts[i]; + n.lang = lang; + n.textContent = strs[j]; + n.classList.remove("hide"); + }); + }, Δf); + }; + + document.addEventListener("DOMContentLoaded", _ => { + nodes = $$('.lang-fade-in-out'); + change(); + setInterval(change, Δt); + }); + })(); +</script> +{{ end }} + {{ define "content" }} <header> {{ template "navbar" . }} - <h1>{{ .Get "Select Your Language" }}</h1> + <h1> + {{ .Get "Select Your Language" }} + <br><span class="lang-fade-in-out translation"> </span> + </h1> </header> <main> - <p> - {{ .Get "Select your preferred language to use on the site." }} - </p> - <hr /> - <h2>{{ .Get "Eurozone Languages" }}</h2> + <h2> + {{ .Get "Eurozone Languages" }} + <br><span class="lang-fade-in-out translation"> </span> + </h2> {{ template "langgrid" true }} - <h2>{{ .Get "Other Languages" }}</h2> + <h2> + {{ .Get "Other Languages" }} + <br><span class="lang-fade-in-out translation"> </span> + </h2> {{ template "langgrid" false }} </main> {{ end }} |