Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort locales according to their names #18211

Merged
merged 2 commits into from
Jan 8, 2022
Merged

Conversation

delvh
Copy link
Member

@delvh delvh commented Jan 8, 2022

Previously, it was pretty random where which language can be found in the user settings.
This PR fixes this by sorting locales once when initializing Gitea based on their names.
I thought that this change was too small and easy to open an issue for hence I implemented it quickly.

It is a breaking change if any implementation previously needed locales to be at specific indices, which I hope it didn't, especially as it is now clearer than before where which locale will be. According to a quick search, there should be nothing that needs a specific index.

(Note: I manually disabled the max-width in the following screenshots to show the old vs. new comparison, that's not how Gitea behaves normally.)

Now, it is also visible that for some reason many locales have lowercase names while others have uppercase names.
Should we unify them to all be uppercased or lowercased (where possible)?

Previous appearance

(tested on a private Gitea 1.15.9 instance)
image

New appearance

image

@delvh delvh added topic/ui Change the appearance of the Gitea UI topic/ui-interaction Change the process how users use Gitea instead of the visual appearance kind/usability and removed topic/ui Change the appearance of the Gitea UI labels Jan 8, 2022
@zeripath
Copy link
Contributor

zeripath commented Jan 8, 2022

I think you might want non-case dependent sorting.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 8, 2022
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 8, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #18211 (905fdb7) into main (832f987) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #18211      +/-   ##
==========================================
+ Coverage   45.63%   45.64%   +0.01%     
==========================================
  Files         830      830              
  Lines       92017    92020       +3     
==========================================
+ Hits        41991    42003      +12     
+ Misses      43286    43281       -5     
+ Partials     6740     6736       -4     
Impacted Files Coverage Δ
modules/translation/translation.go 58.53% <100.00%> (+1.57%) ⬆️
modules/queue/workerpool.go 49.23% <0.00%> (-3.06%) ⬇️
models/repo/repo.go 67.34% <0.00%> (-0.59%) ⬇️
models/issue_comment.go 55.08% <0.00%> (+0.28%) ⬆️
routers/web/repo/view.go 39.96% <0.00%> (+0.45%) ⬆️
routers/api/v1/repo/pull.go 28.85% <0.00%> (+0.50%) ⬆️
modules/queue/queue_bytefifo.go 59.88% <0.00%> (+0.59%) ⬆️
modules/log/event.go 62.50% <0.00%> (+1.85%) ⬆️
models/unit/unit.go 52.68% <0.00%> (+2.15%) ⬆️
modules/charset/charset.go 75.75% <0.00%> (+4.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 832f987...905fdb7. Read the comment docs.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 8, 2022
@zeripath zeripath added this to the 1.16.0 milestone Jan 8, 2022
@zeripath zeripath merged commit 4f77645 into go-gitea:main Jan 8, 2022
@delvh delvh deleted the sort-languages branch January 8, 2022 12:21
@zeripath
Copy link
Contributor

zeripath commented Jan 8, 2022

The problem is that in most romance languages the language does not have an upper case letter.

However I think it's valid in almost all languages that the first letter of a list should be capitalised if any of the others are capitalised so I think we can validly force ToTitle when rendering the languages as a list like this.

@lunny
Copy link
Member

lunny commented Jan 8, 2022

Put the detected language as first or second one is better.

zjjhot pushed a commit to zjjhot/gitea that referenced this pull request Jan 8, 2022
* 'main' of https://github.com/go-gitea/gitea:
  Fix EasyMDE image paste bug during refactoring (go-gitea#18207)
  Sort locales according to their names (go-gitea#18211)
  Restore setting of ctx.Repo.Mirror (go-gitea#18205)
  [skip ci] Updated translations via Crowdin
  Show OAuth callback error message (go-gitea#18185)
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
* Sort locales according to their names

* Fix documentation and sort case insensitive
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui-interaction Change the process how users use Gitea instead of the visual appearance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants