From af3a8a4ac4369e7553ebc8d3757c0dff2de68fa8 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 19 Jul 2024 08:21:59 +0800 Subject: [PATCH] Refactor locale file writing logic in SUI page --- sui/storages/local/build.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sui/storages/local/build.go b/sui/storages/local/build.go index 30978f45..535dbf6f 100644 --- a/sui/storages/local/build.go +++ b/sui/storages/local/build.go @@ -559,13 +559,13 @@ func (page *Page) writeLocaleFiles(ctx *core.BuildContext, data map[string]inter return nil } + components := ctx.GetComponents() translations := ctx.GetTranslations() - if len(translations) == 0 { + if len(translations) == 0 && len(components) == 0 { return nil } prefix := core.TranslationKeyPrefix(page.Route) files := page.localeFiles(data) - components := ctx.GetComponents() for name, file := range files { locale := page.tmpl.getLocale(name, page.Route) locale.MergeTranslations(translations, prefix)