Merge pull request #1721 from yesodweb/pb/reorder-languages

Stop moving session language ahead of reqLangs
This commit is contained in:
Michael Snoyman 2021-04-09 06:04:58 +03:00 committed by GitHub
commit 21bfad3570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View File

@ -1,5 +1,9 @@
# ChangeLog for yesod-core
## 1.6.19.0
* Change order of priority in `languages`[#1721](https://github.com/yesodweb/yesod/pull/1721)
## 1.6.18.8
* Fix test suite for wai-extra change around vary header

View File

@ -1226,10 +1226,10 @@ cacheBySet key value = do
-- Languages are determined based on the following (in descending order
-- of preference):
--
-- * The _LANG user session variable.
--
-- * The _LANG get parameter.
--
-- * The _LANG user session variable.
--
-- * The _LANG cookie.
--
-- * Accept-Language HTTP header.
@ -1238,11 +1238,12 @@ cacheBySet key value = do
-- If a matching language is not found the default language will be used.
--
-- This is handled by parseWaiRequest (not exposed).
--
-- __NOTE__: Before version @1.6.19.0@, this function prioritized the session
-- variable above all other sources.
--
languages :: MonadHandler m => m [Text]
languages = do
mlang <- lookupSession langKey
langs <- reqLangs <$> getRequest
return $ maybe id (:) mlang langs
languages = reqLangs <$> getRequest
lookup' :: Eq a => a -> [(a, b)] -> [b]
lookup' a = map snd . filter (\x -> a == fst x)

View File

@ -1,5 +1,5 @@
name: yesod-core
version: 1.6.18.8
version: 1.6.19.0
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>