framework icon indicating copy to clipboard operation
framework copied to clipboard

[spiral/translator] Add TranslatorInterface::setLocale()

Open rincler opened this issue 9 months ago • 1 comments

In the "TestCase.php" generated by create-project:

if ($container->has(TranslatorInterface::class)) {
    $container->get(TranslatorInterface::class)->setLocale('en');
}

phpstan:

 Line   tests/TestCase.php                                                               
 ------ --------------------------------------------------------------------------------- 
  34     Call to an undefined method Spiral\Translator\TranslatorInterface::setLocale().  
         🪪  method.notFound    

rincler avatar Apr 03 '25 21:04 rincler

Good catch. The setLocale() method has been present in the implementation for a long time. We should consider adding this method to the interface in the next major release.

roxblnfk avatar Apr 04 '25 14:04 roxblnfk