diff options
| author | Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com> | 2023-05-20 18:16:05 +0300 |
|---|---|---|
| committer | Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com> | 2023-05-20 18:16:05 +0300 |
| commit | 4865754b3d3d2d6a3296c8b07bb69a7f0bb0c489 (patch) | |
| tree | e129b5efd48ab9526b07e84a982a0290b4b0583e /web/web.go | |
| parent | 92eaff9608f924f7a78a7837daecec6cfb252b50 (diff) | |
add localizer middleware to web.go
Diffstat (limited to 'web/web.go')
| -rw-r--r-- | web/web.go | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 |
