gf/.example/i18n/gi18n/http_view_i18n.go

19 lines
402 B
Go
Raw Normal View History

2019-09-08 21:12:11 +08:00
package main
import (
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/net/ghttp"
)
func main() {
g.I18n().SetPath("/Users/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/.example/i18n/gi18n/i18n")
2019-09-08 21:12:11 +08:00
s := g.Server()
s.BindHandler("/", func(r *ghttp.Request) {
2019-09-15 13:47:44 +08:00
r.Response.WriteTplContent(`{#hello}{#world}!`, g.Map{
"I18nLanguage": r.Get("lang", "zh-CN"),
})
2019-09-08 21:12:11 +08:00
})
s.SetPort(8199)
s.Run()
}