From 998034faad2b994e9e9f785208a0f2c14dc06854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 12 Oct 2016 16:54:29 +0200 Subject: [PATCH] Log on error in translation file Fixes #2562 --- hugolib/i18n.go | 4 +++- hugolib/site.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hugolib/i18n.go b/hugolib/i18n.go index a98e51291..e71f9d3a3 100644 --- a/hugolib/i18n.go +++ b/hugolib/i18n.go @@ -14,6 +14,8 @@ package hugolib import ( + "fmt" + "github.com/nicksnyder/go-i18n/i18n/bundle" "github.com/spf13/hugo/source" "github.com/spf13/hugo/tpl" @@ -29,7 +31,7 @@ func loadI18n(sources []source.Input) error { for _, r := range currentSource.Files() { err := i18nBundle.ParseTranslationFileBytes(r.LogicalName(), r.Bytes()) if err != nil { - return err + return fmt.Errorf("Failed to load translations in file %q: %s", r.LogicalName(), err) } } } diff --git a/hugolib/site.go b/hugolib/site.go index 5f02a2c7a..509c3bc6c 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -512,7 +512,9 @@ func (s *Site) reBuild(events []fsnotify.Event) (whatChanged, error) { } if len(i18nChanged) > 0 { - s.readI18nSources() + if err := s.readI18nSources(); err != nil { + jww.ERROR.Println(err) + } } // If a content file changes, we need to reload only it and re-render the entire site.