@JillzTom there is no need to write a view for each language you have. It does not work this way. You have to write a translation for each language and then use the trans helper inside your view to load the translated messages.
Feb 11, 2016
10
Level 10
Localization in Laravel
I'm trying to use the package: https://github.com/mcamara/laravel-localization for adding multiple languages to my app.
I've installed everything and I can change the language to
example.com/en/about
//or
example.com/es/acerta
Now how can I route the call to the appropriate language view? I mean when I hit the url example.com/es/acerta how can I show the about page in spanish?
I tried something like this in my PagesController:
protected $language;
public function __construct()
{
$this->language = LaravelLocalization::getCurrentLocale();
}
public function aboutPage()
{
return view("pages.$this->language.about");
}
This would choose the view according to the current language selected.
But this would create multiple sets of views for each language with translated content.
Is this the way to go about it?
Please or to participate in this conversation.
