github.com/gogf/gf@v1.16.9/.example/i18n/gi18n/gi18n.go (about) 1 package main 2 3 import ( 4 "context" 5 "fmt" 6 "github.com/gogf/gf/frame/g" 7 "github.com/gogf/gf/i18n/gi18n" 8 ) 9 10 func main() { 11 var ( 12 orderId = 865271654 13 orderAmount = 99.8 14 ) 15 fmt.Println(g.I18n().Tf( 16 gi18n.WithLanguage(context.TODO(), `en`), 17 `{#OrderPaid}`, orderId, orderAmount, 18 )) 19 fmt.Println(g.I18n().Tf( 20 gi18n.WithLanguage(context.TODO(), `zh-CN`), 21 `{#OrderPaid}`, orderId, orderAmount, 22 )) 23 }