From 0fa288b8a2de8e652c87f6f1977ad3577bbc8fbf Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Thu, 27 Feb 2025 16:41:18 +0300 Subject: [PATCH] chore: make the application more internationalized --- internal/cliutils/template.go | 8 +++---- internal/translations/default.pot | 24 ++++++++++++++------- internal/translations/po/ru/default.po | 30 ++++++++++++++++---------- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/internal/cliutils/template.go b/internal/cliutils/template.go index 101a461..da8bb2e 100644 --- a/internal/cliutils/template.go +++ b/internal/cliutils/template.go @@ -52,7 +52,7 @@ func GetAppCliTemplate() string { {{template "helpNameTemplate" .}} %s: - {{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.HelpName}} {{if .VisibleFlags}}[global options]{{end}}{{if .Commands}} command [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Version}}{{if not .HideVersion}} + {{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.HelpName}} {{if .VisibleFlags}}[%s]{{end}}{{if .Commands}} %s [%s]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[%s...]{{end}}{{end}}{{if .Version}}{{if not .HideVersion}} %s: {{.Version}}{{end}}{{end}}{{if .Description}} @@ -71,7 +71,7 @@ func GetAppCliTemplate() string { %s: {{template "copyrightTemplate" .}}{{end}} -`, gotext.Get("NAME"), gotext.Get("USAGE"), gotext.Get("VERSION"), gotext.Get("DESCRIPTION"), gotext.Get("AUTHOR"), gotext.Get("COMMANDS"), gotext.Get("GLOBAL OPTIONS"), gotext.Get("GLOBAL OPTIONS"), gotext.Get("COPYRIGHT")) +`, gotext.Get("NAME"), gotext.Get("USAGE"), gotext.Get("global options"), gotext.Get("command"), gotext.Get("command options"), gotext.Get("arguments"), gotext.Get("VERSION"), gotext.Get("DESCRIPTION"), gotext.Get("AUTHOR"), gotext.Get("COMMANDS"), gotext.Get("GLOBAL OPTIONS"), gotext.Get("GLOBAL OPTIONS"), gotext.Get("COPYRIGHT")) } func GetCommandHelpTemplate() string { @@ -79,7 +79,7 @@ func GetCommandHelpTemplate() string { {{template "helpNameTemplate" .}} %s: - {{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.HelpName}}{{if .VisibleFlags}} [%s]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[%s]{{end}}{{end}}{{if .Category}} + {{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.HelpName}}{{if .VisibleFlags}} [%s]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[%s...]{{end}}{{end}}{{if .Category}} %s: {{.Category}}{{end}}{{if .Description}} @@ -93,7 +93,7 @@ func GetCommandHelpTemplate() string { `, gotext.Get("NAME"), gotext.Get("USAGE"), gotext.Get("command options"), - gotext.Get("arguments..."), + gotext.Get("arguments"), gotext.Get("CATEGORY"), gotext.Get("DESCRIPTION"), gotext.Get("OPTIONS"), diff --git a/internal/translations/default.pot b/internal/translations/default.pot index c132ac0..8e2ee3c 100644 --- a/internal/translations/default.pot +++ b/internal/translations/default.pot @@ -202,6 +202,22 @@ msgstr "" msgid "USAGE" msgstr "" +#: internal/cliutils/template.go:74 +msgid "global options" +msgstr "" + +#: internal/cliutils/template.go:74 +msgid "command" +msgstr "" + +#: internal/cliutils/template.go:74 internal/cliutils/template.go:95 +msgid "command options" +msgstr "" + +#: internal/cliutils/template.go:74 internal/cliutils/template.go:96 +msgid "arguments" +msgstr "" + #: internal/cliutils/template.go:74 msgid "VERSION" msgstr "" @@ -226,14 +242,6 @@ msgstr "" msgid "COPYRIGHT" msgstr "" -#: internal/cliutils/template.go:95 -msgid "command options" -msgstr "" - -#: internal/cliutils/template.go:96 -msgid "arguments..." -msgstr "" - #: internal/cliutils/template.go:97 msgid "CATEGORY" msgstr "" diff --git a/internal/translations/po/ru/default.po b/internal/translations/po/ru/default.po index f9179c3..4420300 100644 --- a/internal/translations/po/ru/default.po +++ b/internal/translations/po/ru/default.po @@ -5,15 +5,15 @@ msgid "" msgstr "" "Project-Id-Version: unnamed project\n" -"PO-Revision-Date: 2025-02-27 11:33+0300\n" +"PO-Revision-Date: 2025-02-27 14:27+0300\n" "Last-Translator: Maxim Slipenko \n" "Language-Team: Russian\n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Gtranslator 47.1\n" #: build.go:44 @@ -209,6 +209,22 @@ msgstr "НАЗВАНИЕ" msgid "USAGE" msgstr "ИСПОЛЬЗОВАНИЕ" +#: internal/cliutils/template.go:74 +msgid "global options" +msgstr "глобальные опции" + +#: internal/cliutils/template.go:74 +msgid "command" +msgstr "команда" + +#: internal/cliutils/template.go:74 internal/cliutils/template.go:95 +msgid "command options" +msgstr "опции команды" + +#: internal/cliutils/template.go:74 internal/cliutils/template.go:96 +msgid "arguments" +msgstr "аргументы" + #: internal/cliutils/template.go:74 msgid "VERSION" msgstr "ВЕРСИЯ" @@ -233,14 +249,6 @@ msgstr "ГЛОБАЛЬНЫЕ ОПЦИИ" msgid "COPYRIGHT" msgstr "АВТОРСКОЕ ПРАВО" -#: internal/cliutils/template.go:95 -msgid "command options" -msgstr "опции команды" - -#: internal/cliutils/template.go:96 -msgid "arguments..." -msgstr "аргументы..." - #: internal/cliutils/template.go:97 msgid "CATEGORY" msgstr "КАТЕГОРИЯ"