mirror of
https://gitee.com/johng/gf.git
synced 2024-12-01 03:38:35 +08:00
27 lines
607 B
Go
27 lines
607 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/gogf/gf/i18n/gi18n"
|
|
)
|
|
|
|
func main() {
|
|
t := gi18n.New()
|
|
t.SetPath("/Users/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/.example/i18n/gi18n/i18n")
|
|
t.SetLanguage("en")
|
|
fmt.Println(t.Translate(`hello`))
|
|
fmt.Println(t.Translate(`{#hello}{#world}!`))
|
|
|
|
t.SetLanguage("ja")
|
|
fmt.Println(t.Translate(`hello`))
|
|
fmt.Println(t.Translate(`{#hello}{#world}!`))
|
|
|
|
t.SetLanguage("ru")
|
|
fmt.Println(t.Translate(`hello`))
|
|
fmt.Println(t.Translate(`{#hello}{#world}!`))
|
|
|
|
fmt.Println(t.Translate(`hello`, "zh-CN"))
|
|
fmt.Println(t.Translate(`{#hello}{#world}!`, "zh-CN"))
|
|
}
|