Skip to content

fix: locales like 'pt_BR' 'fr_BE' will work when send to the frontend #402

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

crazynds
Copy link

@crazynds crazynds commented Mar 19, 2025

I recently had a problem using laravel-file-maneger. When I opened the manager it didnt show any file, only folder. Trying to find the problem I found the following error in the frontend:
image

So looking more deep I found the problem is the same as here: formatjs/formatjs#2440

Basically, if you use intl for internationalization, it wont work if it couldnt find a valid lang for the case, so, 'pt_BR' is a invalid lang, but 'pt-BR' is valid.

But why dont I change that in the app.php config?

Because php use the oposite 😃.
You can see here: https://www.php.net/manual/en/intlcalendar.getavailablelocales.php

So, this PR only replace all _ in a locale with -. I checked and any Intl locales use '_' in their names.

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

Successfully merging this pull request may close these issues.

1 participant