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

Wrong translation for French. #1391

Closed
Dallas62 opened this issue Aug 28, 2019 · 14 comments · Fixed by #3662
Closed

Wrong translation for French. #1391

Dallas62 opened this issue Aug 28, 2019 · 14 comments · Fixed by #3662

Comments

@Dallas62
Copy link

Dallas62 commented Aug 28, 2019

Hi!

When we use the format iiii do MMMM yyyy, we should have this translation:

"Jeudi 1er août 2019" and "Jeudi 29 août 2019"
but we have:
"Jeudi 1er août 2019" and "Jeudi 29ème août 2019"

There is an extra "ième" when the day is greater than 1, this should not happen.

src/locale/fr/_lib/formatters/index.js is not included / loaded and use the wrong format (Do instead of do). I didn't know how to do it. formatters is not used when I place it in the locale... and the engine seems to ignore it...

It does not break the functionalities but it's a bad "experience" for users... I can replace it if French, but... 😄

Regards

EDIT:
New link in v3: https://github.com/date-fns/date-fns/blob/main/src/_lib/format/formatters/index.ts#L317

@dkozickis
Copy link
Contributor

dkozickis commented Sep 11, 2019

@Dallas62 thank you for reporting, PR is welcome!

Ordinal numbers can be edited here

https://github.com/date-fns/date-fns/blob/master/src/locale/fr/_lib/localize/index.js#L61

@Dallas62
Copy link
Author

@dkozickis Hi !

The issue is not about a problem with ordinal number in general, but ONLY on the case you choose "do MMMM".

It sound's good to say:
"Le 3ème jour de la semaine"

@dkozickis
Copy link
Contributor

dkozickis commented Sep 11, 2019

Right, this looks like a regression from v1.

https://github.com/date-fns/date-fns/blob/master/src/locale/fr/_lib/formatters/index.js you mention is not used anymore as far as I can see, due to formatters restructure, it seems.

Good way forward here seems to be passing next token (maybe as part of formatterOptions') to selected formatterfunction informat`

return formatter(utcDate, substring, locale.localize, formatterOptions)

then determine if next token is a month token and pass that information further to ordinalNumber options

return localize.ordinalNumber(date.getUTCDate(), { unit: 'date' })

then we'll have that information in ordinalNumber locale function and we'll be able to determine suffix correctly

@kossnocorp / @leshakoss any comments?

@dkozickis dkozickis added 🤔 Feedback wanted Community feedback is required and removed 🐣 Good first issue labels Sep 11, 2019
@jfeltesse
Copy link

jfeltesse commented Sep 14, 2019

Also, may I add, the ème and such suffixes are incorrect: http://www.academie-francaise.fr/abreviations-des-adjectifs-numeraux

edit: in this case only 1er matters, which is correct. It should ideally be superscript but I don't think unicode provides any "er" superscript character.

@drasill
Copy link

drasill commented Apr 24, 2020

I also confirm this, which make the do pattern useless in french.

@Dallas62
Copy link
Author

Hi @dkozickis
I just check how to create a test case then make a PR, but sorry the project is too hard to understand where to start.

@dkozickis
Copy link
Contributor

@kossnocorp what's your opinion on how to procede here?

@antoinerousseau
Copy link

any help needed on this? I can try to open a PR.

@reDim89
Copy link

reDim89 commented Jan 25, 2023

The issue still happens in the latest version of the package.
There's wrong ème suffix added for French locales.

Incorrect: 19ème janvier 2023
Correct: 19 janvier 2023

@reDim89
Copy link

reDim89 commented Mar 14, 2023

@antoinerousseau sorry, may be you can help one more time with this issue?

@Dallas62
Copy link
Author

Dallas62 commented Jan 8, 2024

@kossnocorp @dkozickis Is there any update about this case ?
It's really weird to keep a "workaround" that replace the string...

@kossnocorp
Copy link
Member

@antoinerousseau or anyone else is welcome to send a PR. I'll make sure it's shipped soon.

@kossnocorp kossnocorp added 👋 PR welcome and removed 🤔 Feedback wanted Community feedback is required labels Jan 9, 2024
@antoinerousseau
Copy link

Voilà :)

@fturmel
Copy link
Member

fturmel commented Jan 10, 2024

Would love everyone's feedback on #3662!

kossnocorp added a commit that referenced this issue Jan 15, 2024
…month format bug fix (#3662) (closes #1391)

Added a preprocessor to the locales API, enabling fixing a long-standing bug in the French locale.

Co-authored-by: Sasha Koss <koss@nocorp.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants