8000 GitHub - kimi987/i18n: Use INI file, simple i18n manager implement. 使用INI文件,实现的简单的语言加载与管理
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ i18n Public
forked from gookit/i18n

Use INI file, simple i18n manager implement. 使用INI文件,实现的简单的语言加载与管理

License

Notifications You must be signed in to change notification settings

kimi987/i18n

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

i18n

GoDoc Build Status Coverage Status Go Report Card

Use INI files, simple i18n manager implement.

  • Easy to use,can load multi language, multi files
  • Support set default language, fallback language
  • Support parameter replacement

中文说明

Godoc

Usage

conf/
    lang/
        en.ini
        zh-CN.ini
        ...
  • init
    import "github/gookit/i18n"

    languages := map[string]string{
        "en": "English",
        "zh-CN": "简体中文",
        // "zh-TW": "繁体中文",
    }

    // The default instance initialized directly here
    i18n.Init("conf/lang", "en", languages)
    
    // Create a custom new instance
    // i18n.New(langDir string, defLang string, languages)
    // i18n.NewEmpty()
  • usage
    // translate from special language
    msg := i18n.Tr("en", "key")

    // translate from default language
    msg = i18n.DefTr("key")
    // with arguments. 
    msg = i18n.DefTr("key1", "arg1", "arg2")

Tests

go test -cover

Dep packages

License

MIT

About

Use INI file, simple i18n manager implement. 使用INI文件,实现的简单的语言加载与管理

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%
0