summaryrefslogtreecommitdiffstats
path: root/langs/i18n/translationProvider.go
diff options
context:
space:
mode:
Diffstat (limited to 'langs/i18n/translationProvider.go')
-rw-r--r--langs/i18n/translationProvider.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/langs/i18n/translationProvider.go b/langs/i18n/translationProvider.go
index 44bd52f0c..52f9349c2 100644
--- a/langs/i18n/translationProvider.go
+++ b/langs/i18n/translationProvider.go
@@ -15,6 +15,7 @@ package i18n
import (
"encoding/json"
+ "fmt"
"strings"
"github.com/gohugoio/hugo/common/paths"
@@ -30,7 +31,6 @@ import (
"github.com/gohugoio/hugo/deps"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/source"
- _errors "github.com/pkg/errors"
)
// TranslationProvider provides translation handling, i.e. loading
@@ -83,7 +83,7 @@ const artificialLangTagPrefix = "art-x-"
func addTranslationFile(bundle *i18n.Bundle, r source.File) error {
f, err := r.FileInfo().Meta().Open()
if err != nil {
- return _errors.Wrapf(err, "failed to open translations file %q:", r.LogicalName())
+ return fmt.Errorf("failed to open translations file %q:: %w", r.LogicalName(), err)
}
b := helpers.ReaderToBytes(f)
@@ -96,7 +96,7 @@ func addTranslationFile(bundle *i18n.Bundle, r source.File) error {
try := artificialLangTagPrefix + lang
_, err = language.Parse(try)
if err != nil {
- return _errors.Errorf("%q %s.", try, err)
+ return fmt.Errorf("%q: %s", try, err)
}
name = artificialLangTagPrefix + name
}
@@ -111,7 +111,7 @@ func addTranslationFile(bundle *i18n.Bundle, r source.File) error {
return nil
}
}
- return errWithFileContext(_errors.Wrapf(err, "failed to load translations"), r)
+ return errWithFileContext(fmt.Errorf("failed to load translations: %w", err), r)
}
return nil
@@ -138,11 +138,6 @@ func errWithFileContext(inerr error, r source.File) error {
}
defer f.Close()
- err, _ = herrors.WithFileContext(
- inerr,
- realFilename,
- f,
- herrors.SimpleLineMatcher)
+ return herrors.NewFileError(realFilename, inerr).UpdateContent(f, herrors.SimpleLineMatcher)
- return err
}