blob: f647ce22d055309d928c0883e9a35749a86cb90e (
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
28
|
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.Translations
import Model.Json.Translation
getMessage :: Key -> Text
getMessage = getParamMessage []
getParamMessage :: [Text] -> Key -> Text
getParamMessage values key = replaceParts values (getNonFormattedMessage lang key)
getTranslations :: Translations
getTranslations = Translations (map getTranslation [minBound..])
getTranslation :: Key -> Translation
getTranslation key = Translation (T.pack . show $ key) (getParts $ getNonFormattedMessage lang key)
|