This package is built on top of text/language and text/message.
Please take a look of the following example:
$ cd i18n/example
$ go run main.go
## fallback language(default to English)
$ curl "http://localhost:1234"
Home
## retrieve prefered language from URL query
$ curl "http://localhost:1234?lang=zh"
主页
## retrieve prefered language Cookie
$ curl -b "lang=zh-Hant" "http://localhost:1234"
主頁
## retrieve prefered language from header
$ curl -H "Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-US;q=0.7,zh-TW;q=0.6,pt;q=0.5" "http://localhost:1234/hello?name=foo"
你好,foo
It is easy to integrate with other frameworks by Handler or Middleware, and then retrieves translator in handler by GetTranslator.