From 0599db5e42773452eeca69576ce9148d46ddf9dc Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 29 Aug 2015 16:10:05 +0200 Subject: MoneySymbol is translated too --- src/client/View/Payments.elm | 2 +- src/client/View/Payments/Add.elm | 2 +- src/client/View/Payments/ExceedingPayer.elm | 14 +++++++----- src/client/View/Payments/Table.elm | 5 +++-- src/server/Design/Global.hs | 2 ++ src/server/Model/Message/Key.hs | 1 + src/server/Model/Message/Translations.hs | 35 ++++++++++++++++------------- 7 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/client/View/Payments.elm b/src/client/View/Payments.elm index 03886f8..c38cc18 100644 --- a/src/client/View/Payments.elm +++ b/src/client/View/Payments.elm @@ -17,7 +17,7 @@ renderPayments : Model -> PaymentView -> Html renderPayments model paymentView = div [ class "payments" ] - [ exceedingPayers paymentView + [ exceedingPayers model paymentView , addPayment model paymentView.add , paymentsTable model paymentView ] diff --git a/src/client/View/Payments/Add.elm b/src/client/View/Payments/Add.elm index ce4738b..c022d01 100644 --- a/src/client/View/Payments/Add.elm +++ b/src/client/View/Payments/Add.elm @@ -61,7 +61,7 @@ addPayment model addPayment = [] , label [ for "costInput" ] - [ renderIcon "euro" ] + [ text (getMessage "MoneySymbol" model.translations) ] , case addPayment.costError of Just error -> div [ class "errorMessage" ] [ text error ] diff --git a/src/client/View/Payments/ExceedingPayer.elm b/src/client/View/Payments/ExceedingPayer.elm index cea8d66..903ad5b 100644 --- a/src/client/View/Payments/ExceedingPayer.elm +++ b/src/client/View/Payments/ExceedingPayer.elm @@ -6,19 +6,21 @@ import Html exposing (..) import Html.Attributes exposing (..) import List +import Model exposing (Model) import Model.Payers exposing (..) import Model.View.PaymentView exposing (PaymentView) +import Model.Translations exposing (getMessage) -exceedingPayers : PaymentView -> Html -exceedingPayers paymentView = +exceedingPayers : Model -> PaymentView -> Html +exceedingPayers model paymentView = div [ class "exceedingPayers" ] - (List.map exceedingPayer (getOrderedExceedingPayers paymentView.payers)) + (List.map (exceedingPayer model) (getOrderedExceedingPayers paymentView.payers)) -exceedingPayer : ExceedingPayer -> Html -exceedingPayer payer = +exceedingPayer : Model -> ExceedingPayer -> Html +exceedingPayer model payer = div [ class "exceedingPayer" ] [ span [ class "userName" ] [ text payer.userName ] - , span [ class "amount" ] [ text ("+ " ++ (toString payer.amount)) ] + , span [ class "amount" ] [ text ("+ " ++ (toString payer.amount) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ] ] diff --git a/src/client/View/Payments/Table.elm b/src/client/View/Payments/Table.elm index 50dd151..a180315 100644 --- a/src/client/View/Payments/Table.elm +++ b/src/client/View/Payments/Table.elm @@ -15,6 +15,7 @@ import String exposing (append) import Model exposing (Model) import Model.Payment exposing (..) import Model.View.PaymentView exposing (PaymentView) +import Model.Translations exposing (getMessage) import ServerCommunication as SC exposing (serverCommunications) @@ -31,7 +32,7 @@ paymentsTable model paymentView = ([ div [ class "header" ] [ div [ class "cell category" ] [ renderIcon "shopping-cart" ] - , div [ class "cell cost" ] [ renderIcon "euro" ] + , div [ class "cell cost" ] [ text (getMessage "MoneySymbol" model.translations) ] , div [ class "cell user" ] [ renderIcon "user" ] , div [ class "cell date" ] [ renderIcon "calendar" ] , div [ class "cell" ] [] @@ -53,7 +54,7 @@ paymentLine model paymentView (id, payment) = , onClick actions.address (UpdatePayment (ToggleEdit id)) ] [ div [ class "cell" ] [ text payment.name ] - , div [ class "cell" ] [ text ((toString payment.cost) ++ " €") ] + , div [ class "cell" ] [ text ((toString payment.cost) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ] , div [ class "cell" ] [ text payment.userName ] , div [ class "cell" ] [ text (renderDate payment.creation model.translations) ] , if paymentView.userName == payment.userName diff --git a/src/server/Design/Global.hs b/src/server/Design/Global.hs index 7b5138f..f884db9 100644 --- a/src/server/Design/Global.hs +++ b/src/server/Design/Global.hs @@ -71,6 +71,7 @@ global = do position relative width (pct 49) label ? do + fontWeight bold display inlineBlock width (px 60) textAlign (alignSide sideCenter) @@ -120,6 +121,7 @@ global = do ".header" <> ".row" ? display tableRow ".header" ? do + fontWeight bold backgroundColor C.red color C.white fontSize (px iconFontSize) diff --git a/src/server/Model/Message/Key.hs b/src/server/Model/Message/Key.hs index b5ea45b..d4d31f3 100644 --- a/src/server/Model/Message/Key.hs +++ b/src/server/Model/Message/Key.hs @@ -50,5 +50,6 @@ data Key = | Add | PaymentNotDeleted + | MoneySymbol deriving (Enum, Bounded, Show) diff --git a/src/server/Model/Message/Translations.hs b/src/server/Model/Message/Translations.hs index c0f9d3c..93d264f 100644 --- a/src/server/Model/Message/Translations.hs +++ b/src/server/Model/Message/Translations.hs @@ -104,79 +104,79 @@ m l January = m l February = case l of English -> "February" - French -> "Février" + French -> "Février" m l March = case l of English -> "March" - French -> "Mars" + French -> "Mars" m l April = case l of English -> "April" - French -> "Avril" + French -> "Avril" m l May = case l of English -> "May" - French -> "Mai" + French -> "Mai" m l June = case l of English -> "June" - French -> "Juin" + French -> "Juin" m l July = case l of English -> "July" - French -> "Juillet" + French -> "Juillet" m l August = case l of English -> "August" - French -> "Août" + French -> "Août" m l September = case l of English -> "September" - French -> "Septembre" + French -> "Septembre" m l October = case l of English -> "October" - French -> "Octoble" + French -> "Octoble" m l November = case l of English -> "November" - French -> "Novembre" + French -> "Novembre" m l December = case l of English -> "December" - French -> "Décembre" + French -> "Décembre" m l Date = case l of English -> "{2} {1}, {3}" - French -> "{1} {2} {3}" + French -> "{1} {2} {3}" -- Validation m l CategoryRequired = case l of English -> "Type a category." - French -> "Entre une catégorie." + French -> "Entre une catégorie." m l CostRequired = case l of English -> "Type a cost." - French -> "Entre un coût." + French -> "Entre un coût." m l CostMustBeNumber = case l of English -> "The cost must be a positive natural number." - French -> "Le coût doit être un entier positif." + French -> "Le coût doit être un entier positif." -- Payments @@ -189,3 +189,8 @@ m l PaymentNotDeleted = case l of English -> "The payment could not have been deleted." French -> "Le paiement n'a pas pu être supprimé." + +m l MoneySymbol = + case l of + English -> "$" + French -> "€" -- cgit v1.2.3