From 470349d105642d7a293983a8a1f8a369dc789621 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Sun, 24 Jan 2016 17:10:54 -0300 Subject: PLT-7: Refactoring api to use translations (chunk 4) - Translation for api templates english and spanish --- api/context.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'api/context.go') 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}) } -- cgit v1.2.3-1-g7c22