Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

French localization 24h #53

Closed
FabienHenon opened this issue Aug 22, 2017 · 5 comments
Closed

French localization 24h #53

FabienHenon opened this issue Aug 22, 2017 · 5 comments
Labels

Comments

@FabienHenon
Copy link

FabienHenon commented Aug 22, 2017

Hi,

First, thank you for this great package!

I used the french (from France fr_fr) locale to display my date and times but there is a little error in the format: french times are displayed on 24 hours without AM/PM.

@rluiten
Copy link
Owner

rluiten commented Aug 26, 2017

What format string are you using and what is the expected result verse the actual result you receive ?

Here is an example on Ellie that might make it easier for you to provide an example.
https://ellie-app.com/47J5ZYs396Fa1/4

In my timezone the result is.

1 => Hour(24): 22 Hour(12): 10 Suffix: [PM] offset: +1000
2 => Hour(24): 01 Hour(12): 01 Suffix: [AM] offset: +1000

@rluiten
Copy link
Owner

rluiten commented Aug 26, 2017

I just reread your description and maybe you are saying the defaults for french you don't believe are accurate ?

The file Config_fr_fr.elm defines the standard formats.
This is the current values of the format strings.

format =
        { date = "%-d/%m/%Y" -- d/MM/yyyy
        , longDate = "%A, %-d %B %Y" -- dddd, d MMMM yyyy
        , time = "%-I:%M %p" -- h:mm tt
        , longTime = "%-I:%M:%S %p" -- h:mm:ss tt
        , dateTime = "%-d/%m/%Y %-I:%M %p" -- date + time
        , firstDayOfWeek = Date.Mon
        }

@FabienHenon
Copy link
Author

FabienHenon commented Aug 28, 2017

Sorry for my late answer.

Yes, the defaults are not correct. Here is my updated version (note that I couldn't access the Default module for the twelveHourPeriod variable):

frenchConfig : Config.Config
frenchConfig =
    { i18n =
        { dayShort = French.dayShort
        , dayName = French.dayName
        , monthShort = French.monthShort
        , monthName = French.monthName
        , dayOfMonthWithSuffix = French.dayOfMonthWithSuffix
        , twelveHourPeriod = (\a -> "")
        }
    , format =
        { date =
            "%-d/%m/%Y"
            -- d/MM/yyyy
        , longDate =
            "%A, %-d %B %Y"
            -- dddd, d MMMM yyyy
        , time =
            "%-H:%M"
            -- h:mm tt
        , longTime =
            "%-H:%M:%S"
            -- h:mm:ss tt
        , dateTime =
            "%-d/%m/%Y %-H:%M"
            -- date + time
        , firstDayOfWeek = Date.Mon
        }
    }

As you can see, I'm using %H for hours and not %I and I don't use %P any more because in France we only use 24h format ;)

By the way, what is the - (hyphen) used for between % and the format letter?

@rluiten
Copy link
Owner

rluiten commented Sep 10, 2017

The doc for the formatting codes is at https://github.com/rluiten/elm-date-extra/blob/master/DocFormat.md.

The link to DocFormat use to work on elm site but I dont think it works anymore elm, I will look at correcting that with this update.

The - prefix means the the number is output as 1 or 2 digits, no padding zeros to always make it 2 digits.

Just checked Moment.js french format and they use 2 digits for hours, so I'll modify that as well.

@rluiten
Copy link
Owner

rluiten commented Sep 11, 2017

The updated french config is published in 9.1.2.

@rluiten rluiten closed this as completed Sep 11, 2017
@rluiten rluiten added the bug label Sep 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants