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:
authorHamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com>2023-05-20 18:16:05 +0300
committerHamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com>2023-05-20 18:16:05 +0300
commit4865754b3d3d2d6a3296c8b07bb69a7f0bb0c489 (patch)
treee129b5efd48ab9526b07e84a982a0290b4b0583e /web/web.go
parent92eaff9608f924f7a78a7837daecec6cfb252b50 (diff)
add localizer middleware to web.go
Diffstat (limited to 'web/web.go')
-rw-r--r--web/web.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/web/web.go b/web/web.go
index afac077f..d917dc7a 100644
--- a/web/web.go
+++ b/web/web.go
@@ -207,6 +207,13 @@ func (s *Server) initRouter() (*gin.Engine, error) {
return nil, err
}
+ // Apply locale middleware for i18n
+ webI18nFunc := func(key string, params ...string) string {
+ return locale.I18n(locale.Web, key, params...)
+ }
+ engine.FuncMap["i18n"] = webI18nFunc
+ engine.Use(locale.LocalizerMiddleware())
+
// set static files and template
if config.IsDebug() {
// for development