Exemplo n.º 1
0
// New returns a new Matcher for the given language and options.
func New(t language.Tag, opts ...Option) *Matcher {
	m := &Matcher{
		w: colltab.Init(locales[newcolltab.MatchLang(t, tags)]),
	}
	for _, f := range opts {
		f(m)
	}
	return m
}
Exemplo n.º 2
0
// New returns a new Collator initialized for the given locale.
func New(t language.Tag, o ...Option) *Collator {
	index := newcolltab.MatchLang(t, tags)
	c := newCollator(colltab.Init(locales[index]))

	// Set options from the user-supplied tag.
	c.setFromTag(t)

	// Set the user-supplied options.
	c.setOptions(o)

	c.init()
	return c
}