// New returns a new Collator initialized for the given locale. func New(loc string) *Collator { // TODO: handle locale selection according to spec. var t tableIndex if loc != "" { if idx, ok := locales[loc]; ok { t = idx } else { t = locales["root"] } } return NewFromTable(colltab.Init(t)) }
// 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)) }