laravel-language | Language switcher package for Laravel | Internationalization library
kandi X-RAY | laravel-language Summary
kandi X-RAY | laravel-language Summary
Language switcher package for Laravel
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Set locale .
- Generate language names
- Get language codes
- Register the language services .
- Handle the request .
- Register the user table .
- Remove locale .
- Returns the facade accessor .
- Register the language configuration .
laravel-language Key Features
laravel-language Examples and Code Snippets
Community Discussions
Trending Discussions on laravel-language
QUESTION
I've been struggling lately with this problem and I really need some help.
So I implemented this tutorial: https://youtu.be/KqzGKg8IxE4 for adding localization to my project and it works well for routes that doesn't require another parameter besides the language. What I want to do is just keep the locale to the url as the first segment of the link, so it should follow this pattern:
- example.com/en/shop
- example.com/en/products/5/edit
but the routes with more parameters shouldn't be influenced by this prefix.
I have found more possible fixes for this, such as removing al the resource grouped routes and type them manually which would take forever, or override all the routes in order to use a parameter as a language switcher, for example 'example.com/shop?lang=en' and then implement an URL Generator macro, as answered in this question.
Also, I tried added an optional parameter in the language-switcher component, straight in my blade file like so
...ANSWER
Answered 2021-Apr-22 at 06:25You can get the current route parameters from the route object so something like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install laravel-language
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page