Compare commits

..

No commits in common. "9274e585bd6aeda5c377b94640f23d0f94197188" and "a553731f02f3fb8bb53150a6982eca1629372a9b" have entirely different histories.

4 changed files with 6 additions and 13 deletions

View File

@ -635,18 +635,13 @@ func (h *Handlers) CheckBalance(ctx context.Context, sym string, input []byte) (
return res, fmt.Errorf("missing session") return res, fmt.Errorf("missing session")
} }
code := codeFromCtx(ctx)
l := gotext.NewLocale(translationDir, code)
l.AddDomain("default")
store := h.userdataStore store := h.userdataStore
// get the active sym and active balance // get the active sym and active balance
activeSym, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_SYM) activeSym, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_SYM)
if err != nil { if err != nil {
if db.IsNotFound(err) { if db.IsNotFound(err) {
balance := "0.00" res.Content = "0.00"
res.Content = l.Get("Balance: %s\n", balance)
return res, nil return res, nil
} }
@ -655,10 +650,10 @@ func (h *Handlers) CheckBalance(ctx context.Context, sym string, input []byte) (
activeBal, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_BAL) activeBal, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_BAL)
if err != nil { if err != nil {
return res, err return res, nil
} }
res.Content = l.Get("Balance: %s\n", fmt.Sprintf("%s %s", activeBal, activeSym)) res.Content = fmt.Sprintf("%s %s", activeBal, activeSym)
return res, nil return res, nil
} }

View File

@ -7,8 +7,6 @@ msgstr "Ombi lako limetumwa. %s atapokea %s kutoka kwa %s."
msgid "Thank you for using Sarafu. Goodbye!" msgid "Thank you for using Sarafu. Goodbye!"
msgstr "Asante kwa kutumia huduma ya Sarafu. Kwaheri!" msgstr "Asante kwa kutumia huduma ya Sarafu. Kwaheri!"
msgid "For more help,please call: 0757628885" msgid "For more help,please call: 0757628885"
msgstr "Kwa usaidizi zaidi,piga: 0757628885" msgstr "Kwa usaidizi zaidi,piga: 0757628885"
msgid "Balance: %s\n"
msgstr "Salio: %s\n"

View File

@ -1 +1 @@
{{.check_balance}} Balance: {{.check_balance}}

View File

@ -1 +1 @@
{{.check_balance}} Salio: {{.check_balance}}