Translation and i18n interface with placeholder replacement, pluralization, and fallback locale support.
composer require marko/translationNote: You also need an implementation package such as marko/translation-file to load translations from disk.
use Marko\Translation\Contracts\TranslatorInterface;
class WelcomeController
{
public function __construct(
private readonly TranslatorInterface $translator,
) {}
public function greet(): string
{
return $this->translator->get('messages.welcome');
}
}Full usage, API reference, and examples: marko/translation