Laratext Package Automates Multilanguage Translation in Laravel Apps
Laratext is a new open-source Composer package designed to simplify multilanguage support in Laravel applications. It introduces a text() helper and @text Blade directive that accept a key and a readable English default, eliminating the need for opaque dot-notation keys in templates. A built-in scan command detects untranslated strings across PHP and Blade files and automatically translates them into configured target languages using OpenAI, Google, or Anthropic Claude APIs. The package writes translations to JSON language files and supports flags like --dry, --diff, and --resync for controlled, incremental updates. Developers can also build custom translator classes for other services, such as DeepL, by implementing the package's TranslatorInterface.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in