laravel-lang/native-currency-names
Laravel Lang Native Currency Names adds localized currency names in their native language for Laravel apps. Install via Composer and use it to display currency labels correctly across locales with easy integration and MIT licensing.
__()/trans()), requiring minimal architectural changes. It integrates seamlessly with existing localization workflows (e.g., AppServiceProvider, LocaleMiddleware).resources/lang/vendor/native-currency-names/, isolating currency data from core application logic. This aligns with Laravel’s convention of vendor-specific language files.| Risk Area | Severity | Mitigation |
|---|---|---|
| Locale Coverage Gaps | Medium | Validate supported locales early (e.g., getLocales()). Use fallback logic. |
| Currency Code Mismatch | High | Enforce ISO 4217 codes (e.g., USD, not US) via validation layers. |
| Translation Caching | Low | Clear caches (view:clear, cache:clear) post-updates or deployments. |
| RTL/Pluralization Issues | Medium | Test RTL languages (e.g., Arabic) and pair with Laravel’s pluralization rules. |
| Custom Locale Maintenance | Medium | Document extension workflows (e.g., publishing custom translations). |
Locale Prioritization:
ja, de, ar, hi for global fintech.)Currency Scope:
USD, EUR), or do you need custom/crypto currencies (e.g., BTC, ETH)?Integration Points:
JPY → UI updates)?Performance:
Localization Workflow:
Testing:
ja, de, fr locales.)Future-Proofing:
lang:publish.)LocaleMiddleware, app()->setLocale(), or user-specific locales.Accept-Language headers).| Phase | Action | Tools/Commands |
|---|---|---|
| Discovery | Audit existing currency displays (hardcoded symbols, API responses). | Search codebase for $, €, ¥, etc. |
| Installation | Add package and publish translations. | composer require laravel-lang/native-currency-names php artisan lang:publish --provider="LaravelLang\NativeCurrencyNames\ServiceProvider" |
| Core Integration | Replace hardcoded symbols with __('native-currency-names::currency.XXX'). |
IDE refactoring (e.g., VSCode "Replace All"). |
| Locale Handling | Implement dynamic locale detection (e.g., app()->getLocale()). |
Middleware or user preferences. |
| Testing | Validate translations for critical locales. | PHPUnit/Pest tests (see "Testing Patterns"). |
| Optimization | Cache frequent lookups; pre-load translations for high-traffic routes. | cache()->remember() or Redis. |
| Extension | Add custom locales or override translations. | Publish custom files to resources/lang/. |
Phase 1: Core Integration
en, ja, de).Phase 2: API/Backend
Phase 3: Advanced Use Cases
Phase 4: Maintenance
resources/lang/vendor/native-currency-names/, making them easy to version-control.trans(..., null, 'en')) or check getLocales().USD, not US).php artisan view:clear, cache:clear).How can I help you explore Laravel packages today?