Refactor locale file writing logic in SUI page
This commit is contained in:
parent
8e8a0ac885
commit
af3a8a4ac4
1 changed files with 2 additions and 2 deletions
|
|
@ -559,13 +559,13 @@ func (page *Page) writeLocaleFiles(ctx *core.BuildContext, data map[string]inter
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
components := ctx.GetComponents()
|
||||||
translations := ctx.GetTranslations()
|
translations := ctx.GetTranslations()
|
||||||
if len(translations) == 0 {
|
if len(translations) == 0 && len(components) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
prefix := core.TranslationKeyPrefix(page.Route)
|
prefix := core.TranslationKeyPrefix(page.Route)
|
||||||
files := page.localeFiles(data)
|
files := page.localeFiles(data)
|
||||||
components := ctx.GetComponents()
|
|
||||||
for name, file := range files {
|
for name, file := range files {
|
||||||
locale := page.tmpl.getLocale(name, page.Route)
|
locale := page.tmpl.getLocale(name, page.Route)
|
||||||
locale.MergeTranslations(translations, prefix)
|
locale.MergeTranslations(translations, prefix)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue