diff options
Diffstat (limited to 'vendor/golang.org/x/text/language/gen.go')
-rw-r--r-- | vendor/golang.org/x/text/language/gen.go | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/vendor/golang.org/x/text/language/gen.go b/vendor/golang.org/x/text/language/gen.go index 153269bc1..7c260e5c2 100644 --- a/vendor/golang.org/x/text/language/gen.go +++ b/vendor/golang.org/x/text/language/gen.go @@ -698,8 +698,8 @@ func (b *builder) computeRegionGroups() { b.groups[group] = index(len(b.groups)) } } - if len(b.groups) > 32 { - log.Fatalf("only 32 groups supported, found %d", len(b.groups)) + if len(b.groups) > 64 { + log.Fatalf("only 64 groups supported, found %d", len(b.groups)) } b.writeConst("nRegionGroups", len(b.groups)) } @@ -1417,20 +1417,27 @@ func (b *builder) writeMatchData() { } b.writeSlice("regionToGroups", regionToGroups) + // maps language id to in- and out-of-group region. + paradigmLocales := [][3]uint16{} + locales := strings.Split(lm[0].ParadigmLocales[0].Locales, " ") + for i := 0; i < len(locales); i += 2 { + x := [3]uint16{} + for j := 0; j < 2; j++ { + pc := strings.SplitN(locales[i+j], "-", 2) + x[0] = b.langIndex(pc[0]) + if len(pc) == 2 { + x[1+j] = uint16(b.region.index(pc[1])) + } + } + paradigmLocales = append(paradigmLocales, x) + } + b.writeSlice("paradigmLocales", paradigmLocales) + b.writeType(mutualIntelligibility{}) b.writeType(scriptIntelligibility{}) b.writeType(regionIntelligibility{}) - matchLang := []mutualIntelligibility{{ - // TODO: remove once CLDR is fixed. - want: uint16(b.langIndex("sr")), - have: uint16(b.langIndex("hr")), - distance: uint8(5), - }, { - want: uint16(b.langIndex("sr")), - have: uint16(b.langIndex("bs")), - distance: uint8(5), - }} + matchLang := []mutualIntelligibility{} matchScript := []scriptIntelligibility{} matchRegion := []regionIntelligibility{} // Convert the languageMatch entries in lists keyed by desired language. @@ -1559,7 +1566,7 @@ func (b *builder) writeRegionInclusionData() { } } - regionContainment := make([]uint32, len(b.groups)) + regionContainment := make([]uint64, len(b.groups)) for _, g := range b.groups { l := containment[g] @@ -1577,10 +1584,10 @@ func (b *builder) writeRegionInclusionData() { b.writeSlice("regionContainment", regionContainment) regionInclusion := make([]uint8, len(b.region.s)) - bvs := make(map[uint32]index) + bvs := make(map[uint64]index) // Make the first bitvector positions correspond with the groups. for r, i := range b.groups { - bv := uint32(1 << i) + bv := uint64(1 << i) for _, g := range mm[r] { bv |= 1 << g } @@ -1589,7 +1596,7 @@ func (b *builder) writeRegionInclusionData() { } for r := 1; r < len(b.region.s); r++ { if _, ok := b.groups[r]; !ok { - bv := uint32(0) + bv := uint64(0) for _, g := range mm[r] { bv |= 1 << g } @@ -1604,9 +1611,9 @@ func (b *builder) writeRegionInclusionData() { } } b.writeSlice("regionInclusion", regionInclusion) - regionInclusionBits := make([]uint32, len(bvs)) + regionInclusionBits := make([]uint64, len(bvs)) for k, v := range bvs { - regionInclusionBits[v] = uint32(k) + regionInclusionBits[v] = uint64(k) } // Add bit vectors for increasingly large distances until a fixed point is reached. regionInclusionNext := []uint8{} |