diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-29 05:23:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-28 17:23:19 -0400 |
commit | bc4e06109dae33edc0a9a918f244563f05a1a353 (patch) | |
tree | 6fd2e68d8d3b874576fdd6a2c7a4a4681bef6c98 /modules/translation/translation.go | |
parent | bc784a705bc5a49ddb3ceffe1ef1205fd15f0c08 (diff) | |
download | gitea-bc4e06109dae33edc0a9a918f244563f05a1a353.tar.gz gitea-bc4e06109dae33edc0a9a918f244563f05a1a353.zip |
Make repo size style matches others (commits/branches/tags) (#24408)
The "unit" part shouldn't have bold style.
Diffstat (limited to 'modules/translation/translation.go')
-rw-r--r-- | modules/translation/translation.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/translation/translation.go b/modules/translation/translation.go index 56cf1df2d4..49dfa84d1b 100644 --- a/modules/translation/translation.go +++ b/modules/translation/translation.go @@ -13,6 +13,7 @@ import ( "code.gitea.io/gitea/modules/options" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/translation/i18n" + "code.gitea.io/gitea/modules/util" "golang.org/x/text/language" "golang.org/x/text/message" @@ -241,5 +242,12 @@ func (l *locale) TrN(cnt any, key1, keyN string, args ...any) string { func (l *locale) PrettyNumber(v any) string { // TODO: this mechanism is not good enough, the complete solution is to switch the translation system to ICU message format + if s, ok := v.(string); ok { + if num, err := util.ToInt64(s); err == nil { + v = num + } else if num, err := util.ToFloat64(s); err == nil { + v = num + } + } return l.msgPrinter.Sprintf("%v", number.Decimal(v)) } |