Merge pull request #1721 from yesodweb/pb/reorder-languages
Stop moving session language ahead of reqLangs
This commit is contained in:
commit
21bfad3570
@ -1,5 +1,9 @@
|
|||||||
# ChangeLog for yesod-core
|
# 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
|
## 1.6.18.8
|
||||||
|
|
||||||
* Fix test suite for wai-extra change around vary header
|
* Fix test suite for wai-extra change around vary header
|
||||||
|
|||||||
@ -1226,10 +1226,10 @@ cacheBySet key value = do
|
|||||||
-- Languages are determined based on the following (in descending order
|
-- Languages are determined based on the following (in descending order
|
||||||
-- of preference):
|
-- of preference):
|
||||||
--
|
--
|
||||||
-- * The _LANG user session variable.
|
|
||||||
--
|
|
||||||
-- * The _LANG get parameter.
|
-- * The _LANG get parameter.
|
||||||
--
|
--
|
||||||
|
-- * The _LANG user session variable.
|
||||||
|
--
|
||||||
-- * The _LANG cookie.
|
-- * The _LANG cookie.
|
||||||
--
|
--
|
||||||
-- * Accept-Language HTTP header.
|
-- * 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.
|
-- If a matching language is not found the default language will be used.
|
||||||
--
|
--
|
||||||
-- This is handled by parseWaiRequest (not exposed).
|
-- 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 :: MonadHandler m => m [Text]
|
||||||
languages = do
|
languages = reqLangs <$> getRequest
|
||||||
mlang <- lookupSession langKey
|
|
||||||
langs <- reqLangs <$> getRequest
|
|
||||||
return $ maybe id (:) mlang langs
|
|
||||||
|
|
||||||
lookup' :: Eq a => a -> [(a, b)] -> [b]
|
lookup' :: Eq a => a -> [(a, b)] -> [b]
|
||||||
lookup' a = map snd . filter (\x -> a == fst x)
|
lookup' a = map snd . filter (\x -> a == fst x)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-core
|
name: yesod-core
|
||||||
version: 1.6.18.8
|
version: 1.6.19.0
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user