aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/text/message/pipeline/extract.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/text/message/pipeline/extract.go')
-rw-r--r--vendor/golang.org/x/text/message/pipeline/extract.go25
1 files changed, 8 insertions, 17 deletions
diff --git a/vendor/golang.org/x/text/message/pipeline/extract.go b/vendor/golang.org/x/text/message/pipeline/extract.go
index 379cc6d..20ad914 100644
--- a/vendor/golang.org/x/text/message/pipeline/extract.go
+++ b/vendor/golang.org/x/text/message/pipeline/extract.go
@@ -28,12 +28,8 @@ import (
// - handle features (gender, plural)
// - message rewriting
-// - %m substitutions
-// - `msg:"etc"` tags
-// - msg/Msg top-level vars and strings.
-
// Extract extracts all strings form the package defined in Config.
-func Extract(c *Config) (*State, error) {
+func Extract(c *Config) (*Locale, error) {
conf := loader.Config{}
prog, err := loadPackages(&conf, c.Packages)
if err != nil {
@@ -145,11 +141,9 @@ func Extract(c *Config) (*State, error) {
ph := placeholders{index: map[string]string{}}
- trimmed, _, _ := trimWS(fmtMsg)
-
p := fmtparser.Parser{}
p.Reset(simArgs)
- for p.SetFormat(trimmed); p.Scan(); {
+ for p.SetFormat(fmtMsg); p.Scan(); {
switch p.Status {
case fmtparser.StatusText:
msg += p.Text()
@@ -195,14 +189,11 @@ func Extract(c *Config) (*State, error) {
}
}
- return &State{
- Config: *c,
- program: prog,
- Extracted: Messages{
- Language: c.SourceLanguage,
- Messages: messages,
- },
- }, nil
+ out := &Locale{
+ Language: c.SourceLanguage,
+ Messages: messages,
+ }
+ return out, nil
}
func posString(conf loader.Config, info *loader.PackageInfo, pos token.Pos) string {
@@ -251,7 +242,7 @@ func strip(s string) string {
if unicode.IsSpace(r) || r == '-' {
return '_'
}
- if !unicode.In(r, unicode.Letter, unicode.Mark, unicode.Number) {
+ if !unicode.In(r, unicode.Letter, unicode.Mark) {
return -1
}
return r