l10n

package module
v0.0.0-...-1a31cb6 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 14 Imported by: 1

README

L10n

L10n gives your GORM-backend models the ability to localize for different locales. It can be a catalyst for the adaptation of a product, application, or document content to meet the language, cultural, and other requirements of a specific target market.

GoDoc

Documentation

https://doc.getqor.com/plugins/l10n.html

License

Released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Global = "en-US"

Global global language

Functions

func IsLocalizable

func IsLocalizable(scope *aorm.Scope) (IsLocalizable bool)

IsLocalizable return model is localizable or not

func RegisterCallbacks

func RegisterCallbacks(db *aorm.DB)

RegisterCallbacks register callback into GORM DB

Types

type Locale

type Locale struct {
	LanguageCode string `sql:"size:20" gorm:"primary_key"`
}

Locale embed this struct into GROM-backend models to enable localization feature for your model

func (*Locale) ConfigureResource

func (l *Locale) ConfigureResource(res resource.Resourcer)

ConfigureResource configure qor locale for Admin

func (Locale) IsGlobal

func (l Locale) IsGlobal() bool

IsGlobal return if current locale is global

func (*Locale) SetLocale

func (l *Locale) SetLocale(locale string)

SetLocale set model's locale

type LocaleCreatable

type LocaleCreatable struct {
	Locale
}

LocaleCreatable if you embed it into your model, it will make the resource be creatable from locales, by default, you can only create it from global

func (LocaleCreatable) CreatableFromLocale

func (LocaleCreatable) CreatableFromLocale()

CreatableFromLocale a method to allow your mod=el be creatable from locales

type LocalizeActionArgument

type LocalizeActionArgument struct {
	From string
	To   []string
}

LocalizeActionArgument localize action's argument

type Plugin

type Plugin struct {
	db.DBNames
	plug.EventDispatcher
}

func (*Plugin) OnRegister

func (p *Plugin) OnRegister()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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