-
Notifications
You must be signed in to change notification settings - Fork 12
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
Precedence in determiners #2
Comments
Thanks for the suggestion, it's something I've thought about actually and I'll try and get it built soon. I'll leave this issue open until then, and would welcome a PR if yourself or anyone else fancies a go. |
+1 |
Hi @dionysiosarvanitis and @shadoWalker89 - I've added this functionality, so check out the updated README: https://github.com/BenConstable/laravel-localize-middleware#using-multiple-determiners Let me know what you think! I'll try to release a new version of the package tomorrow, but for now |
FYI, the relevant commit is 7925a09 if you want to have a look at the code. |
This functionality is now in place as of v1.2.0. |
That's great news! Thanks a lot @BenConstable. I also noticed that header's What do you think about this: public function determineLocale(Request $request)
{
$header = $request->header($this->header, $this->fallback);
$accepts = explode(',', $header);
// Turn en-gb into en
return ! isset($accepts[0]) ?: substr($accepts[0], 0, 2);
} |
No worries. Thanks for bringing that to my attention - I've created issue #3 to track this. The code looks like a good start, I'll look at getting an implementation sorted soon. |
It would be nice if we could set a precedence in determiners. Eg. first check for a cookie and if not exists then check for a parameter, then for a session key and finally for a header attribute.
The text was updated successfully, but these errors were encountered: