summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/text/internal/gen.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2017-03-24 23:31:34 -0700
committerenahum <nahumhbl@gmail.com>2017-03-25 03:31:34 -0300
commit54d3d47daf9190275bbdaf8703b84969a4593451 (patch)
tree05899b296d0186c1a0da8a540bc486e34ad8eec9 /vendor/golang.org/x/text/internal/gen.go
parent7460302dec7796e01c98264e84bece8169cb6ed9 (diff)
downloadchat-54d3d47daf9190275bbdaf8703b84969a4593451.tar.gz
chat-54d3d47daf9190275bbdaf8703b84969a4593451.tar.bz2
chat-54d3d47daf9190275bbdaf8703b84969a4593451.zip
PLT-6076 Adding viper libs for config file changes (#5871)
* Adding viper libs for config file changes * Removing the old fsnotify lib * updating some missing libs
Diffstat (limited to 'vendor/golang.org/x/text/internal/gen.go')
-rw-r--r--vendor/golang.org/x/text/internal/gen.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/vendor/golang.org/x/text/internal/gen.go b/vendor/golang.org/x/text/internal/gen.go
new file mode 100644
index 000000000..1d678af57
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/gen.go
@@ -0,0 +1,52 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build ignore
+
+package main
+
+import (
+ "log"
+
+ "golang.org/x/text/internal/gen"
+ "golang.org/x/text/language"
+ "golang.org/x/text/unicode/cldr"
+)
+
+func main() {
+ r := gen.OpenCLDRCoreZip()
+ defer r.Close()
+
+ d := &cldr.Decoder{}
+ data, err := d.DecodeZip(r)
+ if err != nil {
+ log.Fatalf("DecodeZip: %v", err)
+ }
+
+ w := gen.NewCodeWriter()
+ defer w.WriteGoFile("tables.go", "internal")
+
+ // Create parents table.
+ parents := make([]uint16, language.NumCompactTags)
+ for _, loc := range data.Locales() {
+ tag := language.MustParse(loc)
+ index, ok := language.CompactIndex(tag)
+ if !ok {
+ continue
+ }
+ parentIndex := 0 // und
+ for p := tag.Parent(); p != language.Und; p = p.Parent() {
+ if x, ok := language.CompactIndex(p); ok {
+ parentIndex = x
+ break
+ }
+ }
+ parents[index] = uint16(parentIndex)
+ }
+
+ w.WriteComment(`
+ Parent maps a compact index of a tag to the compact index of the parent of
+ this tag.`)
+ w.WriteVar("Parent", parents)
+}