diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-05-12 17:31:50 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-05-12 17:31:50 +0200 |
| commit | 0dd14393d296d9a0915a978f83ac2057b7e4d711 (patch) | |
| tree | b721ce867c9b860ff54776aae59c350f149098fe /ki18n/cmd | |
| parent | 3e09f3b6dc1484820658d07187096cda541fed46 (diff) | |
ki18n: add gettext CI check for missing translation keys
gettext now exits 1 when any key extracted from templates is absent from
a locale file. Added as a task and wired into the check task.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'ki18n/cmd')
| -rw-r--r-- | ki18n/cmd/gettext/gettext.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ki18n/cmd/gettext/gettext.go b/ki18n/cmd/gettext/gettext.go index e68dd22..b3b47cd 100644 --- a/ki18n/cmd/gettext/gettext.go +++ b/ki18n/cmd/gettext/gettext.go @@ -174,6 +174,7 @@ func main() { extractedKeys := extractAllKeys() baseLogger.Info("extracted keys from templates", slog.Int("count", len(extractedKeys))) + missingKeys := false for _, lang := range langs { logger := baseLogger.With(slog.String("lang", lang)) currentLocales := getOrCreateLocale(lang, logger) @@ -201,6 +202,7 @@ func main() { if _, ok := currentLocales[key]; !ok { logger.Info(`found missing key`, slog.String("key", key)) newLocales[key] = "" + missingKeys = true } } var completion string @@ -217,4 +219,8 @@ func main() { kcore.Expect(os.WriteFile(filepath.Join("locales", lang, "index.yml"), content, 0o600), "error writing file") } } + + if missingKeys { + os.Exit(1) + } } |
