- How do I install `laravel-lang/native-currency-names` in my Laravel project?
- Run `composer require laravel-lang/native-currency-names` and publish the translations with `php artisan lang:publish`. The package follows Laravel’s standard translation structure, so no additional configuration is needed for basic usage. For programmatic access, bind the facade or service provider in `config/app.php`.
- Which Laravel versions does this package support?
- The package is fully compatible with Laravel 8 through 13, PHP 8.1+, and Pest 3. It maintains backward compatibility with no breaking changes since version 1.0.0. Always check the [release notes](https://github.com/Laravel-Lang/native-currency-names/releases) for updates.
- Can I use this for multi-language e-commerce stores?
- Yes. The package is designed for e-commerce, invoicing, and financial UIs. Use it in Blade templates (`{{ __('native-currency-names::currency.USD', [], 'ja') }}`) or API responses (`trans('native-currency-names::currency.' . $currency, [], $locale)`) to display currencies in the user’s native language.
- What if my locale isn’t supported? How do I handle fallbacks?
- The package includes a fallback mechanism. If a locale isn’t supported, use `trans('native-currency-names::currency.USD', [], 'en')` to default to English. For unsupported locales, audit `getLocales()` early and implement custom logic or extend the package via overrides.
- Does this package work with Livewire or Inertia.js?
- Absolutely. The package is frontend-agnostic and integrates seamlessly with Livewire (via Blade) and Inertia.js (via API responses or shared translations). No additional setup is required beyond standard Laravel localization workflows.
- How do I override or extend translations for custom currencies?
- Publish the translations (`php artisan lang:publish`) and modify the JSON files in `resources/lang/vendor/native-currency-names/`. For dynamic currencies (e.g., crypto), validate ISO 4217 codes in your business logic and extend the package by adding new entries to the JSON files.
- Is this package optimized for high-traffic financial applications?
- Yes. It leverages Laravel’s built-in translation caching, introducing negligible overhead. For high-frequency API endpoints, ensure translations are cached globally (e.g., `config('app.cache_locale_translations' = true)`) or use a shared Redis cache in microservices.
- How do I test RTL languages like Arabic or Hebrew?
- Test RTL locales by rendering translations in Blade or API responses and pair them with Laravel’s pluralization rules. Use tools like `laravel/browsershot` for RTL layout testing. Ensure your UI framework (e.g., Tailwind, Bootstrap) supports RTL directionality.
- Are there any compliance risks for region-specific currency naming (e.g., Japan’s Financial Instruments Act)?
- The package provides accurate, community-maintained translations, but you should validate compliance for critical markets (e.g., India’s ₹ symbol + 'रुपया'). Audit translations against local regulations and consider adding custom validation layers in your business logic.
- What are the alternatives to this package, and why choose this one?
- Alternatives include manual JSON files or third-party APIs like `moneyphp/money`, but this package is Laravel-native, lightweight, and integrates directly with Laravel’s i18n system. It avoids external dependencies, offers better performance, and is actively maintained by Laravel Lang. Forks are discouraged; use overrides instead.