feat: embed and load locale translations on init
Locales auto-load when cmd/dev is imported via init(). Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
764f290b34
commit
b9d9994a36
2 changed files with 10 additions and 0 deletions
|
|
@ -34,10 +34,13 @@ package dev
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"forge.lthn.ai/core/cli/pkg/cli"
|
"forge.lthn.ai/core/cli/pkg/cli"
|
||||||
|
"forge.lthn.ai/core/go-devops/locales"
|
||||||
"forge.lthn.ai/core/go-i18n"
|
"forge.lthn.ai/core/go-i18n"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
// Load go-devops translations (cmd.dev.*, cmd.deploy.*, cmd.docs.*, etc.)
|
||||||
|
i18n.LoadFS(locales.FS, ".")
|
||||||
cli.RegisterCommands(AddDevCommands)
|
cli.RegisterCommands(AddDevCommands)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
7
locales/embed.go
Normal file
7
locales/embed.go
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
// Package locales embeds translation files for the go-devops module.
|
||||||
|
package locales
|
||||||
|
|
||||||
|
import "embed"
|
||||||
|
|
||||||
|
//go:embed *.json
|
||||||
|
var FS embed.FS
|
||||||
Loading…
Add table
Reference in a new issue