You want to change how the message selector logic works.
Lang::setSelector() to set your own message selector.
$selector = new MyMessageSelector; Lang::setSelector($selector);
The message select is what handles pulling the correct message from a pipe (|) delimited string based on a number, locale, and the pluralizaion rules in the message itself.
Your class must extend the
Symfony\Component\Translation\MessageSelector class. It should then override the
choose() method to implement your custom logic.
See also the Getting the Translation Message Selector recipe.
Where to call this method?
It should be called earlier than the
Lang facade is used. Since this is very low level coding, the best place is a service provider.