shakespeare-i18n 0.0.2.1 → 1.0.0
raw patch · 2 files changed
+16/−7 lines, 2 filesdep ~shakespearePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: shakespeare
API changes (from Hackage documentation)
+ Text.Shakespeare.I18N: instance RenderMessage master (SomeMessage master)
Files
- Text/Shakespeare/I18N.hs +10/−3
- shakespeare-i18n.cabal +6/−4
Text/Shakespeare/I18N.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- |@@ -149,7 +150,10 @@ -> Q [Dec] mkMessageCommon genType prefix postfix master dt folder lang = do files <- qRunIO $ getDirectoryContents folder- contents <- qRunIO $ fmap catMaybes $ mapM (loadLang folder) files+ (_files', contents) <- qRunIO $ fmap (unzip . catMaybes) $ mapM (loadLang folder) files+#ifdef GHC_7_4+ mapM_ qAddDependentFile _files'+#endif sdef <- case lookup lang contents of Nothing -> error $ "Did not find main language file: " ++ unpack lang@@ -299,7 +303,7 @@ , content :: [Content] } -loadLang :: FilePath -> FilePath -> IO (Maybe (Lang, [Def]))+loadLang :: FilePath -> FilePath -> IO (Maybe (FilePath, (Lang, [Def]))) loadLang folder file = do let file' = folder ++ '/' : file e <- doesFileExist file'@@ -309,7 +313,7 @@ bs <- S.readFile file' let s = unpack $ decodeUtf8 bs defs <- fmap catMaybes $ mapM parseDef $ lines s- return $ Just (lang, defs)+ return $ Just (file', (lang, defs)) else return Nothing parseDef :: String -> IO (Maybe Def)@@ -357,3 +361,6 @@ instance IsString (SomeMessage master) where fromString = SomeMessage . T.pack++instance RenderMessage master (SomeMessage master) where+ renderMessage a b (SomeMessage msg) = renderMessage a b msg
shakespeare-i18n.cabal view
@@ -1,5 +1,5 @@ name: shakespeare-i18n-version: 0.0.2.1+version: 1.0.0 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -8,17 +8,17 @@ description: This package uses a compile-time, type-safe approach to create translated content. It has a simple syntax for translators, while allowing the full power of Haskell for applying complex grammar rules. .- This package was spun off from yesod-core, and therefore the Yesod documentation is a good place to start in understanding this package. Please see <http://www.yesodweb.com/book/i18n> for more information.+ This package was spun off from yesod-core, and therefore the Yesod documentation is a good place to start in understanding this package. Please see <http://www.yesodweb.com/book/shakespearean-templates> for more information. category: Web, Yesod stability: Stable cabal-version: >= 1.8 build-type: Simple-homepage: http://www.yesodweb.com/book/i18n+homepage: http://www.yesodweb.com/book/shakespearean-templates library build-depends: base >= 4 && < 5- , shakespeare >= 0.10 && < 0.12+ , shakespeare >= 1.0 && < 1.1 , template-haskell , text >= 0.7 && < 0.12 , parsec@@ -27,6 +27,8 @@ exposed-modules: Text.Shakespeare.I18N ghc-options: -Wall+ if impl(ghc >= 7.4)+ cpp-options: -DGHC_7_4 source-repository head type: git