Mark user interface strings

For now exclude command help, as cobra itself is not localizable yet.
This commit is contained in:
Philipp Wolfer 2023-12-09 16:43:14 +01:00
parent 511b71b909
commit d6ca8d33f7
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
27 changed files with 1005 additions and 95 deletions

View file

@ -27,6 +27,7 @@ import (
"github.com/pelletier/go-toml/v2"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uploadedlobster.com/scotty/internal/i18n"
"go.uploadedlobster.com/scotty/internal/version"
)
@ -75,7 +76,7 @@ func InitConfig(cfgFile string) error {
func WriteConfig(removedKeys ...string) error {
file := viper.ConfigFileUsed()
if len(file) == 0 {
return errors.New("no configuration file defined, cannot write config")
return errors.New(i18n.Tr("no configuration file defined, cannot write config"))
}
configMap := viper.AllSettings()
@ -124,7 +125,7 @@ func ValidateKey(key string) error {
} else if found {
return nil
} else {
return fmt.Errorf("key must only consist of A-Za-z0-9_-")
return fmt.Errorf(i18n.Tr("key must only consist of A-Za-z0-9_-"))
}
}