Creating localization of content
If our app is going to be used by people in different countries, or who speak different languages, we'll need to localize the content. Laravel provides an easy way to do this.
Getting ready
For this recipe, we just need a standard installation of Laravel.
How to do it...
For this recipe, follow these steps:
In the
app/lang
directory, add three new directories (if they aren't already there) :en
,es
, andde
.In the
en
directory, create a file namedlocalized.php
and add the following code to it:<?php return array( 'greeting' => 'Good morning :name', 'meetyou' => 'Nice to meet you!', 'goodbye' => 'Goodbye, see you tomorrow.', );
In the
es
directory, create a file namedlocalized.php
and add the following code to it:<?php return array( 'greeting' => 'Buenos días :name', 'meetyou' => 'Mucho gusto!', 'goodbye' => 'Adiós, hasta mañana.', );
In the
de
directory, create a file namedlocalized.php
and add the following code to it:<...