cd844aec45
This consolidates the places where a default language has to be set. - Removed import of the 'userService' package into the 'languages' util package This was required to prevent a cyclic import between the two packages. - Added a 'UserRetriever' interface to read the language setting of users inside the 'languages' package
16 lignes
447 o
Go
16 lignes
447 o
Go
package router
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/ewhal/nyaa/util/languages"
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
func FaqHandler(w http.ResponseWriter, r *http.Request) {
|
|
languages.SetTranslationFromRequest(faqTemplate, r)
|
|
err := faqTemplate.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, NewSearchForm(), GetUser(r), r.URL, mux.CurrentRoute(r)})
|
|
if err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
}
|
|
}
|