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 37c0257851
108 changed files with 11208 additions and 1645 deletions

View File

@ -10,6 +10,7 @@ import (
"coopcloud.tech/abra/pkg/client"
"coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/formatter"
"coopcloud.tech/abra/pkg/i18n"
"coopcloud.tech/abra/pkg/log"
stack "coopcloud.tech/abra/pkg/upstream/stack"
"github.com/docker/docker/api/types/filters"
@ -18,15 +19,15 @@ import (
)
var AppUndeployCommand = &cobra.Command{
Use: "undeploy <domain> [flags]",
Aliases: []string{"un"},
Short: "Undeploy an app",
Long: `This does not destroy any application data.
Use: i18n.G("undeploy <domain> [flags]"),
Aliases: []string{i18n.G("un")},
Short: i18n.G("Undeploy an app"),
Long: i18n.G(`This does not destroy any application data.
However, you should remain vigilant, as your swarm installation will consider
any previously attached volumes as eligible for pruning once undeployed.
Passing "--prune/-p" does not remove those volumes.`,
Passing "--prune/-p" does not remove those volumes.`),
Args: cobra.ExactArgs(1),
ValidArgsFunction: func(
cmd *cobra.Command,
@ -47,7 +48,7 @@ Passing "--prune/-p" does not remove those volumes.`,
log.Fatal(err)
}
log.Debugf("checking whether %s is already deployed", stackName)
log.Debug(i18n.G("checking whether %s is already deployed", stackName))
deployMeta, err := stack.IsDeployed(context.Background(), cl, stackName)
if err != nil {
@ -55,7 +56,7 @@ Passing "--prune/-p" does not remove those volumes.`,
}
if !deployMeta.IsDeployed {
log.Fatalf("%s is not deployed?", app.Name)
log.Fatal(i18n.G("%s is not deployed?", app.Name))
}
if err := internal.DeployOverview(
@ -84,7 +85,7 @@ Passing "--prune/-p" does not remove those volumes.`,
log.Fatal(err)
}
log.Info("initialising undeploy")
log.Info(i18n.G("initialising undeploy"))
rmOpts := stack.Remove{
Namespaces: []string{stackName},
@ -100,10 +101,10 @@ Passing "--prune/-p" does not remove those volumes.`,
}
}
log.Info("undeploy succeeded 🟢")
log.Info(i18n.G("undeploy succeeded 🟢"))
if err := app.WriteRecipeVersion(deployMeta.Version, false); err != nil {
log.Fatalf("writing recipe version failed: %s", err)
log.Fatal(i18n.G("writing recipe version failed: %s", err))
}
},
}
@ -124,14 +125,14 @@ func pruneApp(cl *dockerClient.Client, app appPkg.App) error {
}
cntSpaceReclaimed := formatter.ByteCountSI(cr.SpaceReclaimed)
log.Infof("containers pruned: %d; space reclaimed: %s", len(cr.ContainersDeleted), cntSpaceReclaimed)
log.Info(i18n.G("containers pruned: %d; space reclaimed: %s", len(cr.ContainersDeleted), cntSpaceReclaimed))
nr, err := cl.NetworksPrune(ctx, pruneFilters)
if err != nil {
return err
}
log.Infof("networks pruned: %d", len(nr.NetworksDeleted))
log.Info(i18n.G("networks pruned: %d", len(nr.NetworksDeleted)))
ir, err := cl.ImagesPrune(ctx, pruneFilters)
if err != nil {
@ -139,7 +140,7 @@ func pruneApp(cl *dockerClient.Client, app appPkg.App) error {
}
imgSpaceReclaimed := formatter.ByteCountSI(ir.SpaceReclaimed)
log.Infof("images pruned: %d; space reclaimed: %s", len(ir.ImagesDeleted), imgSpaceReclaimed)
log.Info(i18n.G("images pruned: %d; space reclaimed: %s", len(ir.ImagesDeleted), imgSpaceReclaimed))
return nil
}
@ -151,9 +152,9 @@ var (
func init() {
AppUndeployCommand.Flags().BoolVarP(
&prune,
"prune",
"p",
i18n.G("prune"),
i18n.G("p"),
false,
"prune unused containers, networks, and dangling images",
i18n.G("prune unused containers, networks, and dangling images"),
)
}