erag / laravel-lang-sync-inertia
A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.
Package info
github.com/eramitgupta/laravel-lang-sync-inertia
pkg:composer/erag/laravel-lang-sync-inertia
Fund package maintenance!
Requires
- php: >=8.1.0
- illuminate/console: ^8.12|^9.0|^10.0|^11.0|^12.0|^13.0
- illuminate/filesystem: ^8.12|^9.0|^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^8.12|^9.0|^10.0|^11.0|^12.0|^13.0
- inertiajs/inertia-laravel: ^1.3|^2.0|^3.0
Requires (Dev)
- laravel/pint: ^1.13
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Laravel Lang Sync Inertia
About Laravel Lang Sync Inertia
Laravel Lang Sync Inertia is a lightweight package for sharing Laravel translation files with Inertia.js applications. It provides a simple way to make backend language files available inside Vue 3, React, and Svelte pages without manually passing translation props in every response.
Sponsor
This project is sponsored by SaaS Laravel, a Laravel 13 starter kit for multi-tenant SaaS apps. Every customer gets their own database, with sign-in, roles and permissions and 17 languages already built, for Vue, React, Svelte or Livewire.
If this package saves you time, a star on GitHub helps other developers find it.
Features
- đ Automatic translation sharing through Inertia.js shared props.
- đĻ Load single or multiple Laravel language files with
syncLangFiles(). - đī¸ Nested language directories via dot notation, e.g.
syncLangFiles('admin.users')â__('admin.users.name'). - đ§Š Dedicated Vue 3, React, and Svelte helpers from
@erag/lang-sync-inertia. - đ Use clean frontend helpers like
__(),trans(),transChoice(), andtrans_choice(). - ⨠Laravel-style placeholder replacement with
:namevalues. - đ§ą Legacy
{name}placeholder support for existing translation files. - đĸ Pluralization support with Laravel-style exact and interval choices.
- đ Locale-aware loading from
lang/{locale}using Laravel's current app locale. - đ¤ Export PHP language files to frontend-ready JSON with
php artisan erag:generate-lang. - âŠī¸ Direct string fallback when a translation key is not found.
- đ ī¸ Configurable language source and JSON output paths.
- â TypeScript-ready frontend helper package.
Documentation
Documentation for Laravel Lang Sync Inertia can be found at https://erag.in/laravel-lang-sync-inertia/.
Installation
Install the Laravel package using Composer:
composer require erag/laravel-lang-sync-inertia
Install the frontend helper package using npm:
npm install @erag/lang-sync-inertia
NPM package repository: https://github.com/eramitgupta/lang-sync-inertia
Contributing
Thank you for considering contributing to Laravel Lang Sync Inertia.
Support the Project â
If you find Laravel Lang Sync Inertia useful, please consider giving it a star on GitHub. It helps the project grow and reach more developers!
License
Laravel Lang Sync Inertia is open-sourced software licensed under the MIT license.