Skip to content
Getting Started

Introduction ​

Laravel Lang Sync Inertia is a lightweight, zero-latency bridge between Laravel's native backend translation ecosystem and Inertia.js frontend applications. It enables you to seamlessly use server-side PHP language files inside Vue, React, and Svelte components — with zero custom API endpoints, dynamic locale switching, and native SSR hydration.

Traditionally, localized Inertia applications face a frustrating dilemma: either manually pass translation arrays via Inertia::render() props on every controller, expose asynchronous REST endpoints that cause layout shifts (FOUC), or maintain duplicate translation files in JavaScript that constantly fall out of sync with Laravel's validation messages.

Laravel Lang Sync Inertia eliminates that friction completely by treating Laravel as your single source of truth and automatically delivering translation dictionaries directly through Inertia's shared page props.

The Localization Bridge ​

Inertia acts as the glue connecting Laravel with your modern frontend frameworks. Laravel Lang Sync Inertia is the complementary glue for your translations.

Instead of manually passing translation arrays in every controller, exposing custom REST endpoints, or duplicating translation files across PHP and JavaScript, this package seamlessly connects your existing language files to your client components.

🎯

Single Source of Truth

Manage all translations in standard Laravel lang/{locale} files. Never maintain duplicate dictionaries in JavaScript.

⚡

Zero API Overhead

Translations pass directly through Inertia's shared page props. No Axios calls, loading spinners, or runtime delays.

💬

Familiar Helper API

Use standard __() and trans() helpers in Vue, React, and Svelte with full placeholder support.

🚀

Full SSR Compatibility

Translations are pre-hydrated on the server, eliminating layout shifts and flashes of untranslated text (FOUC).

How It Works ​

The architecture follows a simple 4-step pipeline from your backend language files to your frontend components:

1

Define Language Files

Write standard Laravel translation files in lang/{locale}/app.php.

2

Sync in Controller

Call syncLangFiles() in controllers.

3

Inertia Prop Share

Translations are attached automatically to page.props.lang.

4

Render in Frontend

Use __() or trans() in Vue, React, or Svelte components.

Compatibility & Support ​

Laravel Lang Sync Inertia follows semantic versioning and actively supports modern Laravel and Inertia stacks:

Ecosystem / FrameworkSupported VersionsStatus
Laravel10.x, 11.x, 12.x, 13.x Active Support
Inertia.js1.x, 2.x, 3.x Active Support
Vue3.x (Composition & Options API) Active Support
React18.x, 19.x Active Support
Svelte4.x, 5.x Active Support
PHP8.1, 8.2, 8.3, 8.4+ Active Support

Next Steps ​

Ready to get started with Laravel Lang Sync Inertia? Follow the guides below:

MIT License © Er Amit Gupta