]> source.dussan.org Git - gitea.git/commit
Refactor locale number (#24134)
authorwxiaoguang <wxiaoguang@gmail.com>
Mon, 17 Apr 2023 03:37:23 +0000 (11:37 +0800)
committerGitHub <noreply@github.com>
Mon, 17 Apr 2023 03:37:23 +0000 (11:37 +0800)
commit7681d582cdae42d9322309ddf732117e6d332776
tree6cdfa61a2055f23153884404fe93d4b4792fd532
parentbe7cd73439c2210bfd889915f74d66686e99dab6
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>
19 files changed:
modules/charset/escape_test.go
modules/csv/csv_test.go
modules/templates/helper.go
modules/test/context_tests.go
modules/translation/mock.go [new file with mode: 0644]
modules/translation/translation.go
modules/translation/translation_test.go [new file with mode: 0644]
templates/devtest/gitea-ui.tmpl
templates/projects/list.tmpl
templates/repo/issue/milestones.tmpl
templates/repo/issue/openclose.tmpl
templates/repo/projects/list.tmpl
templates/repo/release/list.tmpl
templates/repo/release/new.tmpl
templates/repo/sub_menu.tmpl
templates/user/dashboard/issues.tmpl
templates/user/dashboard/milestones.tmpl
web_src/js/webcomponents/GiteaLocaleNumber.js [deleted file]
web_src/js/webcomponents/webcomponents.js