mirror of https://gitee.com/answerdev/answer.git
feat(template/i18n): backend template render synchronous with frontend
This commit is contained in:
parent
892d76928f
commit
82f1e72483
|
@ -3,6 +3,7 @@ package controller
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/segmentfault/pacman/i18n"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"regexp"
|
||||
|
@ -307,7 +308,7 @@ func (tc *TemplateController) html(ctx *gin.Context, code int, tpl string, siteI
|
|||
data["siteinfo"] = siteInfo
|
||||
data["scriptPath"] = tc.scriptPath
|
||||
data["cssPath"] = tc.cssPath
|
||||
data["language"] = handler.GetLang(ctx)
|
||||
data["language"] = i18n.LanguageChinese //handler.GetLang(ctx)
|
||||
data["timezone"] = siteInfo.Interface.TimeZone
|
||||
|
||||
ctx.HTML(code, tpl, data)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
</button>
|
||||
<button type="button"
|
||||
class="link-secondary m-0 p-0 btn-no-border btn btn-link btn-sm">
|
||||
Reply
|
||||
{{translator $.language "ui.comment.btn_reply"}}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
class="d-flex flex-wrap align-items-center fs-14 mb-3 text-secondary">
|
||||
<time class="me-3"
|
||||
datetime="{{timeFormatISO $.timezone .detail.CreateTime}}"
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .detail.CreateTime}}">Asked {{translatorTimeFormat $.language $.timezone .detail.CreateTime}}
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .detail.CreateTime}}">{{translator $.language "ui.question_detail.Asked"}} {{translatorTimeFormat $.language $.timezone .detail.CreateTime}}
|
||||
</time>
|
||||
<time class="me-3"
|
||||
datetime="{{timeFormatISO $.timezone .detail.UpdateTime}}"
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .detail.UpdateTime}}">Modified {{translatorTimeFormat $.language $.timezone .detail.UpdateTime}}
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .detail.UpdateTime}}">{{translator $.language "ui.question_detail.update"}} {{translatorTimeFormat $.language $.timezone .detail.UpdateTime}}
|
||||
</time>
|
||||
<div class="me-3">Viewed {{.detail.ViewCount}}</div>
|
||||
<div class="me-3">{{translator $.language "ui.question_detail.Views"}} {{.detail.ViewCount}}</div>
|
||||
|
||||
</div>
|
||||
<div class="m-n1">
|
||||
|
@ -54,7 +54,8 @@
|
|||
<a href="/posts/{{.detail.ID}}/timeline">
|
||||
<time class="link-secondary fs-14"
|
||||
datetime="{{timeFormatISO $.timezone .detail.UpdateTime}}"
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .detail.UpdateTime}}">edited {{translatorTimeFormat $.language $.timezone .detail.UpdateTime}}
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .detail.UpdateTime}}">
|
||||
{{translator $.language "ui.question_detail.edit"}} {{translatorTimeFormat $.language $.timezone .detail.UpdateTime}}
|
||||
</time>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -79,7 +80,7 @@
|
|||
<a href="/posts/{{.detail.ID}}/timeline">
|
||||
<time class="link-secondary"
|
||||
datetime="{{timeFormatISO $.timezone .detail.CreateTime}}"
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .detail.CreateTime}}">asked {{translatorTimeFormat $.language $.timezone .detail.CreateTime}}
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .detail.CreateTime}}">{{translator $.language "ui.question_detail.asked"}} {{translatorTimeFormat $.language $.timezone .detail.CreateTime}}
|
||||
</time>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -116,7 +117,7 @@
|
|||
{{if eq 2 .Adopted}}
|
||||
<button type="button" disabled=""
|
||||
class="ms-3 active opacity-100 bg-success text-white btn btn-outline-success">
|
||||
<i class="br bi-check-circle-fill me-2"></i><span>Accepted</span>
|
||||
<i class="br bi-check-circle-fill me-2"></i><span>{{translator $.language "ui.question_detail.answers.btn_accepted"}}</span>
|
||||
</button>
|
||||
{{end}}
|
||||
</div>
|
||||
|
@ -131,7 +132,8 @@
|
|||
<time
|
||||
class="link-secondary fs-14"
|
||||
datetime="{{timeFormatISO $.timezone .UpdateTime}}"
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .UpdateTime}}">edited {{translatorTimeFormat $.language $.timezone .UpdateTime}}
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .UpdateTime}}">
|
||||
{{translator $.language "ui.question_detail.edit"}} {{translatorTimeFormat $.language $.timezone .UpdateTime}}
|
||||
</time>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -157,7 +159,7 @@
|
|||
<time
|
||||
class="link-secondary"
|
||||
datetime="{{timeFormatISO $.timezone .CreateTime}}"
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .CreateTime}}">answered {{translatorTimeFormat $.language $.timezone .CreateTime}}
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .CreateTime}}">{{translator $.language "ui.question_detail.answered"}} {{translatorTimeFormat $.language $.timezone .CreateTime}}
|
||||
</time>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="col-xxl-7 col-lg-8 col-sm-12">
|
||||
<div>
|
||||
<div class="mb-3 d-flex flex-wrap justify-content-between">
|
||||
<h5 class="fs-5 text-nowrap mb-3 mb-md-0">All Questions</h5>
|
||||
<h5 class="fs-5 text-nowrap mb-3 mb-md-0">{{translator $.language "ui.question.all_questions"}}</h5>
|
||||
</div>
|
||||
<div class="border-top border-bottom-0 list-group list-group-flush">
|
||||
{{range .data}}
|
||||
|
@ -23,7 +23,7 @@
|
|||
•
|
||||
<time class="text-secondary ms-1"
|
||||
datetime="{{timeFormatISO $.timezone .CreateTime}}"
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .CreateTime}}">asked {{translatorTimeFormat $.language $.timezone .CreateTime}}
|
||||
title="{{translatorTimeFormatLongDate $.language $.timezone .CreateTime}}">{{translator $.language "ui.question.asked"}} {{translatorTimeFormat $.language $.timezone .CreateTime}}
|
||||
</time>
|
||||
</div>
|
||||
<div class="ms-0 ms-md-3 mt-2 mt-md-0">
|
||||
|
|
Loading…
Reference in New Issue