Intl.js icon indicating copy to clipboard operation
Intl.js copied to clipboard

Support nominative case of month names

Open vectart opened this issue 10 years ago • 6 comments

Many languages on the Earth have cases and particularly nominative and genitive ones. That's why CLDR locale data contains stand-alone month translations but Intl.js one doesn't. In result, we have wrong formatted strings.

Locale MMMM { month: 'long' } MMMMd { month: 'long', day: 'numeric' }
FI native huhtikuu 5. huhtikuuta
FI polyfill huhtikuuta :boom: 5. huhtikuuta
RU native апрель 5 апреля
RU polyfill апреля :boom: 5 апреля

vectart avatar Jul 15 '15 14:07 vectart

Related to #124 and #117

vectart avatar Jul 15 '15 14:07 vectart

If we do it for month names then we probably ought to do it for weekdays too. It's probably best to only include this data where it differs from the standard format so as not to unnecessarily increase the JSON file sizes for most languages.

andyearnshaw avatar Jul 15 '15 15:07 andyearnshaw

I will be happy to take this, but we need to run some tests to see how much data are we talking about here. As for the 402 spec, I think we are covered by https://tc39.github.io/ecma402/#sec-formatdatetime 12.1.6.13.a.ix, specifically, this sentence:

ix. Else if f is "narrow", "short", or "long", then ... If p is "month", then the String value may also depend on whether dateTimeFormat has a [[day]] internal slot. If p is "timeZoneName", then the String value may also depend on the value of the [[inDST]] field of tm, ...

It doesn't say anything about quarters or weekdays. Do you think we should include that in the specification? /cc @srl295 @JCEmmons

caridy avatar Feb 11 '16 17:02 caridy

I am using [email protected] for client and server. Right now server-rendering (with Intl polyfill) differs from browser (build-in Intl).

screen shot 2016-03-04 at 17 41 15

@ericf I use something like this

<FormattedDate
    value={new Date(exper.start)}
    month="long"
    year="numeric"
/>

So I think for isomorphic JS applications it is very important to have correct cases for months and weeks. Regardless to file sizes.

May be you can build second npm module with all cases? And give it name, something like intl-huge.

nodkz avatar Mar 04 '16 11:03 nodkz

@nodkz checksum will always be a problem when rehydrating. in the past I remember some conversations with some react folks to allow holes in the checksum verification process for cases like this where the rehydration might attempt to change the value. I also remember something about the formatjs components opting out of the update for the first rehydration.

caridy avatar Feb 14 '18 20:02 caridy

Guys, any plans when it will be fixed?

urfijus avatar Feb 26 '18 22:02 urfijus