- 授权协议: MIT
- 开发语言: Google Go
- 操作系统: 跨平台
- 软件首页: https://github.com/syyongx/ii18n
- 软件文档: http://www.syyong.com/Go/ii18n---Go-implements-an-i18n-library.html
- 官方下载: https://github.com/syyongx/ii18n/releases
软件介绍
ii18n - 是一个 Go 的 i18n 库,采用 MIT 开源协议。通过读取翻译映射格式的配置文件来实现多语言翻译。使用起来非常简单方便。
下载安装
go get github.com/syyongx/ii18n
快速开始
import github.com/syyongx/ii18n
func main() {
config := map[string]Config{
"app": Config{
SourceNewFunc: NewJSONSource,
OriginalLang: "en-US",
BasePath: "./testdata",
FileMap: map[string]string{
"app": "app.json",
"error": "error.json",
},
},
}
NewI18N(config)
message := T("app", "hello", nil, "zh-CN")
}Apis
NewI18N(config map[string]Config) *I18N T(category string, message string, params map[string]string, lang string) string
配置文件
参考 testdata 目录。
