diff --git a/message/pipeline/extract.go b/message/pipeline/extract.go index 7d8385d9..2d6ba797 100644 --- a/message/pipeline/extract.go +++ b/message/pipeline/extract.go @@ -657,6 +657,16 @@ func (px packageExtracter) addMessage( comment string, arguments []argument) { x := px.x + + // Do not extract strings from external dependencies, + // as their files are located in the module cache. + if file := x.conf.Fset.File(pos); file != nil { + filename := filepath.ToSlash(file.Name()) + if strings.Contains(filename, "/pkg/mod/") { + return + } + } + fmtMsg := constant.StringVal(c) ph := placeholders{index: map[string]string{}} diff --git a/message/pipeline/pipeline.go b/message/pipeline/pipeline.go index 2b07e38b..9ffe06c6 100644 --- a/message/pipeline/pipeline.go +++ b/message/pipeline/pipeline.go @@ -315,7 +315,7 @@ func (s *State) Merge() error { for _, orig := range filtered { m := *orig m.Key = "" - m.Position = "" + // m.Position = "" for _, id := range m.ID { if t, ok := translations[tag][id]; ok {