diff options
author | Bjørn Erik Pedersen <[email protected]> | 2019-07-29 17:23:10 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2019-07-29 19:10:15 +0200 |
commit | 00a238e32c82b0651e4145e306840cffa46e535d (patch) | |
tree | 6ff16aa261f9bf9f5a0e00774f78e2fdc82afb45 /langs | |
parent | e5f960245938d8d8b4e99f312e9907f8d3aebf7a (diff) | |
download | hugo-00a238e32c82b0651e4145e306840cffa46e535d.tar.gz hugo-00a238e32c82b0651e4145e306840cffa46e535d.zip |
Fix i18n project vs theme order
Fixes #6134
Diffstat (limited to 'langs')
-rw-r--r-- | langs/i18n/translationProvider.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/langs/i18n/translationProvider.go b/langs/i18n/translationProvider.go index c7b4839ee..4ce9b59fe 100644 --- a/langs/i18n/translationProvider.go +++ b/langs/i18n/translationProvider.go @@ -50,7 +50,11 @@ func (tp *TranslationProvider) Update(d *deps.Deps) error { } var newLangs []string - for _, dir := range d.BaseFs.I18n.Dirs { + // The source dirs are ordered so the most important comes first. Since this is a + // last key win situation, we have to reverse the iteration order. + dirs := d.BaseFs.I18n.Dirs + for i := len(dirs) - 1; i >= 0; i-- { + dir := dirs[i] src := spec.NewFilesystemFromFileMetaInfo(dir) files, err := src.Files() @@ -71,10 +75,8 @@ func (tp *TranslationProvider) Update(d *deps.Deps) error { language.RegisterPluralSpec(newLangs, en) } - // The source files are ordered so the most important comes first. Since this is a - // last key win situation, we have to reverse the iteration order. - for i := len(files) - 1; i >= 0; i-- { - if err := addTranslationFile(i18nBundle, files[i]); err != nil { + for _, file := range files { + if err := addTranslationFile(i18nBundle, file); err != nil { return err } } |