internal

Imports

Imports #

"sort"
"golang.org/x/text/language"
"golang.org/x/text/language"

Type Aliases

sorter type #

type sorter []language.Tag

Structs

InheritanceMatcher struct #

type InheritanceMatcher struct {
index map[language.Tag]int
}

Functions

Len method #

func (s sorter) Len() int

Less method #

func (s sorter) Less(i int, j int) bool

Match method #

func (m InheritanceMatcher) Match(want ...language.Tag) (language.Tag, int, language.Confidence)

NewInheritanceMatcher function #

NewInheritanceMatcher returns a matcher that matches based on the inheritance chain. The matcher uses canonicalization and the parent relationship to find a match. The resulting match will always be either Und or a language with the same language and script as the requested language. It will not match languages for which there is understood to be mutual or one-directional intelligibility. A Match will indicate an Exact match if the language matches after canonicalization and High if the matched tag is a parent.

func NewInheritanceMatcher(t []language.Tag) *InheritanceMatcher

SortTags function #

SortTags sorts tags in place.

func SortTags(tags []language.Tag)

Swap method #

func (s sorter) Swap(i int, j int)

UniqueTags function #

UniqueTags sorts and filters duplicate tags in place and returns a slice with only unique tags.

func UniqueTags(tags []language.Tag) []language.Tag

Generated with Arrow