Localization

  • Laravel's localization features provide a convenient way to retrieve strings in various languages, allowing you to easily support multiple languages within your application
  • Language strings are stored in files within the resources/lang directory. Within this directory there should be a subdirectory for each language supported by the application.
  • Here you see the default view of the error 404 page (left) and the login page (right)

Default

  • All these pages can easily be translated to another language

Dutch localization

  • Clone this repo to your desktop: https://github.com/caouecs/Laravel-lang
    • Copy the folder src/nl from this repo to the folder resources/lang/ of your project
    • Copy the file json/nl.json from this repo to the folder resources/lang/ of your project

Language folder

  • Open the file /config/app.php
    • Find the entry 'locale' => 'en', and change it to nl (= Dutch)











 

 /*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/

'locale' => 'nl',
1
2
3
4
5
6
7
8
9
10
11
12

WARNING

At the time of writing the translation has not yet been fully converted to the latest version of Laravel. Therefore, you need to add some extra strings to nl.json.

  • Open nl.json
  • Add two extra strings:
...
"Not Found": "Pagina niet gevonden",
"Server Error": "Serverfout",
1
2
3

Dutch

Last Updated: 11/11/2019, 8:47:20 PM