另客网go项目公用的代码库

language.go 280B

123456789101112131415
  1. package app
  2. import "github.com/Unknwon/i18n"
  3. func InitLang() {
  4. languages := []string{"en-US", "zh-CN"}
  5. for _, language := range languages {
  6. if err := i18n.SetMessage(language, "languages/"+language+".ini"); err != nil {
  7. panic(err)
  8. }
  9. }
  10. i18n.SetDefaultLang("en-US")
  11. }