support 中文繁体
This commit is contained in:
Gulpfile.js
app
conf
messages
album.en-usalbum.fr-fralbum.pt-ptalbum.zh-cnalbum.zh-hkblog.en-usblog.fr-frblog.pt-ptblog.zh-cnblog.zh-hkmarkdown.en-usmarkdown.fr-frmarkdown.pt-ptmarkdown.zh-cnmarkdown.zh-hkmember.en-usmember.fr-frmember.pt-ptmember.zh-cnmember.zh-hkmsg.en-usmsg.fr-frmsg.pt-ptmsg.zh-cnmsg.zh-hk
public
24
app/init.go
24
app/init.go
@ -10,6 +10,7 @@ import (
|
||||
"github.com/leanote/leanote/app/db"
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
_ "github.com/leanote/leanote/app/lea/binder"
|
||||
"github.com/leanote/leanote/app/lea/i18n"
|
||||
"github.com/leanote/leanote/app/lea/route"
|
||||
"github.com/leanote/leanote/app/service"
|
||||
"github.com/revel/revel"
|
||||
@ -38,9 +39,10 @@ func init() {
|
||||
// session.SessionFilter, // leanote session
|
||||
// session.MSessionFilter, // leanote memcache session
|
||||
|
||||
revel.FlashFilter, // Restore and write the flash cookie.
|
||||
revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
|
||||
revel.I18nFilter, // Resolve the requested language
|
||||
revel.FlashFilter, // Restore and write the flash cookie.
|
||||
revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
|
||||
// revel.I18nFilter, // Resolve the requested language
|
||||
i18n.I18nFilter, // Resolve the requested language by leanote
|
||||
revel.InterceptorFilter, // Run interceptors around the action.
|
||||
revel.CompressFilter, // Compress the result.
|
||||
revel.ActionInvoker, // Invoke the action.
|
||||
@ -180,10 +182,18 @@ func init() {
|
||||
return template.HTML(tagStr)
|
||||
}
|
||||
|
||||
revel.TemplateFuncs["msg"] = func(renderArgs map[string]interface{}, message string, args ...interface{}) template.HTML {
|
||||
str, ok := renderArgs[revel.CurrentLocaleRenderArg].(string)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
return template.HTML(i18n.Message(str, message, args...))
|
||||
}
|
||||
|
||||
// 不用revel的msg
|
||||
revel.TemplateFuncs["leaMsg"] = func(renderArgs map[string]interface{}, key string) template.HTML {
|
||||
locale, _ := renderArgs[revel.CurrentLocaleRenderArg].(string)
|
||||
str := revel.Message(locale, key)
|
||||
str := i18n.Message(locale, key)
|
||||
if strings.HasPrefix(str, "???") {
|
||||
str = key
|
||||
}
|
||||
@ -392,9 +402,9 @@ func init() {
|
||||
*/
|
||||
|
||||
/*
|
||||
{{range $i := N 1 10}}
|
||||
<div>{{$i}}</div>
|
||||
{{end}}
|
||||
{{range $i := N 1 10}}
|
||||
<div>{{$i}}</div>
|
||||
{{end}}
|
||||
*/
|
||||
revel.TemplateFuncs["N"] = func(start, end int) (stream chan int) {
|
||||
stream = make(chan int)
|
||||
|
Reference in New Issue
Block a user