2021-07-22 17:43:32 +00:00
|
|
|
package layout
|
|
|
|
|
|
|
|
import (
|
2022-01-19 13:31:36 +00:00
|
|
|
tele "gopkg.in/telebot.v3"
|
2021-07-22 17:43:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// DefaultLayout is a simplified layout instance with pre-defined locale by default.
|
|
|
|
type DefaultLayout struct {
|
|
|
|
locale string
|
2021-08-28 18:40:45 +00:00
|
|
|
lt *Layout
|
2022-10-02 19:11:28 +00:00
|
|
|
|
|
|
|
Config
|
2021-07-22 17:43:32 +00:00
|
|
|
}
|
|
|
|
|
2021-09-13 07:43:24 +00:00
|
|
|
// Settings returns layout settings.
|
|
|
|
func (dlt *DefaultLayout) Settings() tele.Settings {
|
|
|
|
return dlt.lt.Settings()
|
|
|
|
}
|
|
|
|
|
2021-07-22 17:43:32 +00:00
|
|
|
// Text wraps localized layout function Text using your default locale.
|
|
|
|
func (dlt *DefaultLayout) Text(k string, args ...interface{}) string {
|
|
|
|
return dlt.lt.TextLocale(dlt.locale, k, args...)
|
|
|
|
}
|
|
|
|
|
2021-07-29 19:36:03 +00:00
|
|
|
// Callback returns a callback endpoint used to handle buttons.
|
|
|
|
func (dlt *DefaultLayout) Callback(k string) tele.CallbackEndpoint {
|
|
|
|
return dlt.lt.Callback(k)
|
|
|
|
}
|
|
|
|
|
2021-07-22 17:43:32 +00:00
|
|
|
// Button wraps localized layout function Button using your default locale.
|
|
|
|
func (dlt *DefaultLayout) Button(k string, args ...interface{}) *tele.Btn {
|
|
|
|
return dlt.lt.ButtonLocale(dlt.locale, k, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Markup wraps localized layout function Markup using your default locale.
|
|
|
|
func (dlt *DefaultLayout) Markup(k string, args ...interface{}) *tele.ReplyMarkup {
|
|
|
|
return dlt.lt.MarkupLocale(dlt.locale, k, args...)
|
|
|
|
}
|
2021-07-25 11:15:42 +00:00
|
|
|
|
|
|
|
// Result wraps localized layout function Result using your default locale.
|
|
|
|
func (dlt *DefaultLayout) Result(k string, args ...interface{}) tele.Result {
|
|
|
|
return dlt.lt.ResultLocale(dlt.locale, k, args...)
|
|
|
|
}
|