lundi 30 mai 2016

Correct way to load translated data Laravel 5.2

I am building my first multilingual Laravel website.

For the translations i am using this package: laravel-localization.

In my database i have the columns set up like this:

  • title (english title)
  • title_nl (dutch title)
  • title_fr (french title)

I have read the laravel documentation on Localization and set up my error messages this way. But now i'm confused on how to correctly show the different languages for my views.

Should i do something like this:

@if( LaravelLocalization::getCurrentLocale() == 'nl')
<p></p>

@elseif(LaravelLocalization::getCurrentLocale() == 'fr' )
 <p></p>

@else
  <p></p>
 @endif

This seems extremely messy and not the correct way to handle this, because expanding this would be a nightmare.

Or do i need to use the build in localization functions for this like so:



Or does that defeat the purpose of the package i am using?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire