l10n

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const LocaleCode l10nContextKey = iota

Variables

This section is empty.

Functions

func IsLocalizable

func IsLocalizable(obj interface{}) (isLocalizable bool)

func IsLocalizableFromCtx

func IsLocalizableFromCtx(ctx context.Context) (localeCode string, isLocalizable bool)

Types

type Builder

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

func New

func New() *Builder

func (*Builder) EnsureLocale

func (b *Builder) EnsureLocale(in http.Handler) (out http.Handler)

func (*Builder) GetAllLocalePaths

func (b *Builder) GetAllLocalePaths() []string

func (*Builder) GetCookieName

func (b *Builder) GetCookieName() string

func (*Builder) GetCorrectLocaleCode

func (b *Builder) GetCorrectLocaleCode(r *http.Request) string

func (*Builder) GetCurrentLocaleCodeFromCookie

func (b *Builder) GetCurrentLocaleCodeFromCookie(r *http.Request) (localeCode string)

func (*Builder) GetLocaleLabel

func (b *Builder) GetLocaleLabel(localeCode string) string

func (*Builder) GetLocalePath

func (b *Builder) GetLocalePath(localeCode string) string

func (*Builder) GetQueryName

func (b *Builder) GetQueryName() string

func (*Builder) GetSupportLocaleCodes

func (b *Builder) GetSupportLocaleCodes() []string

func (*Builder) GetSupportLocaleCodesFromRequest

func (b *Builder) GetSupportLocaleCodesFromRequest(R *http.Request) []string

func (*Builder) GetSupportLocaleCodesFromRequestFunc

func (b *Builder) GetSupportLocaleCodesFromRequestFunc(v func(R *http.Request) []string) (r *Builder)

func (*Builder) IsTurnedOn

func (b *Builder) IsTurnedOn() bool

func (*Builder) RegisterLocales

func (b *Builder) RegisterLocales(localeCode, localePath, localeLabel string) (r *Builder)

type L10nInterface

type L10nInterface interface {
	SetLocale(locale string)
	GetLocale() string
}

type L10nONInterface

type L10nONInterface interface {
	L10nON()
}

type Locale

type Locale struct {
	LocaleCode string `sql:"size:20" gorm:"primary_key;default:''"`
}

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

func (Locale) GetLocale

func (l Locale) GetLocale() string

GetLocale get model's locale

func (*Locale) SetLocale

func (l *Locale) SetLocale(locale string)

SetLocale set model's locale

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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