diff options
Diffstat (limited to 'config/allconfig/alldecoders.go')
-rw-r--r-- | config/allconfig/alldecoders.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/config/allconfig/alldecoders.go b/config/allconfig/alldecoders.go index c6faf571d..c8944bd2d 100644 --- a/config/allconfig/alldecoders.go +++ b/config/allconfig/alldecoders.go @@ -241,8 +241,24 @@ var allDecoderSetups = map[string]decodeWeight{ key: "languages", decode: func(d decodeWeight, p decodeConfig) error { var err error - p.c.Languages, err = langs.DecodeConfig(p.p.GetStringMap(d.key)) - return err + m := p.p.GetStringMap(d.key) + if len(m) == 1 { + // In v0.112.4 we moved this to the language config, but it's very commmon for mono language sites to have this at the top level. + var first maps.Params + for _, v := range m { + first = v.(maps.Params) + break + } + if _, found := first["languagecode"]; !found { + first["languagecode"] = p.p.GetString("languagecode") + } + } + p.c.Languages, err = langs.DecodeConfig(m) + if err != nil { + return err + } + + return nil }, }, "cascade": { |