laravel-lang/moonshine) is a translation layer for MoonShine, a Laravel admin panel. It extends localization support for MoonShine’s UI components (e.g., forms, tables, buttons) into additional languages.lang files), making it a lightweight, non-intrusive addition. Compatible with Laravel 10+ (explicitly supports Laravel 13 as of v1.9.0).composer require --dev), ensuring it doesn’t bloat production builds. Integrates via a single Artisan command (php artisan lang:update), minimizing footprint.resources/lang). Custom translation backends (e.g., database-driven) may require adjustments.ak, ckb, ur) rely on automated translations, which may lack accuracy. Human review is recommended for critical UIs.es, fr, de).lang:update command is idempotent but could fail if MoonShine’s translation keys change unpredictably.--dev packages be excluded in production?composer show moonshine/framework
lang files. For custom backends (e.g., database), extend the package’s LangUpdateServiceProvider.composer require laravel-lang/moonshine --dev
php artisan lang:update
resources/lang/{locale}/moonshine.php..env:
APP_LOCALE=en
config/app.php:
'locales' => ['en', 'es', 'fr', ...],
resources/lang/{locale}/moonshine.php.php artisan cache:clear
php artisan view:clear
es, fr) to validate the integration.lang:update.name: Validate MoonShine Translations
on:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: composer install
- run: php artisan lang:update --force
- run: php artisan test --filter=TranslationTest
php artisan lang:update after MoonShine updates to sync translations.composer.json to avoid unexpected updates:
"laravel-lang/moonshine": "^1.9"
php artisan lang:update --force to regenerate files.moonshine.php.APP_FALLBACK_LOCALE is set in .env.APP_LOCALE is cached (e.g., in Redis).lang:update and include the locale in config/app.php.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| MoonShine update breaks translations | UI strings appear as keys (e.g., {{ __('moonshine.button.save') }} shows raw text) |
Pin MoonShine version; test updates in staging. |
Corrupted moonshine.php files |
Broken UI or PHP errors | Backup files before updates; use --force flag. |
| Missing critical locale | Fallback to default locale | Manually add translations or use Crowdin. |
CI/CD exclusion of --dev packages |
Translations not updated in prod | Ensure CI includes --dev packages or use a custom script. |
lang:update).lang:update, test in staging.How can I help you explore Laravel packages today?