Giter Club home page Giter Club logo

Comments (7)

BenConstable avatar BenConstable commented on July 28, 2024

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.

shadoWalker89 avatar shadoWalker89 commented on July 28, 2024

+1

from laravel-localize-middleware.

BenConstable avatar BenConstable commented on July 28, 2024

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.

BenConstable avatar BenConstable commented on July 28, 2024

FYI, the relevant commit is 7925a09 if you want to have a look at the code.

from laravel-localize-middleware.

BenConstable avatar BenConstable commented on July 28, 2024

This functionality is now in place as of v1.2.0.

from laravel-localize-middleware.

dionysiosarvanitis avatar dionysiosarvanitis commented on July 28, 2024

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.

BenConstable avatar BenConstable commented on July 28, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.