// Build builds the root Collator. // TODO: return Weigher instead func (b *Builder) Build() (colltab.Weigher, error) { t, err := b.build() if err != nil { return nil, err } table := colltab.Init(t) if table == nil { panic("generated table of incompatible type") } return table, nil }
// New returns a new Collator initialized for the given locale. func New(id locale.ID) *Collator { // TODO: handle locale selection according to spec. var t tableIndex loc := id.String() if loc != "" { if idx, ok := locales[loc]; ok { t = idx } else { t = locales["und"] } } return NewFromTable(colltab.Init(t)) }
// New returns a new Collator initialized for the given locale. func New(t language.Tag) *Collator { // TODO: handle locale selection according to spec. var tab tableIndex loc := t.String() if loc != "" { if idx, ok := locales[loc]; ok { tab = idx } else { tab = locales["und"] } } return NewFromTable(colltab.Init(tab)) }
// New returns a new Collator initialized for the given locale. func New(t language.Tag) *Collator { _, index, _ := matcher.Match(t) return NewFromTable(colltab.Init(locales[index])) }