]> source.dussan.org Git - gitea.git/commit
Use index of the supported tags to choose user lang (#15452)
authorNaohisa Murakami <tiqwab.ch90@gmail.com>
Wed, 14 Apr 2021 18:52:01 +0000 (03:52 +0900)
committerGitHub <noreply@github.com>
Wed, 14 Apr 2021 18:52:01 +0000 (19:52 +0100)
commit1426601cf7dd6e2cefca218a84d38905dc1cb295
tree3adb7d635388cb8d10634b62870f80f5147591f3
parent078df7a39272fb4c20db2d72b39338f3d4920f1b
Use index of the supported tags to choose user lang (#15452)

Fix #14793.

The previous implementation used the first return value of matcher.Match, which is the chosen language tag but may contain extensions such as de-DE-u-rg-chzzzz.

As mentioned in the documentation of language package, matcher.Match also returns the index of the supported tags, so I think it is better to use it rather than manipulate the returned language tag.
modules/translation/translation.go
modules/web/middleware/locale.go