This commit is contained in:
life
2014-09-22 14:06:46 +08:00
parent e240dfbafe
commit b8ced2e1c3
10 changed files with 326 additions and 5 deletions

@ -154,7 +154,7 @@ func (c BaseController) E404() revel.Result {
}
// 设置本地
func (c BaseController) SetLocale() {
func (c BaseController) SetLocale() string {
locale := string(c.Request.Locale) // zh-CN
lang := locale
if strings.Contains(locale, "-") {
@ -165,6 +165,7 @@ func (c BaseController) SetLocale() {
lang = "en";
}
c.RenderArgs["locale"] = lang;
return lang
}
// 设置userInfo

@ -17,9 +17,9 @@ func (c Index) Index() revel.Result {
c.SetUserInfo()
c.RenderArgs["title"] = "leanote"
c.RenderArgs["openRegister"] = openRegister
c.SetLocale()
lang := c.SetLocale()
return c.RenderTemplate("home/index.html");
return c.RenderTemplate("home/index_" + lang + ".html");
}
// 建议