diff options
Diffstat (limited to 'src/client/Model/View/Payment')
-rw-r--r-- | src/client/Model/View/Payment/Add.elm | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client/Model/View/Payment/Add.elm b/src/client/Model/View/Payment/Add.elm index 4665180..5428c3d 100644 --- a/src/client/Model/View/Payment/Add.elm +++ b/src/client/Model/View/Payment/Add.elm @@ -9,6 +9,8 @@ import Result as Result exposing (Result(..)) import Utils.Validation exposing (..) +import Model.Translations exposing (..) + type alias AddPayment = { name : String , nameError : Maybe String @@ -24,13 +26,13 @@ initAddPayment = , costError = Nothing } -validateName : String -> Result String String -validateName name = +validateName : String -> Translations -> Result String String +validateName name translations = name - |> validateNonEmpty "The category is required." + |> validateNonEmpty (getMessage "CategoryRequired" translations) -validateCost : String -> Result String Int -validateCost cost = +validateCost : String -> Translations -> Result String Int +validateCost cost translations = cost - |> validateNonEmpty "The cost is required." - |> flip Result.andThen (validateNumber "The cost must be a number.") + |> validateNonEmpty (getMessage "CostRequired" translations) + |> flip Result.andThen (validateNumber (getMessage "CostMustBeNumber" translations)) |