You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
601 B
Go
52 lines
601 B
Go
package template
|
|
|
|
import "html/template"
|
|
|
|
// list of embedded template files.
|
|
var files = []struct {
|
|
name string
|
|
data string
|
|
}{
|
|
{
|
|
name: "en.tmpl",
|
|
data: en,
|
|
}, {
|
|
name: "es.tmpl",
|
|
data: es,
|
|
},
|
|
}
|
|
|
|
// T exposes the embedded templates.
|
|
var T *template.Template
|
|
|
|
func init() {
|
|
T = template.New("_").Funcs(funcMap)
|
|
for _, file := range files {
|
|
T = template.Must(
|
|
T.New(file.name).Parse(file.data),
|
|
)
|
|
}
|
|
}
|
|
|
|
//
|
|
// embedded template files.
|
|
//
|
|
|
|
// files/en.tmpl
|
|
|
|
var en = `<html>
|
|
<body>
|
|
Hello world
|
|
</body>
|
|
</html>
|
|
`
|
|
|
|
// files/es.tmpl
|
|
|
|
var es = `<html>
|
|
<body>
|
|
Hola Mundo
|
|
</body>
|
|
</html>
|
|
`
|