From 177b05b674c09ca2af829a8d9f33c6b8674acc9f Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sun, 16 Aug 2020 18:09:10 +0300 Subject: [PATCH] see prev commit --- core/router/router_subdomain_redirect_wrapper.go | 4 +++- i18n/loader.go | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/router/router_subdomain_redirect_wrapper.go b/core/router/router_subdomain_redirect_wrapper.go index dcbd5f44..17ac3697 100644 --- a/core/router/router_subdomain_redirect_wrapper.go +++ b/core/router/router_subdomain_redirect_wrapper.go @@ -150,6 +150,7 @@ func (s *subdomainRedirectWrapper) Wrapper(w http.ResponseWriter, r *http.Reques return } + /* Think of another way. As it's a breaking change. if s.isFromRoot && !s.isFromAny { // Then we must not continue, // the subdomain didn't match the "to" but the from @@ -159,8 +160,9 @@ func (s *subdomainRedirectWrapper) Wrapper(w http.ResponseWriter, r *http.Reques // http://registered_host_but_not_in_app.your.mydomain.com http.NotFound(w, r) return - } + */ + // the from subdomain is not matched and it's not from root. router(w, r) return diff --git a/i18n/loader.go b/i18n/loader.go index 77aee50f..afc7782d 100644 --- a/i18n/loader.go +++ b/i18n/loader.go @@ -188,7 +188,11 @@ func (l MemoryLocalizer) GetLocale(index int) context.Locale { index = 0 } - return l[index] + if locale, ok := l[index]; ok { + return locale + } + + return l[0] } // SetDefault changes the default language based on the "index".