Compare commits

...

1 Commits

Author SHA1 Message Date
367fff60ea feat: msgctx support
Some checks failed
continuous-integration/drone/push Build is failing
See #647
See toolshed/xgettext-go#1
2025-09-28 12:52:25 +02:00
14 changed files with 125 additions and 28 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/kadabra
dist/
tests/integration/.bats
/bin

View File

@ -78,14 +78,20 @@ update-po:
done
.PHONY: update-pot
update-pot:
@xgettext-go \
update-pot: ./bin/xgettext-go
@./bin/xgettext-go \
-o pkg/i18n/locales/$(DOMAIN).pot \
--keyword=i18n.G \
--keyword-ctx=i18n.GC \
--sort-output \
--add-comments-tag="translators" \
$$(find . -name "*.go" -not -path "*vendor*" | sort)
./bin/xgettext-go:
@mkdir -p ./bin && \
wget -O ./bin/xgettext-go https://git.coopcloud.tech/toolshed/xgettext-go/raw/branch/main/xgettext-go && \
chmod +x ./bin/xgettext-go
.PHONY: update-pot-po-metadata
update-pot-po-metadata:
@sed -i "s/charset=CHARSET/charset=UTF-8/g" pkg/i18n/locales/*.po pkg/i18n/locales/*.pot

View File

@ -9,7 +9,7 @@ import (
// translators: `abra app` aliases. use a comma separated list of aliases with
// no spaces in between
var appAliases = i18n.G("a")
var appAliases = i18n.GC("a", "abra app")
var AppCommand = &cobra.Command{
// translators: `app` command group

View File

@ -268,7 +268,7 @@ func init() {
AppBackupListCommand.Flags().BoolVarP(
&showAllPaths,
i18n.G("all"),
i18n.G("a"),
i18n.GC("a", "app backup"),
false,
i18n.G("show all paths"),
)

View File

@ -166,7 +166,7 @@ func init() {
AppRestartCommand.Flags().BoolVarP(
&allServices,
i18n.G("all-services"),
i18n.G("a"),
i18n.GC("a", "app restart"),
false,
i18n.G("restart all services"),
)

View File

@ -574,7 +574,7 @@ func init() {
AppSecretGenerateCommand.Flags().BoolVarP(
&generateAllSecrets,
i18n.G("all"),
i18n.G("a"),
i18n.GC("a", "app secret generate"),
false,
i18n.G("generate all secrets"),
)
@ -614,7 +614,7 @@ func init() {
AppSecretRmCommand.Flags().BoolVarP(
&rmAllSecrets,
i18n.G("all"),
i18n.G("a"),
i18n.GC("a", "app secret rm"),
false,
i18n.G("remove all secrets"),
)

View File

@ -119,7 +119,7 @@ func init() {
RecipeFetchCommand.Flags().BoolVarP(
&fetchAllRecipes,
i18n.G("all"),
i18n.G("a"),
i18n.GC("a", "recipe fetch"),
false,
i18n.G("fetch all recipes"),
)

View File

@ -381,7 +381,7 @@ func init() {
RecipeUpgradeCommand.Flags().BoolVarP(
&allTags,
i18n.G("all-tags"),
i18n.G("a"),
i18n.GC("a", "recipe upgrade"),
false,
i18n.G("list all tags, not just upgrades"),
)

View File

@ -20,7 +20,7 @@ import (
// translators: `abra server add` aliases. use a comma separated list of
// aliases with no spaces in between
var serverAddAliases = i18n.G("a")
var serverAddAliases = i18n.GC("a", "server add")
var ServerAddCommand = &cobra.Command{
// translators: `server add` command

View File

@ -96,7 +96,7 @@ func init() {
ServerPruneCommand.Flags().BoolVarP(
&allFilter,
i18n.G("all"),
i18n.G("a"),
i18n.GC("a", "server prune"),
false,
i18n.G("remove all unused images"),
)

View File

@ -551,7 +551,7 @@ func init() {
UpgradeCommand.Flags().BoolVarP(
&updateAll,
i18n.G("all"),
i18n.G("a"),
i18n.GC("a", "abra upgrade"),
false,
i18n.G("update all deployed apps"),
)

View File

@ -20,6 +20,7 @@ var (
Locale = DefaultLocale
_, Mo = LoadLocale()
G = Mo.Get
GC = Mo.GetC
)
func LoadLocale() (string, *gotext.Mo) {

View File

@ -7,7 +7,7 @@
msgid ""
msgstr "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2025-09-10 21:44+0200\n"
"POT-Creation-Date: 2025-09-28 12:38+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1668,9 +1668,55 @@ msgstr ""
#. translators: `abra app` aliases. use a comma separated list of aliases with
#. no spaces in between
#: ./cli/app/app.go:12
msgctxt "abra app"
msgid "a"
msgstr ""
#: ./cli/app/backup.go:271
msgctxt "app backup"
msgid "a"
msgstr ""
#: ./cli/app/restart.go:169
msgctxt "app restart"
msgid "a"
msgstr ""
#: ./cli/app/secret.go:577
msgctxt "app secret generate"
msgid "a"
msgstr ""
#: ./cli/app/secret.go:617
msgctxt "app secret rm"
msgid "a"
msgstr ""
#: ./cli/recipe/fetch.go:122
msgctxt "recipe fetch"
msgid "a"
msgstr ""
#: ./cli/recipe/upgrade.go:384
msgctxt "recipe upgrade"
msgid "a"
msgstr ""
#. translators: `abra server add` aliases. use a comma separated list of
#. aliases with no spaces in between
#: ./cli/app/app.go:12 ./cli/app/backup.go:271 ./cli/app/restart.go:169 ./cli/app/secret.go:577 ./cli/app/secret.go:617 ./cli/recipe/fetch.go:122 ./cli/recipe/upgrade.go:384 ./cli/server/add.go:23 ./cli/server/prune.go:99 ./cli/updater/updater.go:554
#: ./cli/server/add.go:23
msgctxt "server add"
msgid "a"
msgstr ""
#: ./cli/server/prune.go:99
msgctxt "server prune"
msgid "a"
msgstr ""
#: ./cli/updater/updater.go:554
msgctxt "abra upgrade"
msgid "a"
msgstr ""

View File

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2025-09-10 21:44+0200\n"
"POT-Creation-Date: 2025-09-28 12:38+0200\n"
"PO-Revision-Date: 2025-09-04 08:14+0000\n"
"Last-Translator: chasqui <chasqui@cryptolab.net>\n"
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-"
@ -1695,19 +1695,19 @@ msgid ""
"\n"
"Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "
"\"help\"))}}\n"
" {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}"
"{{if .HasAvailableLocalFlags}}\n"
" {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if ."
"HasAvailableLocalFlags}}\n"
"\n"
"Flags:\n"
"{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}"
"{{if .HasAvailableInheritedFlags}}\n"
"{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if ."
"HasAvailableInheritedFlags}}\n"
"\n"
"Global Flags:\n"
"{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}"
"{{if .HasHelpSubCommands}}\n"
"{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if ."
"HasHelpSubCommands}}\n"
"\n"
"Additional help topics:{{range .Commands}}"
"{{if .IsAdditionalHelpTopicCommand}}\n"
"Additional help topics:{{range .Commands}}{{if ."
"IsAdditionalHelpTopicCommand}}\n"
" {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}"
"{{if .HasAvailableSubCommands}}\n"
"\n"
@ -1829,12 +1829,55 @@ msgstr ""
#. translators: `abra app` aliases. use a comma separated list of aliases with
#. no spaces in between
#: cli/app/app.go:12
msgctxt "abra app"
msgid "a"
msgstr ""
#: cli/app/backup.go:271
msgctxt "app backup"
msgid "a"
msgstr ""
#: cli/app/restart.go:169
msgctxt "app restart"
msgid "a"
msgstr ""
#: cli/app/secret.go:577
msgctxt "app secret generate"
msgid "a"
msgstr ""
#: cli/app/secret.go:617
msgctxt "app secret rm"
msgid "a"
msgstr ""
#: cli/recipe/fetch.go:122
msgctxt "recipe fetch"
msgid "a"
msgstr ""
#: cli/recipe/upgrade.go:384
msgctxt "recipe upgrade"
msgid "a"
msgstr ""
#. translators: `abra server add` aliases. use a comma separated list of
#. aliases with no spaces in between
#: cli/app/app.go:12 cli/app/backup.go:271 cli/app/restart.go:169
#: cli/app/secret.go:577 cli/app/secret.go:617 cli/recipe/fetch.go:122
#: cli/recipe/upgrade.go:384 cli/server/add.go:23 cli/server/prune.go:99
#: cli/server/add.go:23
msgctxt "server add"
msgid "a"
msgstr ""
#: cli/server/prune.go:99
msgctxt "server prune"
msgid "a"
msgstr ""
#: cli/updater/updater.go:554
msgctxt "abra upgrade"
msgid "a"
msgstr ""
@ -4910,8 +4953,8 @@ msgstr ""
#: cli/recipe/upgrade.go:228
#, c-format
msgid ""
"service %s is at version %s, but pinned to %s, please correct your "
"compose.yml file manually!"
"service %s is at version %s, but pinned to %s, please correct your compose."
"yml file manually!"
msgstr ""
#: cli/recipe/upgrade.go:224