mirror of
https://github.com/Luzifer/ots.git
synced 2025-05-02 14:26:17 -04:00
Add localization for en-US and de-DE
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
3d5e6712a7
commit
c74fb23cda
8 changed files with 253 additions and 28 deletions
15
main.go
15
main.go
|
@ -1,6 +1,6 @@
|
|||
package main
|
||||
|
||||
//go:generate go-bindata -pkg $GOPACKAGE -o assets.go ./frontend
|
||||
//go:generate go-bindata -pkg $GOPACKAGE -o assets.go ./frontend/...
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -9,6 +9,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
http_helpers "github.com/Luzifer/go_helpers/http"
|
||||
"github.com/Luzifer/rconfig"
|
||||
|
@ -73,5 +74,15 @@ func assetDelivery(res http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
res.Header().Set("Content-Type", mime.TypeByExtension(ext))
|
||||
res.Write(assetData)
|
||||
|
||||
tpl, err := template.New(assetName).Funcs(getTFuncMap(r)).Parse(string(assetData))
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("Template for asset %q has an error: %s", assetName, err)
|
||||
return
|
||||
}
|
||||
|
||||
tpl.Execute(res, map[string]interface{}{
|
||||
"version": version,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue