laravel-lang/native-currency-names
Laravel Lang Native Currency Names provides localized, native-language currency names for Laravel apps. Easy to install via Composer and designed to complement Laravel localization workflows for displaying currencies correctly across locales.
resources/lang/vendor/) and integrates natively with the trans() helper, LanguageServiceProvider, and Blade directives. This ensures zero architectural disruption and leverages existing caching (e.g., config('app.fallback_locale')) without custom infrastructure.lang:publish + manual overrides.trans('...', [], 'en', 'fallback')).composer require laravel-lang/native-currency-names.php artisan lang:publish --provider="LaravelLang\NativeCurrencyNames\NativeCurrencyNamesServiceProvider".__('native-currency-names::currency.USD', [], 'ja') → "ドル".@currency('USD', 'ja') (custom directive) or raw __() calls.trans('native-currency-names::currency.' . $currency, [], $locale).app('translator').LaravelLang\NativeCurrencyNames) and no external HTTP/API calls, reducing risk of version skew or downtime.| Risk | Severity | Mitigation Strategy |
|---|---|---|
| Locale Coverage Gaps | Medium | Validate target locales against supported list. Use trans() fallbacks (e.g., trans('...', [], 'ja', 'en')) for unsupported combinations. |
| Currency Code Mismatches | Low | Enforce ISO 4217 codes (e.g., USD, not US) via validation (e.g., Illuminate\Validation\Rule::in(['USD', 'EUR', ...])). |
| Caching Invalidation | Low | Clear translation cache (php artisan cache:clear) after manual locale updates or use trans()’s built-in cache busting. |
| Dynamic Currency Logic | Medium | For non-ISO codes (e.g., crypto), extend the package or use a hybrid key (e.g., trans('native-currency-names::custom.BTC', [], $locale)). |
| RTL/LTR Rendering Issues | Low | Test currency names in RTL locales (e.g., Arabic دولار) with CSS direction: rtl and ensure symbols (e.g., ₹, ¥) align correctly. |
| Future Laravel Version Risk | Low | Monitor Laravel Lang’s roadmap for Laravel 14+ support. Package’s active maintenance (last update: March 2026) reduces risk. |
ja, hi, ar)? Are there regulatory requirements (e.g., Japan’s Financial Instruments Act mandates "ユーロ" over "Euro")?ja → en) for unsupported currency/locale pairs. Example: trans('...', [], 'ja', 'en').expect(__('native-currency-names::currency.USD', [], 'ja'))->toBe('ドル');
README.md:
# Overriding Translations
Copy `resources/lang/vendor/native-currency-names/` to `resources/lang/` to customize.
| Phase | Action Items | Estimated Effort | Dependencies |
|---|---|---|---|
| Discovery | Audit existing currency displays (Blade, APIs, emails). Identify gaps (e.g., hardcoded $, missing locales). |
2 hours | Product team, design system docs |
| Integration | 1. Install package. 2. Publish translations. 3. Replace hardcoded currency names with __('native-currency-names::currency.CODE', [], 'LOCALE'). 4. Test edge cases (fallbacks, RTL). |
4 hours | Dev environment, CI pipeline |
| Validation | 1. Manual QA for top 5 locales. 2. Automate tests for critical paths (e.g., checkout flow). 3. Performance benchmark (translation cache hit ratio). | 6 hours | QA checklist, Pest/PHPUnit tests |
| Rollout | Gradual deployment: Start with non-critical pages (e.g., admin dashboards), then checkout, then emails. Monitor error rates (e.g., missing translations). | 2 hours | Feature flags, Sentry monitoring |
| Optimization | 1. Cache invalidation strategy for dynamic locales. 2. Custom facade for complex use cases (e.g., Currency::name('USD', 'ja')). 3. Document overrides process. |
3 hours | Dev docs, internal wiki |
ja, hi, ar, pt_BR, zh_CN).trans() fallbacks or extend the package. Example:
// Fallback to English if 'fr_CA' is unsupported
trans('native-currency-names::currency.CAD', [], 'fr_CA', 'en');
USD, EUR, JPY).native-currency-names::custom.BTC).How can I help you explore Laravel packages today?