summaryrefslogtreecommitdiffstats
path: root/api/context.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-01-19 22:14:26 -0600
committerCorey Hulen <corey@hulen.com>2016-01-19 22:14:26 -0600
commit1acd38b7b19521d06d274c42c00ce7072cd92196 (patch)
treed87809ff2a306e5428b0ab6973d05509baa21abd /api/context.go
parent36c5c46e24f745ee80b49f47363217fcb740ce53 (diff)
parent96f8394bf451fd5a903f1f107fb276c61f6c2009 (diff)
downloadchat-1acd38b7b19521d06d274c42c00ce7072cd92196.tar.gz
chat-1acd38b7b19521d06d274c42c00ce7072cd92196.tar.bz2
chat-1acd38b7b19521d06d274c42c00ce7072cd92196.zip
Merge pull request #1926 from mattermost/PLT-7-context
PLT-7 Adding translation function to context
Diffstat (limited to 'api/context.go')
-rw-r--r--api/context.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/api/context.go b/api/context.go
index e8ec6576d..b6ffb1a29 100644
--- a/api/context.go
+++ b/api/context.go
@@ -15,6 +15,7 @@ import (
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
var sessionCache *utils.Cache = utils.NewLru(model.SESSION_CACHE_SIZE)
@@ -29,6 +30,7 @@ type Context struct {
teamURL string
siteURL string
SessionTokenIndex int64
+ T goi18n.TranslateFunc
}
type Page struct {
@@ -81,10 +83,10 @@ type handler struct {
}
func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-
l4g.Debug("%v", r.URL.Path)
c := &Context{}
+ c.T = utils.GetTranslations(w, r)
c.RequestId = model.NewId()
c.IpAddress = GetIpAddress(r)