feat: translation support
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
See #483
This commit is contained in:
@ -4,7 +4,6 @@ package client
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
@ -14,6 +13,7 @@ import (
|
||||
sshPkg "coopcloud.tech/abra/pkg/ssh"
|
||||
commandconnPkg "coopcloud.tech/abra/pkg/upstream/commandconn"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
)
|
||||
|
||||
// Conf is a Docker client configuration.
|
||||
@ -41,7 +41,7 @@ func New(serverName string, opts ...Opt) (*client.Client, error) {
|
||||
if serverName != "default" {
|
||||
context, err := GetContext(serverName)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unknown server, run \"abra server add %s\"?", serverName)
|
||||
return nil, errors.New(gotext.Get("unknown server, run \"abra server add %s\"?", serverName))
|
||||
}
|
||||
|
||||
ctxEndpoint, err := contextPkg.GetContextEndpoint(context)
|
||||
@ -85,7 +85,7 @@ func New(serverName string, opts ...Opt) (*client.Client, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Debugf("created client for %s", serverName)
|
||||
log.Debugf(gotext.Get("created client for %s", serverName))
|
||||
|
||||
info, err := cl.Info(context.Background())
|
||||
if err != nil {
|
||||
@ -94,10 +94,10 @@ func New(serverName string, opts ...Opt) (*client.Client, error) {
|
||||
|
||||
if info.Swarm.LocalNodeState == "inactive" {
|
||||
if serverName != "default" {
|
||||
return cl, fmt.Errorf("swarm mode not enabled on %s?", serverName)
|
||||
return cl, errors.New(gotext.Get("swarm mode not enabled on %s?", serverName))
|
||||
}
|
||||
|
||||
return cl, errors.New("swarm mode not enabled on local server?")
|
||||
return cl, errors.New(gotext.Get("swarm mode not enabled on local server?"))
|
||||
}
|
||||
|
||||
return cl, nil
|
||||
|
Reference in New Issue
Block a user