Closed PanagiotisGeorgiadis closed 3 years ago
Hi @PanagiotisGeorgiadis, it looks very good. What about include some default locales?, something like:
module DatePicker.I18n.Es exposing (spanishI18n)
spanishI18n : I18n
spanishI18n =
{ monthToString = monthToString
, weekdayToString = weekdayToString
, todayButtonText = "Hoy"
}
monthToString : TextMode -> Month -> String
monthToString mode month =
let
monthString =
case month of
Jan ->
"Enero"
Feb ->
"Febrero"
...
Dec ->
"Diciembre"
in
case mode of
Condensed ->
String.left 3 monthString
Full ->
monthString
If there is no predefined locale the user still can define monthToString
, weekdayToString
, todayButtonText
. I'll be very glad to do the spanish module.
Hi @PanagiotisGeorgiadis Thank you very much for this! I can't wait to use it.
Hi @PanagiotisGeorgiadis, it looks very good. What about include some default locales?, something like:
module DatePicker.I18n.Es exposing (spanishI18n) spanishI18n : I18n spanishI18n = { monthToString = monthToString , weekdayToString = weekdayToString , todayButtonText = "Hoy" } monthToString : TextMode -> Month -> String monthToString mode month = let monthString = case month of Jan -> "Enero" Feb -> "Febrero" ... Dec -> "Diciembre" in case mode of Condensed -> String.left 3 monthString Full -> monthString
If there is no predefined locale the user still can define
monthToString
,weekdayToString
,todayButtonText
. I'll be very glad to do the spanish module.
Hello @mtellezj, I've given this some thought and I think that by adding presets to the DatePicker
package we'll be duplicating the i18n
functionality along with having to release new versions for new languages.
I believe that its better to delegate it to the consumer and let them decide on how they want to display them.
Also in some of the cases / languages it may make more sense for them to provide Months
/ Weekdays
in caps so they'll need to override the defaults.
I'll merge this PR and bump the version and update the examples repo so hopefully from tomorrow everyone will be able to use i18n
😄
Implements #9