Please enable JS

Overview

Multilingual Web Application with Laravel: Language Switcher

  0 reviews
9.00

In the previous tutorial, you have learned how to change your application locale and provide translated content. In this tutorial you will learn how to enable users to change the language of the website.

There are actually two ways of doing this:

  • building the feature yourself
  • using a package

Creating a language switcher is very simple and you could probably write it yourself. The whole process would go like this. Have a config file with languages supported, look for the locale in the URL, call \App::setLocale('hr'); depending on the locale found in the URL. There ain't much to it.

With some failures along the way, you could probably pull it off. I have tried doing so in Laravel 4.2 and have burned myself in the end. Since then I have switched to using a package mcamara/laravel-localization.

In this tutorial, we will use the above-mentioned package to provide a language switcher, have routes that can be translated and routes that do not need to be translated.

SAMPLE

SKU: multilingual-web-application-with-laravel-language-switcher
Author Mario Bašić
Words 1,008
Published At April 20, 2017
Last Updated October 14, 2017

No reviews yet.

Related Tutorials

Multilingual Web Application with Laravel: Authentication and Authorization

Laravel makes implementing authentication very simple. We will implement authentication in our existing application.

9.00

Multilingual Web Application with Laravel: Multilingual CRUD

In this tutorial, we will cover creating, updating, deleting and viewing all multilingual articles.

9.00

Multilingual Web Application with Laravel: Model Translations

Handling multilingual models has never been easier.

9.00

Multilingual Web Application with Laravel: Static Content

Let's start with the basics. Learn how to change your application locale, write localization files and use translations in your Laravel application.

9.00

Laravel API 101: DOCUMENT

With API Blueprint you can quickly design and prototype APIs to be created or document and test already deployed mission-critical APIs.

25.00  19.99

Laravel Elixir Without Laravel

If you are tired of writing the same gulp tasks over and over for your projects, why not just install Laravel Elixir, and let it handle it all.

9.00  2.99
Instant Delivery
24/7 Customer Service
Payment Options
7 Days Refunds
Laravel
PHP
React.js
Vue.js
Composer
Nginx
Ubuntu
Linux
Windows
Codeception
MySQL
Lumen

Newsletter