We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileSystem.LoadMessagesMap(domain, lang string) (map[string][]string, error)
map[domain][lang][msgid][]string
gettext/mapfs.NewXXX()
jsonString
map[string]interface{}
LoadJsonFile(domain, lang) ([]byte, error)
LoadMessagesFile("hello", "zh_CN", "json")
https://pkg.go.dev/github.com/chai2010/gettext-go
The text was updated successfully, but these errors were encountered:
在一个并发的api环境中,setlocale方法,切换了语言,如果保证当前请求的context上下文不会被其他的干扰呢? setlocale以后,再gettext调用,这时候很可能别的协程就把语言切换了,最后得到的不是想要的。
Sorry, something went wrong.
多语言支持:
func Example_multiLang() { zh := gettext.New("hello", "./examples/locale").SetLanguage("zh_CN") tw := gettext.New("hello", "./examples/locale").SetLanguage("zh_TW") fmt.Println(zh.PGettext( "code.google.com/p/gettext-go/examples/hi.SayHi", "pkg hi: Hello, world!", )) fmt.Println(tw.PGettext( "code.google.com/p/gettext-go/examples/hi.SayHi", "pkg hi: Hello, world!", )) // Output: // 来自"Hi"包的问候: 你好, 世界!(ctx:code.google.com/p/gettext-go/examples/hi.SayHi) // 來自"Hi"包的問候: 你好, 世界!(ctx:code.google.com/p/gettext-go/examples/hi.SayHi) }
好的,谢谢,清楚了。
chai2010
No branches or pull requests
FileSystem.LoadMessagesMap(domain, lang string) (map[string][]string, error)
/map[domain][lang][msgid][]string
/gettext/mapfs.NewXXX()
/jsonString
/map[string]interface{}
/LoadJsonFile(domain, lang) ([]byte, error)
LoadMessagesFile("hello", "zh_CN", "json")
, Json(s) FileSystemhttps://pkg.go.dev/github.com/chai2010/gettext-go
The text was updated successfully, but these errors were encountered: