memmedimanli
memmedimanli

Reputation: 85

Using locale in URL and routes in Laravel 5

I am newbie in Laravel and I have some problems with multiply locale. I configured all things and it works fine. My problem is using locale in url. For example when I click the 'man' category link it gives me http://localhost:8000/category/man. But I want to use locale in all pages. When I use website in English it should be http://localhost:8000/en/category/manand when I use website in Russian it should be http://localhost:8000/ru/category/man. I want to apply this technique to all pages, all URLs to get appropriate content for all languages. How can I do it, please give me some examples if it is possible.

Upvotes: 1

Views: 1505

Answers (1)

Alireza
Alireza

Reputation: 1764

You need use Route Prefixes method :

Route::group(['prefix' => '{lang}'], function () {
    Route::get('category/{category}', function ($lang,$category)    {
       echo $lang . $category;
    });
});

Upvotes: 1

Related Questions