aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model/Message.hs
blob: a65e01c4259cc1c4a617b7964137a70ec658bf46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module Model.Message
  ( getMessage
  , getParamMessage
  , getTranslations
  ) where

import Data.Text (Text)
import qualified Data.Text as T

import Model.Message.Key (Key)
import Model.Message.Lang
import Model.Message.Translations (getNonFormattedMessage)
import Model.Message.Parts

import Model.Json.Translation

getMessage :: Key -> Text
getMessage = getParamMessage []

getParamMessage :: [Text] -> Key -> Text
getParamMessage values key = replaceParts values (getNonFormattedMessage lang key)

getTranslations :: [Translation]
getTranslations = (map getTranslation [minBound..])

getTranslation :: Key -> Translation
getTranslation key = Translation (T.pack . show $ key) (getParts $ getNonFormattedMessage lang key)