plugins/laravel-expert/skills/laravel-i18n/SKILL.md
Laravel localization - __(), trans_choice(), lang files, JSON translations, pluralization, middleware, formatting. Use when implementing translations.
npx skillsauth add fusengine/agents laravel-i18nInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before ANY implementation, use TeamCreate to spawn 3 agents:
After implementation, run fuse-ai-pilot:sniper for validation.
| Feature | PHP Files | JSON Files |
|---------|-----------|------------|
| Keys | Short (messages.welcome) | Full text |
| Nesting | Supported | Flat only |
| Best for | Structured translations | Large apps |
:placeholder replacementsauth.login.title, auth.login.buttonTranslation task?
├── Basic string → __('key')
├── With variables → __('key', ['name' => $value])
├── Pluralization → trans_choice('key', $count)
├── In Blade → @lang('key') or {{ __('key') }}
├── Locale detection → Middleware
├── Format date/money → LocalizationService
└── Package strings → trans('package::key')
| Topic | Reference | When to Consult | |-------|-----------|-----------------| | Setup | localization.md | Initial configuration | | Pluralization | pluralization.md | Count-based translations | | Blade | blade-translations.md | View translations | | Middleware | middleware.md | Locale detection | | Formatting | formatting.md | Date/number/currency | | Packages | packages.md | Vendor translations | | Best Practices | best-practices.md | Large app organization |
| Template | When to Use | |----------|-------------| | SetLocaleMiddleware.php.md | URL/session locale detection | | lang-files.md | Translation file examples | | LocaleServiceProvider.php.md | Centralized localization service | | LocaleRoutes.php.md | URL prefix locale routing |
// Basic translation
__('messages.welcome')
// With replacement
__('Hello :name', ['name' => 'John'])
// Pluralization
trans_choice('messages.items', $count)
// Runtime locale
App::setLocale('fr');
App::currentLocale(); // 'fr'
:placeholder for dynamic valuesL'API de localisation (__(), trans_choice(), App::setLocale()) reste inchangée en Laravel 13. Points spécifiques :
Context::add('locale', $locale) propage la locale dans les jobs queue (résout le bug L12 où la locale était perdue dans les ShouldQueue)serializable_classes : whitelister vos Locale enums si utilisés en queueSetLocale : compatible avec le nouveau validateOrigin() de [[laravel-auth]]// app/Jobs/SendNotification.php
public function handle(): void
{
App::setLocale(Context::get('locale', 'en'));
Notification::send($this->user, new OrderShipped());
}
testing
Copy self-audit and ban-lists — filler verbs/hype adjectives, slop placeholder names, fake-precise numbers, Title Case headlines, humor in error copy ('Oops!'), em-dash crutch, one copy register per page.
development
Logged-in web apps — dashboards, auth flows, settings, onboarding, data tables, command palettes, modals, toasts. Register `product`: density and glance-speed over marketing polish, no hero/CTA-tricks, every data surface covers empty/loading/error explicitly, tables and dataviz follow preattentive-processing rules.
development
Marketing sites, landing pages, campaign pages — register `brand` (design IS the product). Structure comes from the register's POV + a macrostructure pick, never from copying an inspiration site's section flow. Hero discipline, deviated section order, asymmetric grids, and a silhouette lookalike-test gate before ship.
development
Token-strategy core — OKLCH color rules, neutral tinting, accent-commitment levels, type scale, 8pt spacing grid, touch targets, and the canonical output format of design-system.md (the file the harness gates on). This is routing step 1 of design-method/SKILL.md — read it before design-web/design-webapp/design-ios/design-android, before picking or auditing a single color/type/spacing value.