Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extract_strings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# SPDX-FileCopyrightText: 2024 SUSE LLC
# SPDX-FileCopyrightText: 2026 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -9,7 +9,7 @@ export LANG=C.UTF-8
for MODULE in mgrctl mgradm mgrpxy shared; do
# Generate the pot file
echo "Generate locale/${MODULE}/${MODULE}.pot"
find ${MODULE} -type f -not -name '*_test.go' -name '*.go' | sort | xargs xgettext --no-wrap --keyword="PL:1c,2" --keyword="NL:1,2" --keyword="L" --language=Javascript --from-code=UTF-8 -o locale/${MODULE}/${MODULE}.pot -
find ${MODULE} -type f -not -name '*_test.go' -name '*.go' | sort | xargs xgettext --add-comments=Translators --no-wrap --keyword="PL:1c,2" --keyword="NL:1,2" --keyword="L" --language=Javascript --from-code=UTF-8 -o locale/${MODULE}/${MODULE}.pot -
msguniq --no-wrap -o locale/${MODULE}/${MODULE}-uniq.pot locale/${MODULE}/${MODULE}.pot
mv locale/${MODULE}/${MODULE}-uniq.pot locale/${MODULE}/${MODULE}.pot

Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/backup/db/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func Disable(flags *Flagpole) error {
if _, err := cnx.GetPodName(); err == nil {
wasRunning = true
if !flags.Force {
res, err := utils.YesNo(L("Database service needs to be restarted to reload backup configurations, continue"))
res, err := utils.YesNo(L("Database service needs to be restarted to reload backup configurations, continue?"))
if err != nil || !res {
log.Info().Msg(L("Backup reconfiguration aborted"))
return nil
Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/backup/db/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Enable(force bool) error {

if wasRunning {
if !force {
res, err := utils.YesNo(L("Database service needs to be restarted to reload backup configurations, continue"))
res, err := utils.YesNo(L("Database service needs to be restarted to reload backup configurations, continue?"))
if err != nil || !res {
log.Info().Msg(L("Backup configuration aborted"))
return nil
Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/backup/db/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Restore(force bool) error {
log.Info().Msg(L("Restoring DB backup"))

if !force {
if res, err := utils.YesNo(L("Restoring from backup is a destructive operation. Proceed")); err != nil || !res {
if res, err := utils.YesNo(L("Restoring from backup is a destructive operation. Proceed?")); err != nil || !res {
log.Info().Msg(L("Aborting"))
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions mgradm/cmd/gpg/add/gpg.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2025 SUSE LLC
// SPDX-FileCopyrightText: 2026 SUSE LLC
//
// SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -103,7 +103,7 @@ func gpgAddKeys(_ *types.GlobalFlags, flags *gpgAddFlags, _ *cobra.Command, args
continue
}
if !flags.Force {
ret, err := utils.YesNo(L("Do you really want to trust this key"))
ret, err := utils.YesNo(L("Do you really want to trust this key?"))
if err != nil {
return err
}
Expand Down
11 changes: 8 additions & 3 deletions shared/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ func AskIfMissing(value *string, prompt string, minValue int, maxValue int, chec
func YesNo(question string) (bool, error) {
reader := bufio.NewReader(os.Stdin)
for {
fmt.Printf("%s [y/N]?", question)
// Translators: This is appended to the end of a question. Choices are short for `yes` and `no`.
fmt.Printf(L("%s [y/N]"), question)

response, err := reader.ReadString('\n')
if err != nil {
Expand All @@ -173,10 +174,14 @@ func YesNo(question string) (bool, error) {

response = strings.ToLower(strings.TrimSpace(response))

if strings.ToLower(response) == "y" || strings.ToLower(response) == "yes" {
// Empty responses imply `no`.
if len(response) == 0 {
return false, nil
}
if strings.HasPrefix(L("yes"), response) {
return true, nil
}
if strings.ToLower(response) == "n" || strings.ToLower(response) == "no" {
if strings.HasPrefix(L("no"), response) {
return false, nil
Comment thread
aaannz marked this conversation as resolved.
}
}
Expand Down
Loading