l10n and bot command auto generation; v0.6.0

This commit is contained in:
2026-02-18 11:39:20 +03:00
parent bb51a0ecb1
commit b2bda02c0f
11 changed files with 182 additions and 102 deletions

View File

@@ -212,3 +212,11 @@ func (ctx *MsgContext) error(err error) {
func (ctx *MsgContext) Error(err error) {
ctx.error(err)
}
func (ctx *MsgContext) Translate(key string) string {
if ctx.From == nil {
return key
}
lang := Val(ctx.From.LanguageCode, ctx.Bot.l10n.GetFallbackLanguage())
return ctx.Bot.L10n(lang, key)
}