Skip to content

Commit

Permalink
Merge pull request #42 from decafbad/master
Browse files Browse the repository at this point in the history
Start of Turkish support
  • Loading branch information
rluiten authored May 7, 2017
2 parents 7968301 + 107de2c commit 76c7f66
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/Date/Extra/Config/Config_tr_tr.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module Date.Extra.Config.Config_tr_tr exposing (..)

{-| This is the default Turkish config for formatting dates.
@docs config
Copyright (c) 2017 Mehmet Köse
-}

import Date
import Date.Extra.Config as Config
import Date.Extra.I18n.I_tr_tr as Turkish


{-| Config for en-us.
-}
config : Config.Config
config =
{ i18n =
{ dayShort = Turkish.dayShort
, dayName = Turkish.dayName
, monthShort = Turkish.monthShort
, monthName = Turkish.monthName
, dayOfMonthWithSuffix = Turkish.dayOfMonthWithSuffix
}
, format =
{ date =
"%d.%m.%Y"

, longDate =
"%d %B %Y %A"

, time =
"%H:%M"

, longTime =
"%H:%M:%S"

, dateTime =
"%d %B %Y %-H:%M:%S"

, 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 @@ -30,6 +30,7 @@ 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.Config_tr_tr as Config_tr_tr


{-| Built in configurations.
Expand All @@ -50,6 +51,7 @@ configs =
, ( "ja_jp", Config_ja_jp.config )
, ( "ru_ru", Config_ru_ru.config )
, ( "de_de", Config_de_de.config )
, ( "tr_tr", Config_tr_tr.config )
]


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

{-| English values for day and month names.
@docs dayShort
@docs dayName
@docs monthShort
@docs monthName
@docs dayOfMonthWithSuffix
Copyright (c) 2017 Mehmet Köse
-}

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

{-| Day short name.
-}
dayShort : Day -> String
dayShort day =
case day of
Mon ->
"Pzt"

Tue ->
"Sal"

Wed ->
"Çar"

Thu ->
"Per"

Fri ->
"Cum"

Sat ->
"Cmt"

Sun ->
"Paz"


{-| Day full name.
-}
dayName : Day -> String
dayName day =
case day of
Mon ->
"Pazartesi"

Tue ->
"Salı"

Wed ->
"Çarşamba"

Thu ->
"Perşembe"

Fri ->
"Cuma"

Sat ->
"Cumartesi"

Sun ->
"Pazar"


{-| Month short name.
-}
monthShort : Month -> String
monthShort month =
case month of
Jan ->
"Oca"

Feb ->
"Şub"

Mar ->
"Mar"

Apr ->
"Nis"

May ->
"May"

Jun ->
"Haz"

Jul ->
"Tem"

Aug ->
"Ağu"

Sep ->
"Eyl"

Oct ->
"Eki"

Nov ->
"Kas"

Dec ->
"Ara"


{-| Month full name.
-}
monthName : Month -> String
monthName month =
case month of
Jan ->
"Ocak"

Feb ->
"Şubat"

Mar ->
"Mart"

Apr ->
"Nisan"

May ->
"Mayıs"

Jun ->
"Haziran"

Jul ->
"Temmuz"

Aug ->
"Ağustos"

Sep ->
"Eylül"

Oct ->
"Ekim"

Nov ->
"Kasım"

Dec ->
"Aralık"


{-| Nothing to do here for Turkish
-}

dayOfMonthWithSuffix : Bool -> Int -> String
dayOfMonthWithSuffix pad day =
(toString day) ++ "."

0 comments on commit 76c7f66

Please sign in to comment.