lightningtipbot/internal/telegram/translate.go
LightningTipBot 903cc3c2e2
Lnurlp comments (#89)
* lnurl comments for RECEIVING

* fix import cycle

* fix import

* rename WebhookServer to Server

* rename LNURLInvoice to Invoice

* add str package. MarkdownEscape lnurl.Invoice comment

* add str package

* check for comment length

* lnurl pay with comment

* lnurl pay with comment

* check for wallet existence

* repackage main to internal

Co-authored-by: lngohumble <lngohumble@gmail.com>
2021-10-07 00:21:21 +03:00

24 lines
618 B
Go

package telegram
import (
"context"
"github.com/nicksnyder/go-i18n/v2/i18n"
log "github.com/sirupsen/logrus"
)
func Translate(ctx context.Context, MessgeID string) string {
str, err := LoadPublicLocalizer(ctx).Localize(&i18n.LocalizeConfig{MessageID: MessgeID})
if err != nil {
log.Warnf("Error translating message %s: %s", MessgeID, err)
}
return str
}
func TranslateUser(ctx context.Context, MessgeID string) string {
str, err := LoadUserLocalizer(ctx).Localize(&i18n.LocalizeConfig{MessageID: MessgeID})
if err != nil {
log.Warnf("Error translating message %s: %s", MessgeID, err)
}
return str
}