From d25b857d8317d729995d6aa25db7a83fe92a07ef Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Fri, 14 Aug 2015 09:23:12 +0200 Subject: Translating dates --- src/client/View/Date.elm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/client/View/Date.elm (limited to 'src/client/View/Date.elm') diff --git a/src/client/View/Date.elm b/src/client/View/Date.elm new file mode 100644 index 0000000..c96e99e --- /dev/null +++ b/src/client/View/Date.elm @@ -0,0 +1,32 @@ +module View.Date + ( renderDate + ) where + +import Date exposing (..) + +import Model.Translations exposing (..) + +renderDate : Date -> Translations -> String +renderDate date translations = + let params = + [ toString (Date.day date) + , (getMessage (getMonthKey (Date.month date)) translations) + , toString (Date.year date) + ] + in getVarMessage params "Date" translations + +getMonthKey : Month -> String +getMonthKey month = + case month of + Jan -> "January" + Feb -> "February" + Mar -> "March" + Apr -> "April" + May -> "May" + Jun -> "June" + Jul -> "July" + Aug -> "August" + Sep -> "September" + Oct -> "October" + Nov -> "November" + Dec -> "December" -- cgit v1.2.3