i18n

package
v0.0.0-...-a0045c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LOCALE locale key
	LOCALE = "locale"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type I18n

type I18n struct {
	Store   Store            `inject:""`
	Cache   *cache.Cache     `inject:""`
	Matcher language.Matcher `inject:""`
}

I18n i18n

func (*I18n) All

func (p *I18n) All(lang string) (map[string]interface{}, error)

All all items

func (*I18n) E

func (p *I18n) E(lang, code string, args ...interface{}) error

E create an i18n error

func (*I18n) F

func (p *I18n) F(lang, code string, obj interface{}) (string, error)

F format message

func (*I18n) Load

func (p *I18n) Load(dir string) error

Load sync records

func (*I18n) Middleware

func (p *I18n) Middleware(c *gin.Context)

Middleware locale-middleware

func (*I18n) Set

func (p *I18n) Set(lang, code, message string) error

Set update locale

func (*I18n) T

func (p *I18n) T(lang, code string, args ...interface{}) string

T translate by lang tag

type Store

type Store interface {
	Set(lang, code, message string, override bool) error
	Get(lang, code string) (string, error)
	All(lang string) (map[string]string, error)
	Del(lang, code string) error
	Languages() ([]string, error)
}

Store store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL