i18n: github.com/qor/i18n Index | Files | Directories

package i18n

import "github.com/qor/i18n"

Index

Package Files

controller.go i18n.go

Variables

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: http://vitalets.github.io/x-editable/index.html 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
    FallbackLocales map[string][]string
    // 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) Fallbacks Uses

func (i18n *I18n) Fallbacks(locale ...string) admin.I18n

Fallbacks fallback to locale if translation doesn't exist in specified locale

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) SetCacheStore Uses

func (i18n *I18n) SetCacheStore(cacheStore cache.CacheStoreInterface)

SetCacheStore set i18n's cache store

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

Directories

PathSynopsis
backends/database
backends/yaml
exchange_actions
inline_edit

Package i18n imports 16 packages (graph) and is imported by 25 packages. Updated 2018-10-14. Refresh now. Tools for package owners.