From 9cc75185b3fcdf99f626d7d1f79dff0a4e076e69 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Fri, 23 Aug 2024 01:05:14 +0300 Subject: [PATCH] creuse a universal quit message --- cmd/main.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 694eebb..17eb906 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -14,6 +14,7 @@ import ( "git.defalsify.org/vise.git/cache" "git.defalsify.org/vise.git/engine" + "git.defalsify.org/vise.git/lang" "git.defalsify.org/vise.git/persist" "git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/state" @@ -76,6 +77,16 @@ type fsData struct { st *state.State } +func codeFromCtx(ctx context.Context) string { + var code string + engine.Logg.DebugCtxf(ctx, "in msg", "ctx", ctx, "val", code) + if ctx.Value("Language") != nil { + lang := ctx.Value("Language").(lang.Language) + code = lang.Code + } + return code +} + func (fsd *fsData) SetLanguageSelected(ctx context.Context, sym string, input []byte) (resource.Result, error) { inputStr := string(input) res := resource.Result{} @@ -269,8 +280,12 @@ func checkAccountStatus(trackingId string) (string, error) { } func (fsd *fsData) quit(ctx context.Context, sym string, input []byte) (resource.Result, error) { - res := resource.Result{ - Content: "Your account is being created", + res := resource.Result{} + switch codeFromCtx(ctx) { + case "swa": + res.Content = "Asante kwa kutumia huduma ya Sarafu. Kwaheri!" + default: + res.Content = "Thank you for using Sarafu. Goodbye!" } res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED) return res, nil