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:
@ -3,7 +3,6 @@ package ui
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"sort"
|
||||
"strings"
|
||||
@ -17,6 +16,7 @@ import (
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
dockerClient "github.com/docker/docker/client"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
)
|
||||
|
||||
var IsRunning bool
|
||||
@ -79,13 +79,13 @@ type stream struct {
|
||||
}
|
||||
|
||||
func (s stream) String() string {
|
||||
out := fmt.Sprintf("{decoder: %v, ", s.decoder)
|
||||
out += fmt.Sprintf("err: %v, ", s.Err)
|
||||
out += fmt.Sprintf("id: %s, ", s.id)
|
||||
out += fmt.Sprintf("name: %s, ", s.Name)
|
||||
out += fmt.Sprintf("reader: %v, ", s.reader)
|
||||
out += fmt.Sprintf("writer: %v, ", s.writer)
|
||||
out += fmt.Sprintf("status: %s, ", s.status)
|
||||
out := gotext.Get("{decoder: %v, ", s.decoder)
|
||||
out += gotext.Get("err: %v, ", s.Err)
|
||||
out += gotext.Get("id: %s, ", s.id)
|
||||
out += gotext.Get("name: %s, ", s.Name)
|
||||
out += gotext.Get("reader: %v, ", s.reader)
|
||||
out += gotext.Get("writer: %v, ", s.writer)
|
||||
out += gotext.Get("status: %s, ", s.status)
|
||||
return out
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ func (s stream) process() tea.Msg {
|
||||
|
||||
func (s stream) healthcheck(m Model) tea.Msg {
|
||||
filters := filters.NewArgs()
|
||||
filters.Add("name", fmt.Sprintf("^%s", s.Name))
|
||||
filters.Add("name", gotext.Get("^%s", s.Name))
|
||||
|
||||
containers, err := m.cl.ContainerList(m.ctx, containerTypes.ListOptions{Filters: filters})
|
||||
if err != nil {
|
||||
@ -327,10 +327,10 @@ func (m Model) View() string {
|
||||
|
||||
status := stream.status
|
||||
if strings.Contains(stream.status, "converged") && !stream.rollback {
|
||||
status = "succeeded"
|
||||
status = gotext.Get("succeeded")
|
||||
}
|
||||
if strings.Contains(stream.status, "rolled back") {
|
||||
status = "rolled back"
|
||||
status = gotext.Get("rolled back")
|
||||
}
|
||||
|
||||
retries := 0
|
||||
@ -338,7 +338,7 @@ func (m Model) View() string {
|
||||
retries = stream.retries
|
||||
}
|
||||
|
||||
output := fmt.Sprintf("%s: %s (retries: %v, healthcheck: %s)",
|
||||
output := gotext.Get("%s: %s (retries: %v, healthcheck: %s)",
|
||||
formatter.BoldStyle.Render(short),
|
||||
status,
|
||||
retries,
|
||||
|
Reference in New Issue
Block a user