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

fetchSimilarLocales: All-lowercase Accept-Language header doesn't work #211

Open
cachius opened this issue Apr 11, 2022 · 0 comments
Open

Comments

@cachius
Copy link

cachius commented Apr 11, 2022

Safari on MacOS sends an all-lowercase header like Accept-Language: de-de. On case-sensitive filesystems this causes MomentLocale.php::fetchSimilarLocales not finding alternatives.

$dir = dirname($path);
$lang = basename($path);

$locales = glob("$dir".DIRECTORY_SEPARATOR.substr($lang,0,2) . '*.php');

works around that. It would be even better to be also case-insensitive to the first part of the locale.
C.f. Can PHP's glob() be made to find files in a case insensitive manner?

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

No branches or pull requests

1 participant