mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-19 05:13:59 +08:00
refactor: use translations to support rtl
This commit is contained in:
parent
2b39981064
commit
ad4d893ad5
|
@ -165,6 +165,7 @@ func NewFuncMap() template.FuncMap {
|
||||||
"RenderMarkdownToHtml": RenderMarkdownToHtml,
|
"RenderMarkdownToHtml": RenderMarkdownToHtml,
|
||||||
"RenderLabel": RenderLabel,
|
"RenderLabel": RenderLabel,
|
||||||
"RenderLabels": RenderLabels,
|
"RenderLabels": RenderLabels,
|
||||||
|
"RenderDependencies": RenderDependencies,
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
// misc
|
// misc
|
||||||
|
|
|
@ -224,3 +224,21 @@ func RenderLabels(ctx context.Context, labels []*issues_model.Label, repoLink st
|
||||||
htmlCode += "</span>"
|
htmlCode += "</span>"
|
||||||
return template.HTML(htmlCode)
|
return template.HTML(htmlCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RenderDependencies(ctx context.Context, dependencies []*issues_model.DependencyInfo) template.HTML {
|
||||||
|
if dependencies == nil || len(dependencies) < 1 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
htmlCode := ""
|
||||||
|
|
||||||
|
for index, dependency := range dependencies {
|
||||||
|
if index != 0 {
|
||||||
|
htmlCode += `<span>,</span>`
|
||||||
|
}
|
||||||
|
htmlCode += fmt.Sprintf(`<a href="%s" data-tooltip-content="#%d %s" class="gt-ml-2">#%d</a>`,
|
||||||
|
dependency.Issue.Link(), dependency.Issue.Index, RenderEmoji(ctx, dependency.Issue.Title), dependency.Issue.Index)
|
||||||
|
}
|
||||||
|
|
||||||
|
return template.HTML(htmlCode)
|
||||||
|
}
|
||||||
|
|
|
@ -1685,9 +1685,9 @@ issues.dependency.issue_close_blocked = You need to close all issues blocking th
|
||||||
issues.dependency.issue_batch_close_blocked = "Cannot batch close issues that you choose, because issue #%d still has open dependencies"
|
issues.dependency.issue_batch_close_blocked = "Cannot batch close issues that you choose, because issue #%d still has open dependencies"
|
||||||
issues.dependency.pr_close_blocked = You need to close all issues blocking this pull request before you can merge it.
|
issues.dependency.pr_close_blocked = You need to close all issues blocking this pull request before you can merge it.
|
||||||
issues.dependency.blocks_short = Blocks
|
issues.dependency.blocks_short = Blocks
|
||||||
issues.dependency.blocks_following = Blocks:
|
issues.dependency.blocks_following = Blocks: %s
|
||||||
issues.dependency.blocked_by_short = Depends on
|
issues.dependency.blocked_by_short = Depends on
|
||||||
issues.dependency.blocked_by_following = Depends on:
|
issues.dependency.blocked_by_following = Depends on: %s
|
||||||
issues.dependency.remove_header = Remove Dependency
|
issues.dependency.remove_header = Remove Dependency
|
||||||
issues.dependency.issue_remove_text = This will remove the dependency from this issue. Continue?
|
issues.dependency.issue_remove_text = This will remove the dependency from this issue. Continue?
|
||||||
issues.dependency.pr_remove_text = This will remove the dependency from this pull request. Continue?
|
issues.dependency.pr_remove_text = This will remove the dependency from this pull request. Continue?
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
{{if and .DependenciesMap (index .DependenciesMap .ID)}}
|
{{if .Dependencies}}
|
||||||
<div class="flex-text-inline gt-gap-0">
|
<div class="flex-text-inline gt-gap-0">
|
||||||
<strong class="gt-mr-2">{{.Title}}</strong>
|
{{(ctx.Locale.Tr .TitleKey (RenderDependencies ctx .Dependencies)) | Safe}}
|
||||||
{{$first := true}}
|
</div>
|
||||||
{{range (index .DependenciesMap .ID)}}
|
|
||||||
{{if not $first}}<span class="gt-mr-2">,</span>{{end}}
|
|
||||||
{{$first = false}}
|
|
||||||
<a href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}">
|
|
||||||
#{{.Issue.Index}}
|
|
||||||
</a>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -119,13 +119,11 @@
|
||||||
</span>
|
</span>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{template "shared/issue_dependency" (dict
|
{{template "shared/issue_dependency" (dict
|
||||||
"ID" .ID
|
"Dependencies" (index $.BlockingDependenciesMap .ID)
|
||||||
"DependenciesMap" $.BlockingDependenciesMap
|
"TitleKey" "repo.issues.dependency.blocks_following")}}
|
||||||
"Title" (ctx.Locale.Tr "repo.issues.dependency.blocks_following"))}}
|
|
||||||
{{template "shared/issue_dependency" (dict
|
{{template "shared/issue_dependency" (dict
|
||||||
"ID" .ID
|
"Dependencies" (index $.BlockedByDependenciesMap .ID)
|
||||||
"DependenciesMap" $.BlockedByDependenciesMap
|
"TitleKey" "repo.issues.dependency.blocked_by_following")}}
|
||||||
"Title" (ctx.Locale.Tr "repo.issues.dependency.blocked_by_following"))}}
|
|
||||||
{{if .IsPull}}
|
{{if .IsPull}}
|
||||||
{{$approveOfficial := call $approvalCounts .ID "approve"}}
|
{{$approveOfficial := call $approvalCounts .ID "approve"}}
|
||||||
{{$rejectOfficial := call $approvalCounts .ID "reject"}}
|
{{$rejectOfficial := call $approvalCounts .ID "reject"}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user