diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/base.go | 5 | ||||
-rw-r--r-- | templates/navbar.templ | 2 | ||||
-rw-r--r-- | templates/navbar_templ.go | 2 | ||||
-rw-r--r-- | templates/root.templ | 8 | ||||
-rw-r--r-- | templates/root_templ.go | 43 |
5 files changed, 21 insertions, 39 deletions
diff --git a/templates/base.go b/templates/base.go index f0b288b..e6647f2 100644 --- a/templates/base.go +++ b/templates/base.go @@ -1,8 +1,3 @@ package templates -const ( - PrinterKey = "printer" - LocaleKey = "locale" -) - //go:generate templ generate -log-level warn diff --git a/templates/navbar.templ b/templates/navbar.templ index 95e8563..5007183 100644 --- a/templates/navbar.templ +++ b/templates/navbar.templ @@ -3,7 +3,7 @@ package templates import "git.thomasvoss.com/euro-cash.eu/i18n" templ navbar() { - {{ p := ctx.Value(PrinterKey).(i18n.Printer) }} + {{ p := ctx.Value("printer").(i18n.Printer) }} <nav> <menu> diff --git a/templates/navbar_templ.go b/templates/navbar_templ.go index 90fa955..942f644 100644 --- a/templates/navbar_templ.go +++ b/templates/navbar_templ.go @@ -28,7 +28,7 @@ func navbar() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - p := ctx.Value(PrinterKey).(i18n.Printer) + p := ctx.Value("printer").(i18n.Printer) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<nav><menu><li><a href=\"/\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err diff --git a/templates/root.templ b/templates/root.templ index 722aa2c..7a565ae 100644 --- a/templates/root.templ +++ b/templates/root.templ @@ -4,7 +4,7 @@ import "strings" import "git.thomasvoss.com/euro-cash.eu/i18n" templ Root(head, body templ.Component) { - {{ p := ctx.Value(PrinterKey).(i18n.Printer) }} + {{ p := ctx.Value("printer").(i18n.Printer) }} <!DOCTYPE html> <html lang={ p.Lang } data-theme="dark"> @@ -34,7 +34,7 @@ templ Root(head, body templ.Component) { } templ Index() { - {{ p := ctx.Value(PrinterKey).(i18n.Printer) }} + {{ p := ctx.Value("printer").(i18n.Printer) }} <header> @navbar() @@ -49,7 +49,7 @@ templ Index() { } templ SetLanguage() { - {{ p := ctx.Value(PrinterKey).(i18n.Printer) }} + {{ p := ctx.Value("printer").(i18n.Printer) }} <header> @navbar() @@ -83,7 +83,7 @@ templ languageGrid(eurozone bool) { if loc.Eurozone == eurozone { <button type="submit" - name={ LocaleKey } + name="locale" value={ loc.Code } disabled?={ !loc.Enabled } > diff --git a/templates/root_templ.go b/templates/root_templ.go index d35ddd2..14e434c 100644 --- a/templates/root_templ.go +++ b/templates/root_templ.go @@ -29,7 +29,7 @@ func Root(head, body templ.Component) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - p := ctx.Value(PrinterKey).(i18n.Printer) + p := ctx.Value("printer").(i18n.Printer) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html lang=\"") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -115,7 +115,7 @@ func Index() templ.Component { templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - p := ctx.Value(PrinterKey).(i18n.Printer) + p := ctx.Value("printer").(i18n.Printer) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<header>") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -215,7 +215,7 @@ func SetLanguage() templ.Component { templ_7745c5c3_Var11 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - p := ctx.Value(PrinterKey).(i18n.Printer) + p := ctx.Value("printer").(i18n.Printer) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<header>") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -324,29 +324,16 @@ func languageGrid(eurozone bool) templ.Component { } for _, loc := range i18n.Locales { if loc.Eurozone == eurozone { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"submit\" name=\"") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"submit\" name=\"locale\" value=\"") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var17 string - templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(LocaleKey) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `root.templ`, Line: 86, Col: 22} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" value=\"") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var18 string - templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(loc.Code) + templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(loc.Code) if templ_7745c5c3_Err != nil { return templ.Error{Err: templ_7745c5c3_Err, FileName: `root.templ`, Line: 87, Col: 22} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -364,12 +351,12 @@ func languageGrid(eurozone bool) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var19 string - templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(loc.Code) + var templ_7745c5c3_Var18 string + templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(loc.Code) if templ_7745c5c3_Err != nil { return templ.Error{Err: templ_7745c5c3_Err, FileName: `root.templ`, Line: 91, Col: 22} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -377,12 +364,12 @@ func languageGrid(eurozone bool) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var20 string - templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(strings.ToUpper(loc.Language())) + var templ_7745c5c3_Var19 string + templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(strings.ToUpper(loc.Language())) if templ_7745c5c3_Err != nil { return templ.Error{Err: templ_7745c5c3_Err, FileName: `root.templ`, Line: 92, Col: 50} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -390,12 +377,12 @@ func languageGrid(eurozone bool) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var21 string - templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(loc.Name) + var templ_7745c5c3_Var20 string + templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(loc.Name) if templ_7745c5c3_Err != nil { return templ.Error{Err: templ_7745c5c3_Err, FileName: `root.templ`, Line: 94, Col: 17} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } |