Comments (7)
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.
from laravel-localize-middleware.
+1
from laravel-localize-middleware.
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 dev-master
has the changes.
from laravel-localize-middleware.
FYI, the relevant commit is 7925a09 if you want to have a look at the code.
from laravel-localize-middleware.
This functionality is now in place as of v1.2.0.
from laravel-localize-middleware.
That's great news! Thanks a lot @BenConstable.
I also noticed that header's determineLocale
should probably change a little. Since Accept-Language may include some language-range information we can end up with something like da, en-gb;q=0.8, en;q=0.7
for Accept-Language
header.
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);
}
from laravel-localize-middleware.
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.
from laravel-localize-middleware.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-localize-middleware.