29 lines
557 B
Go
29 lines
557 B
Go
|
package iface
|
||
|
|
||
|
import (
|
||
|
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/internal/handler/fsm/fsmcontract"
|
||
|
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/internal/locale"
|
||
|
)
|
||
|
|
||
|
type Base struct {
|
||
|
App fsmcontract.App
|
||
|
UserID int64
|
||
|
ChatID int64
|
||
|
}
|
||
|
|
||
|
func NewBase(app fsmcontract.App, userID int64, chatID int64) Base {
|
||
|
return Base{app, userID, chatID}
|
||
|
}
|
||
|
|
||
|
func (b Base) Localizer(lang string) locale.Localizer {
|
||
|
if len(lang) > 2 {
|
||
|
lang = lang[:2]
|
||
|
}
|
||
|
switch lang {
|
||
|
case "en", "ru":
|
||
|
return b.App.Localizer(lang)
|
||
|
default:
|
||
|
return b.App.Localizer("en")
|
||
|
}
|
||
|
}
|