From 4dc7dc6d7b509b6aa30463fb938c8230f36768b2 Mon Sep 17 00:00:00 2001 From: Jakub Jarosz Date: Sat, 8 Jun 2024 09:56:22 +0100 Subject: [PATCH] Translate tasks from Polish to English --- README.md | 4 ++-- mikrus.go | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 72eff23..b8c854d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/mikrus.go b/mikrus.go index d9de179..bf96b8d 100644 --- a/mikrus.go +++ b/mikrus.go @@ -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. @@ -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) }