adsa-cms: Index | Files | Directories

package i18n

import ""


Package Files

controller.go i18n.go


var Default = "en-US"

Default default locale for i18n

func RenderInlineEditAssets Uses

func RenderInlineEditAssets(isIncludeJQuery bool, isIncludeExtendAssetLib bool) (template.HTML, error)

RenderInlineEditAssets render inline edit html, it is using: You could use Bootstrap or JQuery UI by set isIncludeExtendAssetLib to false and load files by yourself

type Backend Uses

type Backend interface {
    LoadTranslations() []*Translation
    SaveTranslation(*Translation) error
    DeleteTranslation(*Translation) error

Backend defined methods that needs for translation backend

type I18n Uses

type I18n struct {
    Resource *admin.Resource

    Backends   []Backend
    CacheStore cache.CacheStoreInterface
    // contains filtered or unexported fields

I18n struct that hold all translations

func New Uses

func New(backends ...Backend) *I18n

New initialize I18n with backends

func (*I18n) AddTranslation Uses

func (i18n *I18n) AddTranslation(translation *Translation) error

AddTranslation add translation

func (*I18n) ConfigureQorResource Uses

func (i18n *I18n) ConfigureQorResource(res resource.Resourcer)

ConfigureQorResource configure qor resource for qor admin

func (*I18n) Default Uses

func (i18n *I18n) Default(value string) admin.I18n

Default default value of translation if key is missing

func (*I18n) DeleteTranslation Uses

func (i18n *I18n) DeleteTranslation(translation *Translation) (err error)

DeleteTranslation delete translation

func (*I18n) LoadTranslations Uses

func (i18n *I18n) LoadTranslations() map[string]map[string]*Translation

LoadTranslations load translations as map `map[locale]map[key]*Translation`

func (I18n) ResourceName Uses

func (I18n) ResourceName() string

ResourceName change display name in qor admin

func (*I18n) SaveTranslation Uses

func (i18n *I18n) SaveTranslation(translation *Translation) error

SaveTranslation save translation

func (*I18n) Scope Uses

func (i18n *I18n) Scope(scope string) admin.I18n

Scope i18n scope

func (*I18n) T Uses

func (i18n *I18n) T(locale, key string, args ...interface{}) template.HTML

T translate with locale, key and arguments

type Translation Uses

type Translation struct {
    Key     string
    Locale  string
    Value   string
    Backend Backend `json:"-"`

Translation is a struct for translations, including Translation Key, Locale, Value



Package i18n imports 18 packages (graph) and is imported by 5 packages. Updated 2017-06-08. Refresh now. Tools for package owners.