From a3bab4f2a0cc8a6a95753dc91d8e862f40c80dcc Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Mon, 10 Aug 2015 23:30:31 +0200 Subject: Embedding messages into the page --- src/server/Model/Json/Message.hs | 16 ++++++++++++++++ src/server/Model/Json/Translation.hs | 18 ++++++++++++++++++ src/server/Model/Json/Translations.hs | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 src/server/Model/Json/Message.hs create mode 100644 src/server/Model/Json/Translation.hs create mode 100644 src/server/Model/Json/Translations.hs (limited to 'src/server/Model/Json') diff --git a/src/server/Model/Json/Message.hs b/src/server/Model/Json/Message.hs new file mode 100644 index 0000000..354dd8f --- /dev/null +++ b/src/server/Model/Json/Message.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE DeriveGeneric #-} + +module Model.Json.Message + ( Message(..) + ) where + +import Data.Aeson +import Data.Text (Text) +import GHC.Generics + +data Message = Message + { message :: Text + } deriving (Show, Generic) + +instance FromJSON Message +instance ToJSON Message diff --git a/src/server/Model/Json/Translation.hs b/src/server/Model/Json/Translation.hs new file mode 100644 index 0000000..7291157 --- /dev/null +++ b/src/server/Model/Json/Translation.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE DeriveGeneric #-} + +module Model.Json.Translation + ( Translation(..) + ) where + +import GHC.Generics + +import Data.Aeson +import Data.Text + +data Translation = Translation + { key :: Text + , message :: Text + } deriving (Show, Generic) + +instance FromJSON Translation +instance ToJSON Translation diff --git a/src/server/Model/Json/Translations.hs b/src/server/Model/Json/Translations.hs new file mode 100644 index 0000000..21b188a --- /dev/null +++ b/src/server/Model/Json/Translations.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE DeriveGeneric #-} + +module Model.Json.Translations + ( Translations(..) + ) where + +import Data.Aeson +import GHC.Generics + +import Model.Json.Translation + +data Translations = Translations + { translations :: [Translation] + } deriving (Show, Generic) + +instance FromJSON Translations +instance ToJSON Translations -- cgit v1.2.3