lang

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// PrinterKey is used with pkg/context.Context to provide language printer
	// facilities to funcmap features
	PrinterKey string = "LangPrinter"
)

Variables

This section is empty.

Functions

func BleveSupportedAnalyzer

func BleveSupportedAnalyzer(tag language.Tag) (ok bool)

func ParseLangPath

func ParseLangPath(p string) (tag language.Tag, modified string, ok bool)

Types

type DomainMode

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

func (*DomainMode) FromRequest

func (p *DomainMode) FromRequest(defaultTag language.Tag, r *http.Request) (tag language.Tag, path string, ok bool)

func (*DomainMode) Make

func (p *DomainMode) Make() Mode

func (*DomainMode) Name added in v0.5.0

func (p *DomainMode) Name() (name string)

func (*DomainMode) Set

func (p *DomainMode) Set(tag language.Tag, domain string) DomainModeBuilder

func (*DomainMode) ToUrl

func (p *DomainMode) ToUrl(defaultTag, tag language.Tag, path string) (translated string)

type DomainModeBuilder

type DomainModeBuilder interface {
	Set(tag language.Tag, domain string) DomainModeBuilder

	Make() Mode
}

func NewDomainMode

func NewDomainMode() (p DomainModeBuilder)

type Mode

type Mode interface {
	Name() (name string)
	ToUrl(defaultTag, tag language.Tag, path string) (translated string)
	FromRequest(defaultTag language.Tag, r *http.Request) (tag language.Tag, path string, ok bool)
}

type PathMode

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

func (*PathMode) FromRequest

func (p *PathMode) FromRequest(defaultTag language.Tag, r *http.Request) (tag language.Tag, path string, ok bool)

func (*PathMode) Make

func (p *PathMode) Make() Mode

func (*PathMode) Name added in v0.5.0

func (p *PathMode) Name() (name string)

func (*PathMode) ParsePathLang

func (p *PathMode) ParsePathLang(path string) (tag language.Tag, trimmed string, ok bool)

func (*PathMode) SetDomain

func (p *PathMode) SetDomain(domain string) PathModeBuilder

func (*PathMode) ToUrl

func (p *PathMode) ToUrl(defaultTag, tag language.Tag, path string) (translated string)

type PathModeBuilder

type PathModeBuilder interface {
	SetDomain(domain string) PathModeBuilder

	Make() Mode
}

func NewPathMode

func NewPathMode() (p PathModeBuilder)

type QueryMode

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

func (*QueryMode) FromRequest

func (q *QueryMode) FromRequest(defaultTag language.Tag, r *http.Request) (tag language.Tag, path string, ok bool)

func (*QueryMode) Make

func (q *QueryMode) Make() Mode

func (*QueryMode) Name added in v0.5.0

func (p *QueryMode) Name() (name string)

func (*QueryMode) SetDomain

func (q *QueryMode) SetDomain(domain string) QueryModeBuilder

func (*QueryMode) SetQueryParameter

func (q *QueryMode) SetQueryParameter(name string) QueryModeBuilder

func (*QueryMode) ToUrl

func (q *QueryMode) ToUrl(defaultTag, tag language.Tag, path string) (translated string)

type QueryModeBuilder

type QueryModeBuilder interface {
	SetDomain(domain string) QueryModeBuilder
	SetQueryParameter(name string) QueryModeBuilder

	Make() Mode
}

func NewQueryMode

func NewQueryMode() (q QueryModeBuilder)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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