Included messages in scaffolded site

This commit is contained in:
Michael Snoyman 2011-09-22 09:50:12 +03:00
parent ecca686b73
commit 189b3d2bab
6 changed files with 15 additions and 3 deletions

View File

@ -120,6 +120,7 @@ scaffold = do
mkDir "Model" mkDir "Model"
mkDir "deploy" mkDir "deploy"
mkDir "Settings" mkDir "Settings"
mkDir "messages"
writeFile' ("deploy/Procfile") $(codegen "deploy/Procfile") writeFile' ("deploy/Procfile") $(codegen "deploy/Procfile")
@ -156,7 +157,8 @@ scaffold = do
writeFile' "lucius/homepage.lucius" $(codegen "lucius/homepage.lucius") writeFile' "lucius/homepage.lucius" $(codegen "lucius/homepage.lucius")
writeFile' "julius/homepage.julius" $(codegen "julius/homepage.julius") writeFile' "julius/homepage.julius" $(codegen "julius/homepage.julius")
unless isTiny $ writeFile' "config/models" $(codegen "config/models") unless isTiny $ writeFile' "config/models" $(codegen "config/models")
writeFile' "messages/en.msg" $(codegen "messages/en.msg")
S.writeFile (dir ++ "/config/favicon.ico") S.writeFile (dir ++ "/config/favicon.ico")
$(runIO (S.readFile "scaffold/config/favicon.ico.cg") >>= \bs -> do $(runIO (S.readFile "scaffold/config/favicon.ico.cg") >>= \bs -> do
pack <- [|S.pack|] pack <- [|S.pack|]

View File

@ -4,6 +4,7 @@
module Foundation module Foundation
( ~sitearg~ (..) ( ~sitearg~ (..)
, ~sitearg~Route (..) , ~sitearg~Route (..)
, ~sitearg~Message (..)
, resources~sitearg~ , resources~sitearg~
, Handler , Handler
, Widget , Widget
@ -51,6 +52,9 @@ data ~sitearg~ = ~sitearg~
, connPool :: Settings.ConnectionPool -- ^ Database connection pool. , connPool :: Settings.ConnectionPool -- ^ Database connection pool.
} }
-- Set up i18n messages. See the message folder.
mkMessage "~sitearg~" "messages" "en"
-- This is where we define all of the routes in our application. For a full -- This is where we define all of the routes in our application. For a full
-- explanation of the syntax, please see: -- explanation of the syntax, please see:
-- http://www.yesodweb.com/book/handler -- http://www.yesodweb.com/book/handler

View File

@ -1,2 +1,2 @@
<h1>Hello <h1>_{MsgHello}
<h2 ##{h2id}>You do not have Javascript enabled. <h2 ##{h2id}>You do not have Javascript enabled.

View File

@ -0,0 +1 @@
Hello: Hello

View File

@ -1,8 +1,9 @@
{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-} {-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings, MultiParamTypeClasses #-}
module Foundation module Foundation
( ~sitearg~ (..) ( ~sitearg~ (..)
, ~sitearg~Route (..) , ~sitearg~Route (..)
, ~sitearg~Message (..)
, resources~sitearg~ , resources~sitearg~
, Handler , Handler
, Widget , Widget
@ -35,6 +36,9 @@ data ~sitearg~ = ~sitearg~
, getStatic :: Static -- ^ Settings for static file serving. , getStatic :: Static -- ^ Settings for static file serving.
} }
-- Set up i18n messages. See the message folder.
mkMessage "~sitearg~" "messages" "en"
-- This is where we define all of the routes in our application. For a full -- This is where we define all of the routes in our application. For a full
-- explanation of the syntax, please see: -- explanation of the syntax, please see:
-- http://docs.yesodweb.com/book/web-routes-quasi/ -- http://docs.yesodweb.com/book/web-routes-quasi/

View File

@ -50,6 +50,7 @@ extra-source-files:
scaffold/config/routes.cg scaffold/config/routes.cg
scaffold/Settings.hs.cg scaffold/Settings.hs.cg
scaffold/Settings/StaticFiles.hs.cg scaffold/Settings/StaticFiles.hs.cg
scaffold/messages/en.msg.cg
flag ghc7 flag ghc7