mirror of https://github.com/go-gitea/gitea.git
Localize milestone related time strings (#24051)
- With #23988 in place, we can improve these timestamps --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
8aada1849f
commit
97176754be
|
@ -7,7 +7,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
repo_model "code.gitea.io/gitea/models/repo"
|
repo_model "code.gitea.io/gitea/models/repo"
|
||||||
|
@ -65,7 +64,6 @@ type Milestone struct {
|
||||||
DeadlineString string `xorm:"-"`
|
DeadlineString string `xorm:"-"`
|
||||||
|
|
||||||
TotalTrackedTime int64 `xorm:"-"`
|
TotalTrackedTime int64 `xorm:"-"`
|
||||||
TimeSinceUpdate int64 `xorm:"-"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -84,9 +82,6 @@ func (m *Milestone) BeforeUpdate() {
|
||||||
// AfterLoad is invoked from XORM after setting the value of a field of
|
// AfterLoad is invoked from XORM after setting the value of a field of
|
||||||
// this object.
|
// this object.
|
||||||
func (m *Milestone) AfterLoad() {
|
func (m *Milestone) AfterLoad() {
|
||||||
if !m.UpdatedUnix.IsZero() {
|
|
||||||
m.TimeSinceUpdate = time.Now().Unix() - m.UpdatedUnix.AsTime().Unix()
|
|
||||||
}
|
|
||||||
m.NumOpenIssues = m.NumIssues - m.NumClosedIssues
|
m.NumOpenIssues = m.NumIssues - m.NumClosedIssues
|
||||||
if m.DeadlineUnix.Year() == 9999 {
|
if m.DeadlineUnix.Year() == 9999 {
|
||||||
return
|
return
|
||||||
|
|
|
@ -1710,7 +1710,7 @@ pulls.delete.text = Do you really want to delete this pull request? (This will p
|
||||||
|
|
||||||
milestones.new = New Milestone
|
milestones.new = New Milestone
|
||||||
milestones.closed = Closed %s
|
milestones.closed = Closed %s
|
||||||
milestones.update_ago = Updated %s ago
|
milestones.updated = Updated
|
||||||
milestones.no_due_date = No due date
|
milestones.no_due_date = No due date
|
||||||
milestones.open = Open
|
milestones.open = Open
|
||||||
milestones.close = Close
|
milestones.close = Close
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{svg "octicon-calendar"}}
|
{{svg "octicon-calendar"}}
|
||||||
{{if .Milestone.DeadlineString}}
|
{{if .Milestone.DeadlineString}}
|
||||||
<span {{if .IsOverdue}}class="overdue"{{end}}>{{.Milestone.DeadlineString}}</span>
|
<span {{if .IsOverdue}}class="overdue"{{end}}>{{template "shared/datetime/short" (dict "Datetime" .Milestone.DeadlineString "Fallback" .Milestone.DeadlineString)}}</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{$.locale.Tr "repo.milestones.no_due_date"}}
|
{{$.locale.Tr "repo.milestones.no_due_date"}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{svg "octicon-calendar"}}
|
{{svg "octicon-calendar"}}
|
||||||
{{if .DeadlineString}}
|
{{if .DeadlineString}}
|
||||||
<span {{if .IsOverdue}}class="overdue"{{end}}>{{.DeadlineString}}</span>
|
<span {{if .IsOverdue}}class="overdue"{{end}}>{{template "shared/datetime/short" (dict "Datetime" .DeadlineString "Fallback" .DeadlineString)}}</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{$.locale.Tr "repo.milestones.no_due_date"}}
|
{{$.locale.Tr "repo.milestones.no_due_date"}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
{{svg "octicon-check" 16 "gt-mr-3"}}
|
{{svg "octicon-check" 16 "gt-mr-3"}}
|
||||||
{{LocaleNumber .NumClosedIssues}} {{$.locale.Tr "repo.issues.closed_title"}}
|
{{LocaleNumber .NumClosedIssues}} {{$.locale.Tr "repo.issues.closed_title"}}
|
||||||
{{if .TotalTrackedTime}}{{svg "octicon-clock"}} {{.TotalTrackedTime|Sec2Time}}{{end}}
|
{{if .TotalTrackedTime}}{{svg "octicon-clock"}} {{.TotalTrackedTime|Sec2Time}}{{end}}
|
||||||
{{if .UpdatedUnix}}{{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.update_ago" (.TimeSinceUpdate|Sec2Time)}}{{end}}
|
{{if .UpdatedUnix}}{{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.updated"}} {{TimeSinceUnix .UpdatedUnix $.locale}}{{end}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}}
|
{{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}}
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{svg "octicon-calendar"}}
|
{{svg "octicon-calendar"}}
|
||||||
{{if .DeadlineString}}
|
{{if .DeadlineString}}
|
||||||
<span {{if .IsOverdue}}class="overdue"{{end}}>{{.DeadlineString}}</span>
|
<span {{if .IsOverdue}}class="overdue"{{end}}>{{template "shared/datetime/short" (dict "Datetime" .DeadlineString "Fallback" .DeadlineString)}}</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{$.locale.Tr "repo.milestones.no_due_date"}}
|
{{$.locale.Tr "repo.milestones.no_due_date"}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in New Issue