Showing 7 of 1,216 result(s)
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...
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.
The signature of the getSelector method is: public function getSelector();
The following example will resolve a translator instance from the service container and get the current MessageSelector instance.
The setSelector method can be used to set which MessageSelector instance is used by the translator.
The signature of the setSelector method is:
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...