creuse a universal quit message

This commit is contained in:
Alfred Kamanda 2024-08-23 01:05:14 +03:00
parent f50be01b89
commit 9cc75185b3
Signed by: Alfred-mk
GPG Key ID: 7EA3D01708908703

View File

@ -14,6 +14,7 @@ import (
"git.defalsify.org/vise.git/cache" "git.defalsify.org/vise.git/cache"
"git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/lang"
"git.defalsify.org/vise.git/persist" "git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/state" "git.defalsify.org/vise.git/state"
@ -76,6 +77,16 @@ type fsData struct {
st *state.State 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) { func (fsd *fsData) SetLanguageSelected(ctx context.Context, sym string, input []byte) (resource.Result, error) {
inputStr := string(input) inputStr := string(input)
res := resource.Result{} 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) { func (fsd *fsData) quit(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{ res := resource.Result{}
Content: "Your account is being created", 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) res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
return res, nil return res, nil