ii18-是一个Go的i18库,采用MIT开源协议。通过读取翻译映射格式的配置文件来实现多语言翻译。使用起来非常简单方便。
下载安装go get github.com/syyogx/ii18快速开始import github.com/syyogx/ii18fuc mai() { cofig := map[strig]Cofig{ "app": Cofig{ SourceNewFuc: NewJSONSource, OrigialLag: "e-US", BasePath: "./testdata", FileMap: map[strig]strig{ "app": "app.jso", "error": "error.jso", }, }, } NewI18N(cofig) message := T("app", "hello", il, "zh-CN")}ApisNewI18N(cofig map[strig]Cofig) *I18NT(category strig, message strig, params map[strig]strig, lag strig) strig配置文件参考testdata目录。
评论