Skip to main content
All user-facing strings must be wrapped with __() to support localization. This applies everywhere — PHP controllers, actions, models, and TypeScript/React components alike.

The Pattern

Write the English text directly inside __(). The system extracts strings automatically and manages translation files.
return redirect()->back()->withSuccess(__('User was created'));

$this->label(__('Delete'));
$this->confirmMessage(__('Are you sure you want to delete this company?'));

Rules

  • Always use literal strings inside __(). Never construct strings dynamically.
  • Do not use dot-notation translation keys like __('users.created') — write the English text directly.
  • The compose localize command extracts all __() calls and updates language files automatically.
Never use dynamic string construction like __(Str::headline($name)). Translation extraction tools cannot find dynamically built strings, so they will be missing from language files.

Translation Workflow

When you add or change strings, the translate agent skill fills in missing translations for all configured languages automatically.
composer localize
This extracts all __() calls and adds missing keys to language files. The translate skill then translates the new keys using existing translations as context for consistent terminology.