1
0
Эх сурвалжийг харах

refactor and add i18n, to be continue

Ben Stone 4 жил өмнө
parent
commit
ec2888940e

+ 5 - 1
conf/lang/en-us.ini

@@ -63,4 +63,8 @@ account_existed = Username already existed
 failed_register = Registration failed, please contact the system administrator
 failed_obtain_user_info = Failed to obtain identity information
 dingtalk_auto_login_not_enable = DingTalk automatic login function is not enabled
-failed_auto_login = Automatic login failed
+failed_auto_login = Automatic login failed
+no_project = No Project
+
+[blog]
+author = author

+ 5 - 1
conf/lang/zh-cn.ini

@@ -63,4 +63,8 @@ account_existed = 账号已存在
 failed_register = 注册失败,请联系管理员
 failed_obtain_user_info = 获取身份信息失败
 dingtalk_auto_login_not_enable = 未开启钉钉自动登录功能
-failed_auto_login = 自动登录失败
+failed_auto_login = 自动登录失败
+no_project = 暂无项目
+
+[blog]
+author = 作者

+ 0 - 4
controllers/HomeController.go

@@ -28,14 +28,11 @@ func (c *HomeController) Index() {
 
 	pageIndex, _ := c.GetInt("page", 1)
 	pageSize := 18
-
 	memberId := 0
-
 	if c.Member != nil {
 		memberId = c.Member.MemberId
 	}
 	books, totalCount, err := models.NewBook().FindForHomeToPager(pageIndex, pageSize, memberId)
-
 	if err != nil {
 		logs.Error(err)
 		c.Abort("500")
@@ -47,6 +44,5 @@ func (c *HomeController) Index() {
 		c.Data["PageHtml"] = ""
 	}
 	c.Data["TotalPages"] = int(math.Ceil(float64(totalCount) / float64(pageSize)))
-
 	c.Data["Lists"] = books
 }

+ 2 - 2
views/home/index.tpl

@@ -35,7 +35,7 @@
                             </dd>
                             <dd>
                             <span class="author">
-                                <b class="text">作者</b>
+                                <b class="text">{{i18n $.Lang "blog.author"}}</b>
                                 <b class="text">-</b>
                                 <b class="text">{{if eq $item.RealName "" }}{{$item.CreateName}}{{else}}{{$item.RealName}}{{end}}</b>
                             </span>
@@ -43,7 +43,7 @@
                         </dl>
                     </div>
                 {{else}}
-                    <div class="text-center" style="height: 200px;margin: 100px;font-size: 28px;">暂无项目</div>
+                    <div class="text-center" style="height: 200px;margin: 100px;font-size: 28px;">{{i18n $.Lang "message.no_project"}}</div>
                 {{end}}
                 <div class="clearfix"></div>
             </div>