i18n

package
v0.0.0-...-00e0705 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EXT file ext
	EXT = ".ini"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type I18n

type I18n struct {
	// contains filtered or unexported fields
}

I18n i18n

func New

func New(db *pg.DB, c cache.Cache) *I18n

New load from database and filesystem

func (*I18n) All

func (p *I18n) All(l string) (map[string]string, error)

All get all items by lang

func (*I18n) E

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

E error

func (*I18n) H

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

H html

func (*I18n) Languages

func (p *I18n) Languages() ([]string, error)

Languages all available languages

func (*I18n) Set

func (p *I18n) Set(db orm.DB, lang, code, message string) error

Set set locale

func (*I18n) Sync

func (p *I18n) Sync(root string) error

Sync sync items from filesystem to database

func (*I18n) T

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

T text

type Model

type Model struct {
	ID        uint      `json:"id"`
	Lang      string    `json:"lang"`
	Code      string    `json:"code"`
	Message   string    `json:"message"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	// contains filtered or unexported fields
}

Model locale database model

Jump to

Keyboard shortcuts

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