Trying to create I18nText
This commit is contained in:
+6
-1
@@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
type HtmxContext interface {
|
type HtmxContext interface {
|
||||||
Render(node gomponents.Node)
|
Render(node gomponents.Node)
|
||||||
|
GetLanguage() Language
|
||||||
}
|
}
|
||||||
|
|
||||||
type HtmxContextImpl struct {
|
type HtmxContextImpl struct {
|
||||||
@@ -15,11 +16,15 @@ type HtmxContextImpl struct {
|
|||||||
res http.ResponseWriter
|
res http.ResponseWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *HtmxContextImpl) GetLanguage() Language {
|
||||||
|
return En
|
||||||
|
}
|
||||||
|
|
||||||
func NewHtmxContext(req *http.Request, res http.ResponseWriter) HtmxContext {
|
func NewHtmxContext(req *http.Request, res http.ResponseWriter) HtmxContext {
|
||||||
return &HtmxContextImpl{req: req, res: res}
|
return &HtmxContextImpl{req: req, res: res}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *HtmxContextImpl) Render(node gomponents.Node) {
|
func (c *HtmxContextImpl) Render(node gomponents.Node) {
|
||||||
err := node.Render(w.res)
|
err := node.Render(w.res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Error("failed to render", err)
|
Error("failed to render", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user