diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-17 11:37:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 11:37:23 +0800 |
commit | 7681d582cdae42d9322309ddf732117e6d332776 (patch) | |
tree | 6cdfa61a2055f23153884404fe93d4b4792fd532 /templates/user | |
parent | be7cd73439c2210bfd889915f74d66686e99dab6 (diff) | |
download | gitea-7681d582cdae42d9322309ddf732117e6d332776.tar.gz gitea-7681d582cdae42d9322309ddf732117e6d332776.zip |
Refactor locale number (#24134)
Before, the `GiteaLocaleNumber.js` was just written as a a drop-in
replacement for old `js-pretty-number`.
Actually, we can use Golang's `text` package to format.
This PR partially completes the TODOs in `GiteaLocaleNumber.js`:
> if we have complete backend locale support (eg: Golang "x/text"
package), we can drop this component.
> tooltip: only 2 usages of this, we can replace it with Golang's
"x/text/number" package in the future.
This PR also helps #24131
Screenshots:
<details>
![image](https://user-images.githubusercontent.com/2114189/232179420-b1b9974b-9d96-4408-b209-b80182c8b359.png)
![image](https://user-images.githubusercontent.com/2114189/232179416-14f36aa0-3f3e-4ac9-b366-7bd3a4464a11.png)
</details>
Diffstat (limited to 'templates/user')
-rw-r--r-- | templates/user/dashboard/issues.tmpl | 4 | ||||
-rw-r--r-- | templates/user/dashboard/milestones.tmpl | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index 6b9bfe4eba..5a207aac60 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -65,11 +65,11 @@ <div class="ui compact tiny menu"> <a class="item{{if not .IsShowClosed}} active{{end}}" href="{{.Link}}?type={{$.ViewType}}&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state=open&q={{$.Keyword}}"> {{svg "octicon-issue-opened" 16 "gt-mr-3"}} - {{LocaleNumber .IssueStats.OpenCount}} {{.locale.Tr "repo.issues.open_title"}} + {{.locale.PrettyNumber .IssueStats.OpenCount}} {{.locale.Tr "repo.issues.open_title"}} </a> <a class="item{{if .IsShowClosed}} active{{end}}" href="{{.Link}}?type={{$.ViewType}}&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state=closed&q={{$.Keyword}}"> {{svg "octicon-issue-closed" 16 "gt-mr-3"}} - {{LocaleNumber .IssueStats.ClosedCount}} {{.locale.Tr "repo.issues.closed_title"}} + {{.locale.PrettyNumber .IssueStats.ClosedCount}} {{.locale.Tr "repo.issues.closed_title"}} </a> </div> </div> diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index 9915159721..39eea2fc75 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -39,11 +39,11 @@ <div class="ui compact tiny menu"> <a class="item{{if not .IsShowClosed}} active{{end}}" href="{{.Link}}?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state=open&q={{$.Keyword}}"> {{svg "octicon-milestone" 16 "gt-mr-3"}} - {{LocaleNumber .MilestoneStats.OpenCount}} {{.locale.Tr "repo.issues.open_title"}} + {{.locale.PrettyNumber .MilestoneStats.OpenCount}} {{.locale.Tr "repo.issues.open_title"}} </a> <a class="item{{if .IsShowClosed}} active{{end}}" href="{{.Link}}?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state=closed&q={{$.Keyword}}"> {{svg "octicon-check" 16 "gt-mr-3"}} - {{LocaleNumber .MilestoneStats.ClosedCount}} {{.locale.Tr "repo.issues.closed_title"}} + {{.locale.PrettyNumber .MilestoneStats.ClosedCount}} {{.locale.Tr "repo.issues.closed_title"}} </a> </div> </div> @@ -104,9 +104,9 @@ {{end}} <span class="issue-stats"> {{svg "octicon-issue-opened" 16 "gt-mr-3"}} - {{LocaleNumber .NumOpenIssues}} {{$.locale.Tr "repo.issues.open_title"}} + {{.locale.PrettyNumber .NumOpenIssues}} {{$.locale.Tr "repo.issues.open_title"}} {{svg "octicon-check" 16 "gt-mr-3"}} - {{LocaleNumber .NumClosedIssues}} {{$.locale.Tr "repo.issues.closed_title"}} + {{.locale.PrettyNumber .NumClosedIssues}} {{$.locale.Tr "repo.issues.closed_title"}} {{if .TotalTrackedTime}} {{svg "octicon-clock"}} {{.TotalTrackedTime|Sec2Time}} {{end}} |