...
1# Go Text
2
3[![Go Reference](https://pkg.go.dev/badge/golang.org/x/text.svg)](https://pkg.go.dev/golang.org/x/text)
4
5This repository holds supplementary Go libraries for text processing, many involving Unicode.
6
7## CLDR Versioning
8
9It is important that the Unicode version used in `x/text` matches the one used
10by your Go compiler. The `x/text` repository supports multiple versions of
11Unicode and will match the version of Unicode to that of the Go compiler. At the
12moment this is supported for Go compilers from version 1.7.
13
14## Download/Install
15
16The easiest way to install is to run `go get -u golang.org/x/text`. You can
17also manually git clone the repository to `$GOPATH/src/golang.org/x/text`.
18
19## Contribute
20To submit changes to this repository, see http://golang.org/doc/contribute.html.
21
22To generate the tables in this repository (except for the encoding tables),
23run go generate from this directory. By default tables are generated for the
24Unicode version in core and the CLDR version defined in
25golang.org/x/text/unicode/cldr.
26
27Running go generate will as a side effect create a DATA subdirectory in this
28directory, which holds all files that are used as a source for generating the
29tables. This directory will also serve as a cache.
30
31## Testing
32Run
33
34 go test ./...
35
36from this directory to run all tests. Add the "-tags icu" flag to also run
37ICU conformance tests (if available). This requires that you have the correct
38ICU version installed on your system.
39
40TODO:
41- updating unversioned source files.
42
43## Generating Tables
44
45To generate the tables in this repository (except for the encoding
46tables), run `go generate` from this directory. By default tables are
47generated for the Unicode version in core and the CLDR version defined in
48golang.org/x/text/unicode/cldr.
49
50Running go generate will as a side effect create a DATA subdirectory in this
51directory which holds all files that are used as a source for generating the
52tables. This directory will also serve as a cache.
53
54## Versions
55To update a Unicode version run
56
57 UNICODE_VERSION=x.x.x go generate
58
59where `x.x.x` must correspond to a directory in https://www.unicode.org/Public/.
60If this version is newer than the version in core it will also update the
61relevant packages there. The idna package in x/net will always be updated.
62
63To update a CLDR version run
64
65 CLDR_VERSION=version go generate
66
67where `version` must correspond to a directory in
68https://www.unicode.org/Public/cldr/.
69
70Note that the code gets adapted over time to changes in the data and that
71backwards compatibility is not maintained.
72So updating to a different version may not work.
73
74The files in DATA/{iana|icu|w3|whatwg} are currently not versioned.
75
76## Report Issues / Send Patches
77
78This repository uses Gerrit for code changes. To learn how to submit changes to
79this repository, see https://golang.org/doc/contribute.html.
80
81The main issue tracker for the image repository is located at
82https://github.com/golang/go/issues. Prefix your issue with "x/text:" in the
83subject line, so it is easy to find.
View as plain text