Reset translation slice on rebuild

Also add all translations, including the current, to the slice. We filter later.
This commit is contained in:
Bjørn Erik Pedersen
2016-07-25 23:38:37 +02:00
parent c447b7dd6e
commit 618948e4a8
2 changed files with 1 additions and 9 deletions

View File

@@ -55,6 +55,7 @@ func pagesToTranslationsMap(ml *Multilingual, pages []*Page) map[string]Translat
func assignTranslationsToPages(allTranslations map[string]Translations, pages []*Page) {
for _, page := range pages {
page.translations = page.translations[:0]
base := page.TranslationBaseName()
trans, exist := allTranslations[base]
if !exist {
@@ -63,9 +64,6 @@ func assignTranslationsToPages(allTranslations map[string]Translations, pages []
// TODO(bep) multilingo remove lang
for _, translatedPage := range trans {
if translatedPage == page {
continue
}
page.translations = append(page.translations, translatedPage)
}