summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/text/internal/language/tags.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2019-07-06 18:56:43 +0200
committerDimitri Sokolyuk <demon@dim13.org>2019-07-06 18:56:43 +0200
commit32dd62da990484cf15db8eb7a14bd646bc0fda8a (patch)
tree61c0468f8cad58bf5161a6fc53d0fc85b55951fc /vendor/golang.org/x/text/internal/language/tags.go
parent6312ad4bf7e48347539eb5b4c5075e447d8142f3 (diff)
switch to go.mod
Diffstat (limited to 'vendor/golang.org/x/text/internal/language/tags.go')
-rw-r--r--vendor/golang.org/x/text/internal/language/tags.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/golang.org/x/text/internal/language/tags.go b/vendor/golang.org/x/text/internal/language/tags.go
new file mode 100644
index 0000000..e7afd31
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/tags.go
@@ -0,0 +1,48 @@
+// Copyright 2013 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.
+
+package language
+
+// MustParse is like Parse, but panics if the given BCP 47 tag cannot be parsed.
+// It simplifies safe initialization of Tag values.
+func MustParse(s string) Tag {
+ t, err := Parse(s)
+ if err != nil {
+ panic(err)
+ }
+ return t
+}
+
+// MustParseBase is like ParseBase, but panics if the given base cannot be parsed.
+// It simplifies safe initialization of Base values.
+func MustParseBase(s string) Language {
+ b, err := ParseBase(s)
+ if err != nil {
+ panic(err)
+ }
+ return b
+}
+
+// MustParseScript is like ParseScript, but panics if the given script cannot be
+// parsed. It simplifies safe initialization of Script values.
+func MustParseScript(s string) Script {
+ scr, err := ParseScript(s)
+ if err != nil {
+ panic(err)
+ }
+ return scr
+}
+
+// MustParseRegion is like ParseRegion, but panics if the given region cannot be
+// parsed. It simplifies safe initialization of Region values.
+func MustParseRegion(s string) Region {
+ r, err := ParseRegion(s)
+ if err != nil {
+ panic(err)
+ }
+ return r
+}
+
+// Und is the root language.
+var Und Tag