briannesbitt / Carbon

A simple PHP API extension for DateTime.
https://carbon.nesbot.com/
MIT License
16.58k stars 1.28k forks source link

Month abbreviation issue for fr_BE #3109

Closed c-Rolland closed 3 days ago

c-Rolland commented 3 days ago

Hello, I believe that the month abbreviations 'fr_BE' is incorrect.

Some references :

I encountered an issue with the following code:

echo Carbon::parse(new \DateTime('2024-08-30'))->locale('fr_BE')->isoFormat('ll')

Carbon version: "nesbot/carbon": "^3.8.1",

PHP version: 8.1

I expected to get:

30 ao没t 2024

But I actually get:

30 ao没 2024

Impacted file : https://github.com/briannesbitt/Carbon/blob/3.x/src/Carbon/Lang/fr_BE.php

Thanks!

kylekatarnls commented 3 days ago

Bonjour 馃憢

fr_BE was initially built from glibc (because before embedding localizations, Carbon was relying on strftime, so it was the closest match)

And it's still using ao没 at the moment https://github.com/bminor/glibc/blob/7f045c0b48633b198b42bebdff0024d7cfab3901/localedata/locales/fr_BE#L103

For the record we have also this exception for Luxembourg: https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Lang/fr_LU.php

Those 2 are the only ones with custom month lists. Sounds to be something regional but also it's there in glibc for more than 24 years.

ICU is a more reliable and updated source for translation so I would be fine to make fr_BE.php and fr_LU.php simply aliasing fr:

return require __DIR__.'/fr.php';

Feel free to propose a pull-request if you wish. 馃檹

c-Rolland commented 3 days ago

Thanks for your reactivity @kylekatarnls

kylekatarnls commented 3 days ago

It can be tested using composer require nesbot/carbon:dev-master for now.

c-Rolland commented 2 days ago

@kylekatarnls Unit tests are missing for these mapping files, it is because is hard to test or?