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 fd81aac7b6
108 changed files with 15975 additions and 1645 deletions

View File

@ -1,9 +1,11 @@
package internal
import (
"errors"
"fmt"
"coopcloud.tech/abra/pkg/formatter"
"coopcloud.tech/abra/pkg/i18n"
"coopcloud.tech/abra/pkg/log"
"coopcloud.tech/abra/pkg/recipe"
"github.com/AlecAivazis/survey/v2"
@ -13,7 +15,7 @@ import (
// PromptBumpType prompts for version bump type
func PromptBumpType(tagString, latestRelease string) error {
if (!Major && !Minor && !Patch) && tagString == "" {
fmt.Printf(`
fmt.Print(i18n.G(`
You need to make a decision about what kind of an update this new recipe
version is. If someone else performs this upgrade, do they have to do some
migration work or take care of some breaking changes? This can be signaled in
@ -36,12 +38,12 @@ Here is a semver cheat sheet (more on https://semver.org):
should also Just Work and is mostly to do with minor bug fixes
and/or security patches. "nothing to worry about".
`, latestRelease)
`, latestRelease))
var chosenBumpType string
prompt := &survey.Select{
Message: fmt.Sprintf("select recipe version increment type"),
Options: []string{"major", "minor", "patch"},
Options: []string{i18n.G("major"), i18n.G("minor"), i18n.G("patch")},
}
if err := survey.AskOne(prompt, &chosenBumpType); err != nil {
@ -59,13 +61,13 @@ func GetBumpType() string {
var bumpType string
if Major {
bumpType = "major"
bumpType = i18n.G("major")
} else if Minor {
bumpType = "minor"
bumpType = i18n.G("minor")
} else if Patch {
bumpType = "patch"
bumpType = i18n.G("patch")
} else {
log.Fatal("no version bump type specififed?")
log.Fatal(i18n.G("no version bump type specififed?"))
}
return bumpType
@ -73,14 +75,14 @@ func GetBumpType() string {
// SetBumpType figures out which bump type is specified
func SetBumpType(bumpType string) {
if bumpType == "major" {
if bumpType == i18n.G("major") {
Major = true
} else if bumpType == "minor" {
} else if bumpType == i18n.G("minor") {
Minor = true
} else if bumpType == "patch" {
} else if bumpType == i18n.G("patch") {
Patch = true
} else {
log.Fatal("no version bump type specififed?")
log.Fatal(i18n.G("no version bump type specififed?"))
}
}
@ -107,7 +109,7 @@ func GetMainAppImage(recipe recipe.Recipe) (string, error) {
}
if path == "" {
return path, fmt.Errorf("%s has no main 'app' service?", recipe.Name)
return path, errors.New(i18n.G("%s has no main 'app' service?", recipe.Name))
}
return path, nil