gf/.example/i18n/gi18n/resource/gi18n-resource.go

21 lines
304 B
Go

package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
_ "github.com/gogf/gf/os/gres/testdata"
)
func main() {
m := g.I18n()
m.SetLanguage("ja")
err := m.SetPath("/i18n-dir")
if err != nil {
panic(err)
}
fmt.Println(m.Translate(`hello`))
fmt.Println(m.Translate(`{#hello}{#world}!`))
}