Skip to content

Commit

Permalink
Translate tasks from Polish to English
Browse files Browse the repository at this point in the history
  • Loading branch information
qba73 committed Jun 8, 2024
1 parent 426dae4 commit 4dc7dc6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ mikctl --srvID j230 --apiKey XXX logs
ID: 3756
Server ID: j230
Task: kluczssh
Task: sshkey
Created: 2024-06-07 09:06:58
Done: 2024-06-07 09:07:01
Output: Wrzuciłem klucz SSH
Output: Uploaded SSH key
ID: 3751
Server ID: j230
Expand Down
13 changes: 9 additions & 4 deletions mikrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ type Log struct {
const logsTemplate = `{{ range .}}
ID: {{ .ID }}
Server ID: {{ .ServerID }}
Task: {{ .Task }}
Task: {{ .Task | toEng }}
Created: {{ .WhenCreated }}
Done: {{ .WhenDone }}
Output: {{ .Output | cleanup }}
Output: {{ .Output | cleanup | toEng }}
{{ end }}`

// Logs represents a list of server logs.
Expand Down Expand Up @@ -202,10 +202,15 @@ func cleanup(logLine string) string {
return r.Replace(logLine)
}

// toEng translates input string from Polish to English.
// toEng translates from Polish to English.
//
// This is a temp solution before applying a proper
// localisation to the entire program.
func toEng(s string) string {
return strings.ReplaceAll(s, "nie", "no")
r := strings.NewReplacer(
"nie", "no",
"Wrzuciłem klucz SSH", "Uploaded SSH key",
"kluczssh", "sshkey",
)
return r.Replace(s)
}

0 comments on commit 4dc7dc6

Please sign in to comment.