06.10.2016 Views

laravel-5

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

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

Localization 396<br />

1 'apples' => 'There is one apple|There are many apples',<br />

Then, you may use the trans_choice function to retrieve the line for a given “count”. In this example,<br />

since the count is greater than one, the plural form of the language line is returned:<br />

1 echo trans_choice('messages.apples', 10);<br />

Since the Laravel translator is powered by the Symfony Translation component, you may create<br />

even more complex pluralization rules:<br />

1 'apples' => '{0} There are none|[1,19] There are some|[20,Inf] There are many',<br />

Overriding Vendor Language Files<br />

Some packages may ship with their own language files. Instead of hacking the package’s core files<br />

to tweak these lines, you may override them by placing your own files in the resources/lang/vendor/{package}/{locale}<br />

directory.<br />

So, for example, if you need to override the English language lines in messages.php for a package<br />

named skyrim/hearthfire, you would place a language file at: resources/lang/vendor/hearthfire/en/messages.php.<br />

In this file you should only define the language lines you wish to override.<br />

Any language lines you don’t override will still be loaded from the package’s original language files.

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

Saved successfully!

Ooh no, something went wrong!