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

Issue with Canadian French ordinal #3375

Closed
smilehyun opened this issue Aug 16, 2016 · 8 comments · May be fixed by #6110
Closed

Issue with Canadian French ordinal #3375

smilehyun opened this issue Aug 16, 2016 · 8 comments · May be fixed by #6110
Labels

Comments

@smilehyun
Copy link

smilehyun commented Aug 16, 2016

Hi,
i know only small portion of people would use French Canadian, such as Quebec, but found a bug in ordinal.

in fr.js

ordinal : function (number) {
     return number + (number === 1 ? 'er' : '');
}

but in fr-ca.js,

ordinal : function (number) {
      return number + (number === 1 ? 'er' : 'e');
}

Ordinal should be same as French, which is 'er' only after number 1.

Thanks

@sly7-7
Copy link

sly7-7 commented Nov 16, 2016

taken from http://www.academie-francaise.fr/abreviations-des-adjectifs-numeraux it seems like the issue is the e is missing in the fr locale.

also see #2414, where the decision to make fr-ca and fr different

@fbonzon
Copy link
Contributor

fbonzon commented Feb 19, 2017

I noticed this issue too, and would like to prepare a PR to fix it.

In this thread and all previous about the same subject (like #2414 mentioned by @sly7-7), there is a confusion about what are the rules to write an ordinal in French in general without any context, and when to write an ordinal in the specific context of the day of the month.

In moment library, the ordinal element of a locale is not specific to the day of the month. It is used in many tokens:
Month Mo 1st 2nd ... 11th 12th
Quarter Qo 1st 2nd 3rd 4th
Day of Month Do 1st 2nd ... 30th 31st
Day of Year DDDo 1st 2nd ... 364th 365th
Day of Week do 0th 1st ... 5th 6th
Week of Year wo 1st 2nd ... 52nd 53rd
Week of Year (ISO) Wo 1st 2nd ... 52nd 53rd

When speaking or writing dates in English, both cardinal figures (July 4, format D) and ordinal figures (July 4th, format Do) are possible for every day of the month, depending on context, intended style, or English country sub-locale. A given date format will use D or Do for every day of the month.

When speaking or writing dates in French, there is no choice, the rule is always the same: use ordinal for day 1 (suffix "er", format Do), and cardinal (format D) for other days. Day 1 is really always pronounced as an ordinal (1er = premier), but other days as cardinals (2 = deux, 3 = trois, etc.)

There is currently a hack in the 'fr' locale, where ordinal is defined with 'er' suffix for number 1, and with no suffix for other numbers. This makes using Do in date formats produce the expected results, but breaks all the others formats using an ordinal (see above: Mo, Qo, DDDo, do, wo, Wo).

This should be fixed. Use "e" suffix for numbers 2 and above, like mentioned in the link to Académie Française (authority for French rules) by @sly7-7 in the previous message.

Now, we need a way to express that long date formats in French need ordinal for day 1 and cardinal for other days. There is currently no mechanism to achieve this without adding some JavaScript code.

I see 2 solutions:

  1. Like is already done for relativeTime element (and few others), e.g. in Finnish, allow to pass a function to the elements of longDateFormat, with an additional parameter for day number. We would then be able to return, for example:
    Do MMMM YYYY when day = 1
    D MMMM YYYY otherwise

  2. Define a new token. Building on LT (localized Time) and LTS (localized Time with seconds), name it LD (for localized Day of month). It would return either D or Do, with localized rules to decide which. Defaults to D or Do to be defined. Use this new token in the localized French date formats, for example: LL : 'LD MMMM YYYY'

Please advise what is your preferred solution. Can you think about another one too? (Adding to the discussion authors of the fr locales: @jfroffice @gaspard @jonbca )

Edit: Updated name of new token idea from DL to LD.

@gaspard
Copy link
Contributor

gaspard commented Feb 21, 2017

Thanks for notifying. I think solution (2) is fine as long as, like you said, it resolves to Do when nothing special is done.

I think calling it "Dom", making it clear what it is "Day of month" or "Day ordinal for month" is better then DL because everything is "localized" so the "L" does not add meaning...

@jfroffice
Copy link
Contributor

@fbonzon solution (2) seems quite better as it is not disruptive with the current implementation.

+1 for "Dom" as @gaspard suggest.

@fbonzon
Copy link
Contributor

fbonzon commented Feb 23, 2017

I tried to implement 1., but abandoned. Is possible but requires more work than expected. The parsing code expects fixed formats, and allowing functions for the date formats (instead of fixed strings) incurs more changes than I can afford now. I liked that solution, because I think semantically this issue is better handled in functions within the French locale code, rather than at a global scope.

About 2., in my opinion Dom should not allow the possibility to stand for "Day ordinal for month". It unfortunately brings confusion, because it will not necessarily be an ordinal. It will be either an ordinal or a cardinal. We could also simply pick an unused letter. Say F, because it's the one after D, E being already taken.

@fbonzon
Copy link
Contributor

fbonzon commented Feb 26, 2017

Can a team member from moment confirm option 2 is OK (add a new token for Localized Day of month), before I start coding it ? Or feel free to claim this work. Thank you.

@marwahaha
Copy link
Member

Moment.js will not take more substantial changes to its codebase.
https://momentjs.com/docs/#/-project-status/

it seems like @fbonzon 's changes require a lot of work, so I don't think we should proceed.

@mrleblanc101
Copy link

mrleblanc101 commented Mar 28, 2023

We say Samedi 1er avril, but not Dimanche 2e avril.
The correct for should be Dimanche 2 avril.
I guess I'll override the translation myself in my projet to bring back the previous behavior which was the correct one.

EDIT: This has been fixed in fr.json but not in fr-ca.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants