Daenu Daenu - 1 year ago 121
PHP Question

Get whole language file array

I'm newbie in laravel 4.0.

  • How to get the whole array from

  • Is there a

My goal is to generate keywords/description in my base controller, to fill them into the the meta tags and other places in the DOM in the master blade template. If my approach is completely wrong, please tell me!

Generating the keywords and description from an associative array is NOT the problem, but the lack of knowledge about the framework. And, I was googling for quite a time before ending up here...

Working with blade templates:
This is my BaseController:

class HomeController extends BaseController {

protected $layout = 'layouts.master';
private $keyWords = array();

private function getKeyWords () {
// ???


public function getIndex() {
return View::make('home')
->with('errorcanvas', trans('texts.canvas'))
->with('errortextwebgl', trans('texts.webgl'))
->with('errortextwebglinit', trans('texts.webglinit'))
->with('d3', trans('texts.3dtext'))
->with('alt', trans('texts.alternativpage'));



I found something in the API:

Illuminate\Translation\FileLoader load()
which loads the messages with a given


Answer Source

In Laravel 5.x (and 4.x) get the entire array with Lang::get().

$array = Lang::get('pagination'); // return entire array
$text  = Lang::get('pagination.next'); // return single item
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download