aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates/helper.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-04-17 11:37:23 +0800
committerGitHub <noreply@github.com>2023-04-17 11:37:23 +0800
commit7681d582cdae42d9322309ddf732117e6d332776 (patch)
tree6cdfa61a2055f23153884404fe93d4b4792fd532 /modules/templates/helper.go
parentbe7cd73439c2210bfd889915f74d66686e99dab6 (diff)
downloadgitea-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 'modules/templates/helper.go')
-rw-r--r--modules/templates/helper.go7
1 files changed, 0 insertions, 7 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index f93419fe87..27d6000daf 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -132,7 +132,6 @@ func NewFuncMap() []template.FuncMap {
// -----------------------------------------------------------------
// time / number / format
"FileSize": base.FileSize,
- "LocaleNumber": LocaleNumber,
"CountFmt": base.FormatNumberSI,
"TimeSince": timeutil.TimeSince,
"TimeSinceUnix": timeutil.TimeSinceUnix,
@@ -782,12 +781,6 @@ func mirrorRemoteAddress(ctx context.Context, m *repo_model.Repository, remoteNa
return a
}
-// LocaleNumber renders a number with a Custom Element, browser will render it with a locale number
-func LocaleNumber(v interface{}) template.HTML {
- num, _ := util.ToInt64(v)
- return template.HTML(fmt.Sprintf(`<gitea-locale-number data-number="%d">%d</gitea-locale-number>`, num, num))
-}
-
// Eval the expression and return the result, see the comment of eval.Expr for details.
// To use this helper function in templates, pass each token as a separate parameter.
//