Skip to content

Commit

Permalink
Merge branch 'frankschmitt-german-translation-1' into ru_locale
Browse files Browse the repository at this point in the history
  • Loading branch information
tvv committed Mar 31, 2017
2 parents 0c31e6f + 6cb4f7b commit 17b296d
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 1 deletion.
44 changes: 44 additions & 0 deletions src/Date/Extra/Config/Config_de_de.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module Date.Extra.Config.Config_de_de exposing (..)

{-| This is the default German config for formatting dates.
@docs config
Copyright (c) 2017 Frank Schmitt
-}

import Date
import Date.Extra.Config as Config
import Date.Extra.I18n.I_de_de as German


{-| Config for en-us.
-}
config : Config.Config
config =
{ i18n =
{ dayShort = German.dayShort
, dayName = German.dayName
, monthShort = German.monthShort
, monthName = German.monthName
, dayOfMonthWithSuffix = German.dayOfMonthWithSuffix
}
, format =
{ date =
"%-d. %B %Y"
-- d. M YYYY. a
, longDate =
"%A, %-d. %B %Y"
-- dddd, dd. MMMM yyyy
, time =
"%-H:%M"
-- h:mm
, longTime =
"%-H:%M:%S"
-- h:mm:ss
, dateTime =
"%a, %-d. %b %Y. %-H:%M:%S"
-- date + time
, firstDayOfWeek = Date.Mon
}
}
2 changes: 2 additions & 0 deletions src/Date/Extra/Config/Configs.elm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Date.Extra.Config.Config_pt_br as Config_pt_br
import Date.Extra.Config.Config_et_ee as Config_et_ee
import Date.Extra.Config.Config_ja_jp as Config_ja_jp
import Date.Extra.Config.Config_ru_ru as Config_ru_ru
import Date.Extra.Config.Config_de_de as Config_de_de


{-| Built in configurations. -}
Expand All @@ -46,6 +47,7 @@ configs =
, ("et_ee", Config_et_ee.config)
, ("ja_jp", Config_ja_jp.config)
, ("ru_ru", Config_ru_ru.config)
, ("de_de", Config_de_de.config)
]


Expand Down
84 changes: 84 additions & 0 deletions src/Date/Extra/I18n/I_de_de.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
module Date.Extra.I18n.I_de_de exposing (..)

{-| German values for day and month names.
@docs dayShort
@docs dayName
@docs monthShort
@docs monthName
@docs dayOfMonthWithSuffix
Copyright (c) 2017 Frank Schmitt
-}


import Date exposing (Day (..), Month (..))
import String exposing (padLeft)


{-| Day short name. -}
dayShort : Day -> String
dayShort day =
case day of
Mon -> "Mo"
Tue -> "Di"
Wed -> "Mi"
Thu -> "Do"
Fri -> "Fr"
Sat -> "Sa"
Sun -> "So"


{-| Day full name. -}
dayName : Day -> String
dayName day =
case day of
Mon -> "Montag"
Tue -> "Dienstag"
Wed -> "Mittwoch"
Thu -> "Donnerstag"
Fri -> "Freitag"
Sat -> "Samstag"
Sun -> "Sonntag"


{-| Month short name. -}
monthShort : Month -> String
monthShort month =
case month of
Jan -> "Jan"
Feb -> "Feb"
Mar -> "Mär"
Apr -> "Apr"
May -> "Mai"
Jun -> "Jun"
Jul -> "Jul"
Aug -> "Aug"
Sep -> "Sep"
Oct -> "Okt"
Nov -> "Nov"
Dec -> "Dez"


{-| Month full name. -}
monthName : Month -> String
monthName month =
case month of
Jan -> "Januar"
Feb -> "Februar"
Mar -> "März"
Apr -> "April"
May -> "Mai"
Jun -> "Juni"
Jul -> "Juli"
Aug -> "August"
Sep -> "September"
Oct -> "Oktober"
Nov -> "November"
Dec -> "Dezember"


{-| Nothing to do here for German -}
dayOfMonthWithSuffix : Bool -> Int -> String
dayOfMonthWithSuffix pad day =
(toString day) ++ "."
9 changes: 8 additions & 1 deletion tests/Date/Extra/ConfigTests.elm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Expect

import Date.Extra.Config.Config_en_au as Config_en_au
import Date.Extra.Config.Config_en_us as Config_en_us
import Date.Extra.Config.Config_fr_fr as Config_en_gb
import Date.Extra.Config.Config_en_gb as Config_en_gb
import Date.Extra.Config.Config_fr_fr as Config_fr_fr
import Date.Extra.Config.Config_fi_fi as Config_fi_fi
import Date.Extra.Config.Config_pl_pl as Config_pl_pl
Expand All @@ -16,6 +16,7 @@ import Date.Extra.Config.Config_pt_br as Config_pt_br
import Date.Extra.Config.Config_et_ee as Config_et_ee
import Date.Extra.Config.Config_ja_jp as Config_ja_jp
import Date.Extra.Config.Config_ru_ru as Config_ru_ru
import Date.Extra.Config.Config_de_de as Config_de_de
import Date.Extra.Config.Configs as Configs


Expand All @@ -31,6 +32,7 @@ config_pt_br = Config_pt_br.config
config_et_ee = Config_et_ee.config
config_ja_jp = Config_ja_jp.config
config_ru_ru = Config_ru_ru.config
config_de_de = Config_de_de.config


tests : Test
Expand Down Expand Up @@ -106,4 +108,9 @@ tests =
Expect.equal
config_ru_ru.format
(Configs.getConfig "ru_ru").format
, test "getConfig de_de" <|
\() ->
Expect.equal
config_de_de.format
(Configs.getConfig "de_de").format
]
4 changes: 4 additions & 0 deletions tests/Date/Extra/FormatTests.elm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Date.Extra.Config.Config_pt_br as Config_pt_br
import Date.Extra.Config.Config_et_ee as Config_et_ee
import Date.Extra.Config.Config_ja_jp as Config_ja_jp
import Date.Extra.Config.Config_ru_ru as Config_ru_ru
import Date.Extra.Config.Config_de_de as Config_de_de
import Date.Extra.Period as DPeriod exposing (Period (Hour))


Expand All @@ -40,6 +41,7 @@ config_pt_br = Config_pt_br.config
config_et_ee = Config_et_ee.config
config_ja_jp = Config_ja_jp.config
config_ru_ru = Config_ru_ru.config
config_de_de = Config_de_de.config


tests : Test
Expand Down Expand Up @@ -190,6 +192,8 @@ formatConfigTestCases =
, ("Config_ru_ru day idiom", "05/08/2014", config_ru_ru, config_ru_ru.format.date, aTestTime5)
, ("Config_ru_ru format idiom", "Вторник (5) 05 Август 2014", config_ru_ru, dayDayIdiomMonth, aTestTime5)
, ("Config_ru_ru time idiom", "05:53", config_ru_ru, config_ru_ru.format.time, aTestTime5)
, ("Config_de_de date idiom", "5. August 2014", config_de_de, config_de_de.format.date, aTestTime5)
, ("Config_de_de longDate idiom", "Dienstag, 5. August 2014", config_de_de, config_de_de.format.longDate, aTestTime5)
]


Expand Down

0 comments on commit 17b296d

Please sign in to comment.