import "golang.org/x/text/internal/cldrtree"
Package cldrtree builds and generates a CLDR index file, including all inheritance.
cldrtree.go generate.go option.go tree.go type.go
type Builder struct {
// contains filtered or unexported fields
}
A Builder allows storing CLDR data in compact form.
New creates a new Builder.
func (b *Builder) Gen(w *gen.CodeWriter) error
Gen writes all the tables and types for the collected data.
func (b *Builder) GenTestData(w *gen.CodeWriter) error
GenTestData generates tables useful for testing data generated with Gen.
Locale creates an index for the given locale.
Element is a CLDR XML element.
type Index struct {
// contains filtered or unexported fields
}
An Index holds a map of either leaf values or other indices.
Index creates a subindex where the type and enum values are not shared with siblings by default. The name is derived from the elem. If elem is an alias reference, the alias will be resolved and linked. If elem is nil Index returns nil.
IndexFromAlt creates a subindex the value of tye alt attribute as key. It will also configure the Index to share the enumeration values with all sibling values. If elem is an alias, it will be resolved and linked.
IndexFromType creates a subindex the value of tye type attribute as key. It will also configure the Index to share the enumeration values with all sibling values. If elem is an alias, it will be resolved and linked.
IndexWithName is like Section but derives the name from the given name.
SetValue sets the value, the data from a CLDR XML element, for the given key.
type Option func(*options)
An Option configures an Index.
Enum defines a enumeration type. The resulting option may be passed for the construction of multiple Indexes, which they will share the same enum values. Calling Gen on a Builder will generate the Enum for the given name. The optional values fix the values for the given identifier to the argument position (starting at 0). Other values may still be added and will be assigned to subsequent values.
EnumFunc is like Enum but also takes a function that allows rewriting keys.
SharedType returns an option which causes all Indexes to which this option is passed to have the same type.
Tree holds a tree of CLDR data.
Lookup looks up CLDR data for the given path. The lookup adheres to the alias and locale inheritance rules as defined in CLDR.
Each subsequent element in path indicates which subtree to select data from. The last element of the path must select a leaf node. All other elements of the path select a subindex.
LookupFeature is like Lookup, but will first check whether a value of "other" as a fallback before traversing the inheritance chain.
Package cldrtree imports 13 packages (graph) and is imported by 6 packages. Updated 2019-11-23. Refresh now. Tools for package owners.