mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-29 21:27:05 +02:00
Mark user interface strings
For now exclude command help, as cobra itself is not localizable yet.
This commit is contained in:
parent
511b71b909
commit
d6ca8d33f7
27 changed files with 1005 additions and 95 deletions
|
@ -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_-"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue