github.com/kaptinlin/jsonschema@v0.4.6/i18n.go (about)

     1  package jsonschema
     2  
     3  import (
     4  	"embed"
     5  
     6  	"github.com/kaptinlin/go-i18n"
     7  )
     8  
     9  //go:embed locales/*.json
    10  var localesFS embed.FS
    11  
    12  func GetI18n() (*i18n.I18n, error) {
    13  	bundle := i18n.NewBundle(
    14  		i18n.WithDefaultLocale("en"),
    15  		i18n.WithLocales("en", "zh-Hans"),
    16  	)
    17  
    18  	err := bundle.LoadFS(localesFS, "locales/*.json")
    19  
    20  	return bundle, err
    21  }