v1.0.0
π Initial Stable Release
This is the first stable release of Laravel Localizer React, providing seamless integration between Laravel translations and React applications.
β¨ Features
useLocalizer Hook
A powerful React hook for accessing Laravel translations with full TypeScript support:
-
Translation Functions
__()- Main translation function with placeholder replacement and fallback supporttrans()- Alias for__()(Laravel compatibility)lang()- Alias for__()(Laravel compatibility)has()- Check if translation key existschoice()- Pluralization support with replacement variables
-
Locale Information
locale- Current locale code (e.g., 'en', 'fr')dir- Text direction ('ltr' or 'rtl')availableLocales- Available locales with metadata (label, flag, direction)translations- All translations for current locale
Placeholder Replacement
- Supports both
:placeholderand{placeholder}formats - Multiple placeholders in single string
- Numeric and string replacements
- Nested placeholder support
Pluralization
- Laravel-compatible pluralization format
- Support for zero, one, and many forms
- Placeholder replacement in pluralized strings
- Custom count-based rules
Vite Plugin
Automatic TypeScript generation with hot module replacement:
- Watches language files for changes
- Non-blocking command execution
- Configurable watch patterns
- Debug logging option
- Integrates with Laravel Artisan commands
Inertia.js Integration
Seamless integration with Inertia.js:
- Automatic locale detection from page props
- Reactive locale updates
- Shared locale data
- RTL support via page props
π― TypeScript Support
- Full type definitions
- IntelliSense support in IDEs
- Type-safe placeholder replacements
- Strict mode compatible
- Exported types for custom implementations
π§ͺ Testing
- Comprehensive test suite with Jest
- React Testing Library integration
- 100% code coverage
- Mock Inertia.js integration
- Example test patterns
π¦ Package Configuration
- ESM-only distribution (modern bundlers)
- Tree-shakeable exports
- Separate entry points for hook and Vite plugin
- Proper peer dependencies
- Side-effect free
π§ Build System
- Built with tsup for optimal bundling
- Source maps for debugging
- Minified production builds
- Declaration files included
οΏ½ Documentation
- Complete README with examples
- API reference
- Setup guide
- Integration examples
- TypeScript usage patterns
π Dependencies
- React 18 or 19 (peer dependency)
- Inertia.js v1 or v2 (peer dependency)
- Vite 5+ (peer dependency for plugin)
minimatchfor pattern matching in Vite plugin
β‘ Performance
- Memoized translation lookups
- Cached locale data
- Optimized re-renders
- Lazy evaluation
π¨ Developer Experience
- Hot module replacement in development
- Automatic regeneration on file changes
- Clear error messages
- Debug mode for troubleshooting
π Requirements
- Node.js 16+
- React 18+
- Inertia.js v1 or v2
- Laravel Localizer backend package