03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Multisites 210<br />

1 @extends("layout")<br />

2 @section("content")<br />

3 <br />

4 {{ Lang::get("steps.instructions") }}<br />

5 <br />

6 <br />

7 <br />

8 {{ trans("steps.step1") }}<br />

9 <br />

10 <br />

11 {{ trans("steps.step2", [<br />

12 "product" => trans("steps.product")<br />

13 ]) }}<br />

14 <br />

15 <br />

16 @stop<br />

.<br />

This file should be saved as app/views/www/layout.blade.php.<br />

The Lang::get() method gets translated phrases out of the configuration files (in this case steps.instructions).<br />

The trans() method serves as a helpful alias to this.<br />

You may also have noticed that step2 has a strange :product placeholder. This allows the insertion<br />

of variable data into translation phrases. We can pass these in the optional second parameter of<br />

Lang::get() and trans().<br />

.<br />

You can learn more about the Localization class at: http://laravel.com/docs/localization.<br />

Using Language Lookups in Packages<br />

We’re not going to go into the details of how to create packages in Laravel 4, except to say that it’s<br />

possible to have package-specific translation. If you’ve set a package up, and registered its service<br />

provider in the application configuration, then you should be able to insert the following lines:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!