PLT-7: Refactoring api to use translations (chunk 4)

- Translation for api templates english and spanish
Этот коммит содержится в:
Elias Nahum
2016-01-24 17:10:54 -03:00
родитель eb58e631e7
Коммит 470349d105
34 изменённых файлов: 2110 добавлений и 1548 удалений

Просмотреть файл

@@ -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})
}