diff options
author | Corey Hulen <corey@hulen.com> | 2016-01-24 23:07:03 -0500 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-01-24 23:07:03 -0500 |
commit | e8faaa9dd14949ef39c8f4587c3472a4a54046e7 (patch) | |
tree | ec46e0a48aafc4a6bdf145821a6b5f02c981bc88 /api/context.go | |
parent | 711594f227aa9f30e262d243d2e549ef201f24f3 (diff) | |
parent | e880835fbbeea4c26fc9a94b1b0a92f7692b0b82 (diff) | |
download | chat-e8faaa9dd14949ef39c8f4587c3472a4a54046e7.tar.gz chat-e8faaa9dd14949ef39c8f4587c3472a4a54046e7.tar.bz2 chat-e8faaa9dd14949ef39c8f4587c3472a4a54046e7.zip |
Merge pull request #1968 from ZBoxApp/PLT-7-templates
PLT-7: Refactoring api to use translations (chunk 4)
Diffstat (limited to 'api/context.go')
-rw-r--r-- | api/context.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/api/context.go b/api/context.go index f47ed1c30..41a52fa0c 100644 --- a/api/context.go +++ b/api/context.go @@ -5,6 +5,7 @@ package api import ( "fmt" + "html/template" "net" "net/http" "net/url" @@ -37,6 +38,8 @@ type Context struct { type Page struct { TemplateName string Props map[string]string + Extra map[string]string + Html map[string]template.HTML ClientCfg map[string]string ClientLicense map[string]string User *model.User @@ -507,6 +510,10 @@ func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request) props["SiteURL"] = GetProtocol(r) + "://" + r.Host } + T, _ := utils.GetTranslationsAndLocale(w, r) + props["Title"] = T("api.templates.error.title", map[string]interface{}{"SiteName": utils.ClientCfg["SiteName"]}) + props["Link"] = T("api.templates.error.link") + w.WriteHeader(err.StatusCode) ServerTemplates.ExecuteTemplate(w, "error.html", Page{Props: props, ClientCfg: utils.ClientCfg}) } |