blob: 12893b8e430a417090075969dc045001ac8245a9 (
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
, getVarMessage
, 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 = getVarMessage []
getVarMessage :: [Text] -> Key -> Text
getVarMessage 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)
|