diff --git a/yesod-core/ChangeLog.md b/yesod-core/ChangeLog.md index 80eac463..70041a9f 100644 --- a/yesod-core/ChangeLog.md +++ b/yesod-core/ChangeLog.md @@ -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 diff --git a/yesod-core/src/Yesod/Core/Handler.hs b/yesod-core/src/Yesod/Core/Handler.hs index 063ad1f9..d6ad08da 100644 --- a/yesod-core/src/Yesod/Core/Handler.hs +++ b/yesod-core/src/Yesod/Core/Handler.hs @@ -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) diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 685b95e5..41a228b4 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -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