WIP: feat: translation support
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
See #483
This commit is contained in:
@ -2,11 +2,12 @@ package container // https://github.com/docker/cli/blob/master/cli/command/conta
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"errors"
|
||||
"io"
|
||||
"runtime"
|
||||
"sync"
|
||||
|
||||
"coopcloud.tech/abra/pkg/i18n"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/docker/api/types"
|
||||
@ -39,7 +40,7 @@ type hijackedIOStreamer struct {
|
||||
func (h *hijackedIOStreamer) stream(ctx context.Context) error {
|
||||
restoreInput, err := h.setupInput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to setup input stream: %s", err)
|
||||
return errors.New(i18n.G("unable to setup input stream: %s", err))
|
||||
}
|
||||
|
||||
defer restoreInput()
|
||||
@ -78,7 +79,7 @@ func (h *hijackedIOStreamer) setupInput() (restore func(), err error) {
|
||||
}
|
||||
|
||||
if err := setRawTerminal(h.streams); err != nil {
|
||||
return nil, fmt.Errorf("unable to set IO streams as raw terminal: %s", err)
|
||||
return nil, errors.New(i18n.G("unable to set IO streams as raw terminal: %s", err))
|
||||
}
|
||||
|
||||
// Use sync.Once so we may call restore multiple times but ensure we
|
||||
@ -96,7 +97,7 @@ func (h *hijackedIOStreamer) setupInput() (restore func(), err error) {
|
||||
if h.detachKeys != "" {
|
||||
customEscapeKeys, err := term.ToBytes(h.detachKeys)
|
||||
if err != nil {
|
||||
log.Warnf("invalid detach escape keys, using default: %s", err)
|
||||
log.Warnf(i18n.G("invalid detach escape keys, using default: %s", err))
|
||||
} else {
|
||||
escapeKeys = customEscapeKeys
|
||||
}
|
||||
@ -128,10 +129,10 @@ func (h *hijackedIOStreamer) beginOutputStream(restoreInput func()) <-chan error
|
||||
_, err = stdcopy.StdCopy(h.outputStream, h.errorStream, h.resp.Reader)
|
||||
}
|
||||
|
||||
log.Debug("[hijack] End of stdout")
|
||||
log.Debug(i18n.G("[hijack] end of stdout"))
|
||||
|
||||
if err != nil {
|
||||
log.Debugf("Error receiveStdout: %s", err)
|
||||
log.Debug(i18n.G("error receiveStdout: %s", err))
|
||||
}
|
||||
|
||||
outputDone <- err
|
||||
@ -152,7 +153,7 @@ func (h *hijackedIOStreamer) beginInputStream(restoreInput func()) (doneC <-chan
|
||||
// messages will be in normal type.
|
||||
restoreInput()
|
||||
|
||||
log.Debug("[hijack] End of stdin")
|
||||
log.Debug(i18n.G("[hijack] End of stdin"))
|
||||
|
||||
if _, ok := err.(term.EscapeError); ok {
|
||||
detached <- err
|
||||
@ -163,12 +164,12 @@ func (h *hijackedIOStreamer) beginInputStream(restoreInput func()) (doneC <-chan
|
||||
// This error will also occur on the receive
|
||||
// side (from stdout) where it will be
|
||||
// propagated back to the caller.
|
||||
log.Debugf("Error sendStdin: %s", err)
|
||||
log.Debug(i18n.G("error sendStdin: %s", err))
|
||||
}
|
||||
}
|
||||
|
||||
if err := h.resp.CloseWrite(); err != nil {
|
||||
log.Debugf("Couldn't send EOF: %s", err)
|
||||
log.Debug(i18n.G("couldn't send EOF: %s", err))
|
||||
}
|
||||
|
||||
close(inputDone)
|
||||
|
Reference in New Issue
Block a user