diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-04-03 17:46:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-03 17:46:48 +0800 |
commit | d242511e86c3a6d8a7013100845d2cdc8eb5252c (patch) | |
tree | 391b7fa946d32b44f06a274453e4b4d1a19fe8ee /modules/context/pagination.go | |
parent | 27c34dd011cceb8232d1c3307f87b53a147c75c3 (diff) | |
download | gitea-d242511e86c3a6d8a7013100845d2cdc8eb5252c.tar.gz gitea-d242511e86c3a6d8a7013100845d2cdc8eb5252c.zip |
Remove legacy unmaintained packages, refactor to support change default locale (#19308)
Remove two unmaintained vendor packages `i18n` and `paginater`. Changes:
* Rewrite `i18n` package with a more clear fallback mechanism. Fix an unstable `Tr` behavior, add more tests.
* Refactor the legacy `Paginater` to `Paginator`, test cases are kept unchanged.
Trivial enhancement (no breaking for end users):
* Use the first locale in LANGS setting option as the default, add a log to prevent from surprising users.
Diffstat (limited to 'modules/context/pagination.go')
-rw-r--r-- | modules/context/pagination.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/context/pagination.go b/modules/context/pagination.go index 107cbf6186..c0079c2950 100644 --- a/modules/context/pagination.go +++ b/modules/context/pagination.go @@ -10,19 +10,19 @@ import ( "net/url" "strings" - "github.com/unknwon/paginater" + "code.gitea.io/gitea/modules/paginator" ) -// Pagination provides a pagination via Paginater and additional configurations for the link params used in rendering +// Pagination provides a pagination via paginator.Paginator and additional configurations for the link params used in rendering type Pagination struct { - Paginater *paginater.Paginater + Paginater *paginator.Paginator urlParams []string } // NewPagination creates a new instance of the Pagination struct func NewPagination(total, page, issueNum, numPages int) *Pagination { p := &Pagination{} - p.Paginater = paginater.New(total, page, issueNum, numPages) + p.Paginater = paginator.New(total, page, issueNum, numPages) return p } @@ -53,5 +53,6 @@ func (p *Pagination) SetDefaultParams(ctx *Context) { p.AddParam(ctx, "sort", "SortType") p.AddParam(ctx, "q", "Keyword") p.AddParam(ctx, "tab", "TabName") + // do not add any more uncommon params here! p.AddParam(ctx, "t", "queryType") } |