// MergeByLanguageInterface is the generic version of MergeByLanguage. It
// is here just so it can be called from the tpl package.
func (p1 Pages) MergeByLanguageInterface(in interface{}) (interface{}, error) {
+ if in == nil {
+ return p1, nil
+ }
p2, ok := in.(Pages)
if !ok {
return nil, fmt.Errorf("%T cannot be merged by language", in)
// This looks less ugly in the templates ...
mergedNNResources := ri.(resource.ResourcesLanguageMerger).MergeByLanguage(enBundle.Resources)
assert.Equal(6, len(mergedNNResources))
+
+ unchanged, err := nnSite.RegularPages.MergeByLanguageInterface(nil)
+ assert.NoError(err)
+ assert.Equal(nnSite.RegularPages, unchanged)
+
}
func TestMergeLanguagesTemplate(t *testing.T) {