WIP: feat: translation support
Some checks failed
continuous-integration/drone/push Build is failing

See #483
This commit is contained in:
2025-08-19 11:22:52 +02:00
parent 5cf6048ecb
commit a31ec51c24
71 changed files with 804 additions and 796 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/lipgloss/table"
"github.com/docker/go-units"
"github.com/leonelquinteros/gotext"
"golang.org/x/term"
"coopcloud.tech/abra/pkg/config"
@ -42,7 +43,7 @@ func RemoveSha(str string) string {
func HumanDuration(timestamp int64) string {
date := time.Unix(timestamp, 0)
now := time.Now().UTC()
return units.HumanDuration(now.Sub(date)) + " ago"
return units.HumanDuration(now.Sub(date)) + gotext.Get(" ago")
}
// CreateTable prepares a table layout for output.
@ -76,7 +77,7 @@ func CreateTable() (*table.Table, error) {
func PrintTable(t *table.Table) error {
if isAbraCI, ok := os.LookupEnv("ABRA_CI"); ok && isAbraCI == "1" {
// NOTE(d1): no width limits for CI testing since we test against outputs
log.Debug("detected ABRA_CI=1")
log.Debug(gotext.Get("detected ABRA_CI=1"))
fmt.Println(t)
return nil
}
@ -130,7 +131,7 @@ func CreateOverview(header string, rows [][]string) string {
}
if len(row) > 2 {
panic("CreateOverview: only accepts rows of len == 2")
panic(gotext.Get("CreateOverview: only accepts rows of len == 2"))
}
lenOffset := 4
@ -234,7 +235,7 @@ func StripTagMeta(image string) string {
}
if originalImage != image {
log.Debugf("stripped %s to %s for parsing", originalImage, image)
log.Debug(gotext.Get("stripped %s to %s for parsing", originalImage, image))
}
return image