Search

Showing 7 of 1,216 result(s)

/blog/2018/02/19/laravel-5-translation-using-the-double-underscore-__-helper-function#content-example-use

If we look in the resources/lang/en/validation.php resource file, we will see something similar to the following defined at the top of the file: We can retrieve the accepted line like so: $translatedText = __('validation.accepted'); If the above...

/blog/2018/02/19/laravel-5-translation-using-the-double-underscore-__-helper-function#content-supplying-a-locale

For the next example, we will create a new file at resources/lang/es.json to both showcase literal based language files as well as how the $locale parameter can be used. Note: with JSON based language files, there is only one file per locale...

/blog/2018/02/20/laravel-5-string-translation-public-api#content-retrieving-translation-line-text-with-get

The get method can be used to retrieve the translation line for the provided $key . This method can also process any replacements within the translation line itself (by passing an array argument for the $replace parameter). This method also...

/blog/2018/02/20/laravel-5-string-translation-public-api#content-example-use

In the following examples, we will look at the various ways we can invoke the get method. We will start with simple translation line retrieval and gradually work through using the remaining parameters.

/blog/2018/02/20/laravel-5-string-translation-public-api#content-retrieving-translation-lines

The simplest way to use the get method is to simply ask it to get the value of a translation line. In the following example, we will retrieve the validation.accepted translation line (we will continue to reference the validation translation lines...