Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/locale/locale.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/web/locale/locale.go b/web/locale/locale.go
index 8b32d04d..9a4357c3 100644
--- a/web/locale/locale.go
+++ b/web/locale/locale.go
@@ -37,6 +37,11 @@ func InitLocalizer(i18nFS embed.FS, settingService SettingService) error {
return err
}
+ // setup bot locale
+ if err := initTGBotLocalizer(settingService); err != nil {
+ return err
+ }
+
return nil
}
@@ -83,6 +88,16 @@ func I18n(i18nType I18nType, key string, params ...string) string {
return msg
}
+func initTGBotLocalizer(settingService SettingService) error {
+ botLang, err := settingService.GetTgLang()
+ if err != nil {
+ return err
+ }
+
+ LocalizerBot = i18n.NewLocalizer(i18nBundle, botLang)
+ return nil
+}
+
func LocalizerMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
var lang string