mirror of
https://github.com/kataras/iris.git
synced 2025-12-29 07:47:22 +00:00
Add the article 'CRUD REST API in Iris (a framework for golang)' and a starter kit for Iris written by @jebzmos4
Former-commit-id: 72eb72f11086b23c1bf849eb14ad846492a84cbd
This commit is contained in:
@@ -19,10 +19,8 @@ type i18nMiddleware struct {
|
||||
func (i *i18nMiddleware) ServeHTTP(ctx context.Context) {
|
||||
wasByCookie := false
|
||||
|
||||
language := i.config.Default
|
||||
|
||||
langKey := ctx.Application().ConfigurationReadOnly().GetTranslateLanguageContextKey()
|
||||
language = ctx.Values().GetString(langKey)
|
||||
language := ctx.Values().GetString(langKey)
|
||||
if language == "" {
|
||||
// try to get by url parameter
|
||||
language = ctx.URLParam(i.config.URLParameter)
|
||||
@@ -50,6 +48,7 @@ func (i *i18nMiddleware) ServeHTTP(ctx context.Context) {
|
||||
if !wasByCookie {
|
||||
ctx.SetCookieKV(langKey, language)
|
||||
}
|
||||
|
||||
if language == "" {
|
||||
language = i.config.Default
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user