about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorVincent Ambo <viam@humac.com>2012-03-06T20·08+0100
committerVincent Ambo <viam@humac.com>2012-03-06T20·08+0100
commit91d197945f13e0cb4a7d880f0b9776ff349e53d4 (patch)
treef31cef4d82281bc997e1e5108612febc085cd0aa /src
parent0418692f07e057e2aa847fb2f5f24e6021a6073e (diff)
parent8c90ebdb499be2a8bc171dad8236728399755f0c (diff)
* merged String -> Text changes
* comment field
Diffstat (limited to 'src')
-rw-r--r--src/Locales.hs41
-rw-r--r--src/Main.hs5
2 files changed, 30 insertions, 16 deletions
diff --git a/src/Locales.hs b/src/Locales.hs
index 20b4cb8476da..9b9002ab24c3 100644
--- a/src/Locales.hs
+++ b/src/Locales.hs
@@ -3,6 +3,8 @@
 module Locales where
 
 import           Data.Data (Data, Typeable)
+import           Data.Text (Text)
+import qualified Data.Text as T
 
 {- to add a language simply define its abbreviation and Show instance then
  - translate the appropriate strings and add CouchDB views in Server.hs -}
@@ -13,7 +15,7 @@ instance Show BlogLang where
     show EN = "en"
     show DE = "de"
 
-version = ("2.2b" :: String)
+version = "2.2b"
 
 allLang = [EN, DE]
 
@@ -21,18 +23,18 @@ if' :: Bool -> a -> a -> a
 if' True x _ = x
 if' False _ y = y
 
-blogTitle :: BlogLang -> String -> String
-blogTitle DE s = "Tazjins Blog" ++ s
-blogTitle EN s = "Tazjin's Blog" ++ s
+blogTitle :: BlogLang -> Text -> Text
+blogTitle DE s = T.concat ["Tazjins Blog", s]
+blogTitle EN s = T.concat ["Tazjin's Blog", s]
 
 -- index site headline
 topText DE = "Aktuelle Einträge"
 topText EN = "Latest entries"
 
-getMonth :: BlogLang -> Int -> Int -> String
-getMonth l y m = monthName l m ++ show y
+getMonth :: BlogLang -> Int -> Int -> Text
+getMonth l y m = T.append (monthName l m) $ T.pack $ show y
   where
-    monthName :: BlogLang -> Int -> String
+    monthName :: BlogLang -> Int -> Text
     monthName DE m = case m of 
                     1 -> "Januar "
                     2 -> "Februar "
@@ -60,49 +62,60 @@ getMonth l y m = monthName l m ++ show y
                     11 -> "November "
                     12 -> "December "
 
+entireMonth :: BlogLang -> Text
 entireMonth DE = "Ganzer Monat"
 entireMonth EN = "Entire month"
 
+backText :: BlogLang -> Text
 backText DE = "Früher"
 backText EN = "Earlier"
 
+nextText :: BlogLang -> Text
 nextText DE = "Später"
 nextText EN = "Later"
 
 -- contact information
+contactText :: BlogLang -> Text
 contactText DE = "Wer mich kontaktieren will: "
 contactText EN = "Get in touch with me: "
 
-orString DE = " oder "
-orString EN = " or "
+orText :: BlogLang -> Text
+orText DE = " oder "
+orText EN = " or "
 
 -- footer
+noticeText :: BlogLang -> Text
 noticeText EN = "site notice"
 noticeText DE = "Impressum"
 
 -- comments
+noComments :: BlogLang -> Text
 noComments DE = " Keine Kommentare"
 noComments EN = " No comments yet"
 
+cHead :: BlogLang -> Text
 cHead DE = "Kommentare:"
 cHead EN = "Comments:"
 
+cwHead :: BlogLang -> Text
 cwHead DE = "Kommentieren:"
 cwHead EN = "Comment:"
 
 cSingle DE = "Kommentar:" --input label
 cSingle EN = "Comment:" 
 
+cTimeFormat :: BlogLang -> String --formatTime expects a String
 cTimeFormat DE = "[Am %d.%m.%y um %H:%M Uhr]"
 cTimeFormat EN = "[On %D at %H:%M]"
 
 -- right side text (this is inserted AS IS. Escape HTML!)
+rightText :: BlogLang -> Text
 rightText DE = "English version <a href=\"en\">available here</a>"
 rightText EN = "Deutsche Version <a href=\"de\">hier verf&uuml;gbar</a>"
 
 -- static information
-repoURL = "https://bitbucket.org/tazjin/tazblog-haskell"
-mailTo  = "mailto:hej@tazj.in"
-twitter = "http://twitter.com/#!/tazjin"
-iMessage = "imessage:tazjin@me.com"
-iMessage' = "sms:tazjin@me.com"
+repoURL   :: Text = "https://bitbucket.org/tazjin/tazblog-haskell"
+mailTo    :: Text = "mailto:hej@tazj.in"
+twitter   :: Text = "http://twitter.com/#!/tazjin"
+iMessage  :: Text = "imessage:tazjin@me.com"
+iMessage' :: Text = "sms:tazjin@me.com"
diff --git a/src/Main.hs b/src/Main.hs
index f3d3db32d048..5bc2ef2ce46d 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -6,7 +6,8 @@ import           Control.Applicative (optional)
 import           Control.Monad (msum)
 import           Data.Monoid (mempty)
 import           Data.ByteString.Char8 (ByteString)
-import           Data.Text hiding (map, length, zip, head, drop)
+import           Data.Text (Text)
+import qualified Data.Text as T
 import           Data.Time
 import           Database.CouchDB
 import           Happstack.Server
@@ -63,7 +64,7 @@ tryEntry :: Maybe Entry -> Response
 tryEntry Nothing = toResponse $ showError NotFound
 tryEntry (Just entry) = toResponse $ blogTemplate eLang eTitle $ renderEntry entry
     where
-        eTitle = ": " ++ title entry
+        eTitle = T.pack $ ": " ++ title entry
         eLang = lang entry
 
 showIndex :: BlogLang -> ServerPart Response