laravel-i18n
Use when implementing Laravel translations — __(), trans_choice(), lang files, pluralization, locale middleware, or formatting.
от Fusengine★ 36 звёзд на GitHub
Установить laravel-i18n в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Laravel Internationalization
Agent Workflow (MANDATORY)
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
- fuse-ai-pilot:explore-codebase - Check existing translation patterns
- fuse-ai-pilot:research-expert - Verify Laravel i18n best practices via Context7
- mcp__context7__query-docs - Check Laravel localization documentation
After implementation, run fuse-ai-pilot:sniper for validation.
Overview
| Feature | PHP Files | JSON Files |
|---|---|---|
| Keys | Short (messages.welcome) |
Full text |
| Nesting | Supported | Flat only |
| Best for | Structured translations | Large apps |
Critical Rules
- Never concatenate strings - Use
:placeholderreplacements - Always handle zero in pluralization
- Group by feature -
auth.login.title,auth.login.button - Extract strings early - No hardcoded text in views
- Validate locales - Use enum or whitelist
Decision Guide
Translation 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')
Reference Guide
Concepts (WHY & Architecture)
| 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 |
Templates (Complete Code)
| 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 |
Quick Reference
// Basic translation
__('messages.welcome')
// With replacement
__('Hello :name', ['name' => 'John'])
// Pluralization
trans_choice('messages.items', $count)
// Runtime locale
App::setLocale('es');
App::currentLocale(); // 'es'
Best Practices
DO
- Use
:placeholderfor dynamic values - Handle zero case in pluralization
- Group keys by feature module
- Use Locale enum for type safety
- Set Carbon locale in middleware
DON'T
- Concatenate translated strings
- Hardcode text in views
- Accept any locale without validation
- Create DB-based translations (use files)
Laravel 13 Notes
The localization API (__(), trans_choice(), App::setLocale()) is unchanged in Laravel 13. Specific points:
Context::add('locale', $locale)propagates the locale into queued jobs (fixes the L12 bug where the locale was lost in ShouldQueue jobs)cache.serializable_classes(defaultfalsein L13): list yourLocaleobjects if you cache themSetLocalemiddleware: compatible with the newPreventRequestForgerymiddleware from laravel-auth
// app/Jobs/SendNotification.php
public function handle(): void
{
App::setLocale(Context::get('locale', 'en'));
Notification::send($this->user, new OrderShipped());
}
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/best-practices.md
- references/blade-translations.md
- references/formatting.md
- references/localization.md
- references/middleware.md
- references/packages.md
- references/pluralization.md
- references/templates/LocaleRoutes.php.md
- references/templates/LocaleServiceProvider.php.md
- references/templates/SetLocaleMiddleware.php.md
- references/templates/lang-files.md
FAQ
Что делает скилл laravel-i18n?
Use when implementing Laravel translations — __(), trans_choice(), lang files, pluralization, locale middleware, or formatting.
Как установить скилл laravel-i18n?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл laravel-i18n запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…