From 799d1a51fafd495b7df01ea04d7f245a9a0f11ea Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Wed, 15 Jan 2025 16:01:53 +0300 Subject: [PATCH] add a fallback to swa for currently unsupported languages --- handlers/application/menuhandler.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/handlers/application/menuhandler.go b/handlers/application/menuhandler.go index 37c8ae1..bcb9aa2 100644 --- a/handlers/application/menuhandler.go +++ b/handlers/application/menuhandler.go @@ -188,7 +188,14 @@ func (h *MenuHandlers) SetAccountFlags(ctx context.Context, sym string, input [] return res, nil } - res.Content = string(code) + codeStr := string(code) + + // fallback for unsupported languages + if codeStr != "eng" && codeStr != "swa" { + codeStr = "swa" + } + + res.Content = codeStr res.FlagSet = append(res.FlagSet, state.FLAG_LANG) res.FlagSet = append(res.FlagSet, flag_language_set) @@ -206,7 +213,7 @@ func (h *MenuHandlers) SetAccountFlags(ctx context.Context, sym string, input [] currentWrongPinAttempts, err := store.ReadEntry(ctx, sessionId, storedb.DATA_INCORRECT_PIN_ATTEMPTS) if err != nil { if !db.IsNotFound(err) { - return res, err + return res, nil } } pinAttemptsValue, _ := strconv.ParseUint(string(currentWrongPinAttempts), 0, 64)