mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
langs/i18n: Fallback to defaultContentLanguage instead of English
Co-authored-by: 641bill <wo23636@126.com> Fixes #9216
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
f1062519ae
commit
0cb6ca5906
@@ -48,7 +48,12 @@ func NewTranslationProvider() *TranslationProvider {
|
||||
func (tp *TranslationProvider) Update(d *deps.Deps) error {
|
||||
spec := source.NewSourceSpec(d.PathSpec, nil, nil)
|
||||
|
||||
bundle := i18n.NewBundle(language.English)
|
||||
var defaultLangTag, err = language.Parse(d.Cfg.GetString("defaultContentLanguage"))
|
||||
if err != nil {
|
||||
defaultLangTag = language.English
|
||||
}
|
||||
bundle := i18n.NewBundle(defaultLangTag)
|
||||
|
||||
bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
|
||||
bundle.RegisterUnmarshalFunc("yaml", yaml.Unmarshal)
|
||||
bundle.RegisterUnmarshalFunc("yml", yaml.Unmarshal)
|
||||
|
Reference in New Issue
Block a user