Search

Showing 7 of 1,216 result(s)

/blog/2018/02/20/laravel-5-string-translation-public-api#content-working-with-translator-message-selectors

Each translator instance contains an instance of "Illuminate\Translation\MessageSelector", which is used to determine which translation line should be returned when using the choice or transChoice methods. The translator allows you to retrieve the...

/blog/2018/02/20/laravel-5-string-translation-public-api#content-retrieving-a-message-selector-instance-with-getselector

The getSelector method returns the instance of "Illuminate\Translation\MessageSelector" that the translator is currently using. If no MessageSelector has been previously set, a new instance of MessageSelector is created, set, and returned.

/blog/2018/02/20/laravel-5-string-translation-public-api#content-signature-12

The signature of the getSelector method is: public function getSelector();

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

The following example will resolve a translator instance from the service container and get the current MessageSelector instance.

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

In the following example, we will extend the MessageSelector to return always return the same string when resolving a translation line using the choice and transChoice methods: Armed with our custom MessageSelector implementation, we can now set...