Skip to content

Commit

Permalink
check that there are languages available
Browse files Browse the repository at this point in the history
  • Loading branch information
raspi committed Aug 12, 2020
1 parent dd9cdeb commit 06fce49
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ func New(baseContents string, funcs template.FuncMap) Template {
// If you need access to translation tokens which are used globally,
// simply inject them to the catalog before page specific tokens.
func (t *Template) AddPage(name string, contents string, translations catalog.Catalog) {
for _, l := range translations.Languages() {
langlist := translations.Languages()

if len(langlist) == 0 {
panic(`no languages found`)
}

for _, l := range langlist {
// Init cache for pages
t.pagesCached[l] = make(map[string]*template.Template)
}
Expand Down

0 comments on commit 06fce49

Please sign in to comment.