shithub: hugo

Download patch

ref: 998034faad2b994e9e9f785208a0f2c14dc06854
parent: eb00c621e086d39c93a9e40b642c423de211b934
author: Bjørn Erik Pedersen <[email protected]>
date: Wed Oct 12 12:54:29 EDT 2016

Log on error in translation file

Fixes #2562

--- 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 @@
 		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)
 			}
 		}
 	}
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -512,7 +512,9 @@
 	}
 
 	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.