diff options
Diffstat (limited to 'vendor/golang.org/x/text/language/coverage.go')
-rw-r--r-- | vendor/golang.org/x/text/language/coverage.go | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/vendor/golang.org/x/text/language/coverage.go b/vendor/golang.org/x/text/language/coverage.go index 101fd23c..fdb61565 100644 --- a/vendor/golang.org/x/text/language/coverage.go +++ b/vendor/golang.org/x/text/language/coverage.go @@ -7,6 +7,8 @@ package language import ( "fmt" "sort" + + "golang.org/x/text/internal/language" ) // The Coverage interface is used to define the level of coverage of an @@ -44,9 +46,9 @@ type allSubtags struct{} // consecutive range, it simply returns a slice of numbers in increasing order. // The "undefined" region is not returned. func (s allSubtags) Regions() []Region { - reg := make([]Region, numRegions) + reg := make([]Region, language.NumRegions) for i := range reg { - reg[i] = Region{regionID(i + 1)} + reg[i] = Region{language.Region(i + 1)} } return reg } @@ -55,9 +57,9 @@ func (s allSubtags) Regions() []Region { // consecutive range, it simply returns a slice of numbers in increasing order. // The "undefined" script is not returned. func (s allSubtags) Scripts() []Script { - scr := make([]Script, numScripts) + scr := make([]Script, language.NumScripts) for i := range scr { - scr[i] = Script{scriptID(i + 1)} + scr[i] = Script{language.Script(i + 1)} } return scr } @@ -65,22 +67,10 @@ func (s allSubtags) Scripts() []Script { // BaseLanguages returns the list of all supported base languages. It generates // the list by traversing the internal structures. func (s allSubtags) BaseLanguages() []Base { - base := make([]Base, 0, numLanguages) - for i := 0; i < langNoIndexOffset; i++ { - // We included "und" already for the value 0. - if i != nonCanonicalUnd { - base = append(base, Base{langID(i)}) - } - } - i := langNoIndexOffset - for _, v := range langNoIndex { - for k := 0; k < 8; k++ { - if v&1 == 1 { - base = append(base, Base{langID(i)}) - } - v >>= 1 - i++ - } + bs := language.BaseLanguages() + base := make([]Base, len(bs)) + for i, b := range bs { + base[i] = Base{b} } return base } @@ -134,7 +124,7 @@ func (s *coverage) BaseLanguages() []Base { } a := make([]Base, len(tags)) for i, t := range tags { - a[i] = Base{langID(t.lang)} + a[i] = Base{language.Language(t.lang())} } sort.Sort(bases(a)) k := 0 |