PHPackages                             alecscodes/inertia-i18n - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. alecscodes/inertia-i18n

ActiveLibrary[Localization &amp; i18n](/categories/localization)

alecscodes/inertia-i18n
=======================

Minimal i18n for Laravel Inertia — share PHP and JSON translations with t() and tc() on the frontend

v0.1.0(3mo ago)01↓90.9%MITPHPPHP ^8.2CI passing

Since Mar 31Pushed 3mo agoCompare

[ Source](https://github.com/alecscodes/inertia-i18n)[ Packagist](https://packagist.org/packages/alecscodes/inertia-i18n)[ RSS](/packages/alecscodes-inertia-i18n/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

🌍 inertia-i18n
==============

[](#-inertia-i18n)

[![Latest Version on Packagist](https://camo.githubusercontent.com/925592b7c76b442aa68307318433559a65e28f8aa62f513782e7c603f92d1975/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c656373636f6465732f696e65727469612d6931386e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alecscodes/inertia-i18n)[![Total Downloads](https://camo.githubusercontent.com/66f0ccbda290e7271557e1ebaf7a9656474133da2039dcaab781000c39d36d62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c656373636f6465732f696e65727469612d6931386e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alecscodes/inertia-i18n)[![License](https://camo.githubusercontent.com/3d8e88a9ff1e0da28ea6a19869fda535315b6ff54a1032d0de0cb043ef429eec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616c656373636f6465732f696e65727469612d6931386e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Minimal i18n bridge for **Laravel + Inertia.js** — share your PHP and JSON translation files with the frontend.

Requirements
------------

[](#requirements)

- PHP `^8.2`
- Laravel `^10.0 || ^11.0 || ^12.0 || ^13.0`
- Inertia Laravel `^2.0 || ^3.0`

Install
-------

[](#install)

```
composer require alecscodes/inertia-i18n
```

Publish
-------

[](#publish)

```
php artisan vendor:publish --tag=inertia-i18n-js
php artisan vendor:publish --tag=inertia-i18n-config
```

Configure
---------

[](#configure)

In `config/inertia-i18n.php`, set `shared` to only the groups used on every page (e.g. `common`, `nav`) and load everything else per-page with `->withTranslations()`.

```
'shared' => ['common', 'nav'];
```

You can also use `['*']` in `config/inertia-i18n.php` to load all translation files on every page. This is a convenient quickstart for small apps (no need to touch each controller), but it can become heavy if you have a lot of translations.

```
'shared' => ['*'],
```

Frontend
--------

[](#frontend)

```
import { useTranslation } from '@/vendor/inertia-i18n/useTranslation';

const page = /* get the Inertia page object from your adapter */
const { t, tc, locale } = useTranslation(page.props);

t('settings.two_factor.title') // Two-factor authentication
```

Backend
-------

[](#backend)

When using `['*']` in the config to load all translations globally, the `->withTranslations()` calls are not required.

```
return Inertia::render('Dashboard')
    ->withTranslations('dashboard', 'widgets');
```

Localization
------------

[](#localization)

Translation files are loaded from:

- `lang/{locale}/**/*.php`
- `lang/{locale}/**/*.json`
    (subdirectories are supported)

Language switching can be implemented using any method you prefer (e.g., route parameters, session, cookies, etc.).

Set the locale before rendering the Inertia response:

```
app()->setLocale($locale);
```

---

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [LICENSE.md](LICENSE.md) for more information.

---

Made with ♥ for the Laravel community

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance82

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1abeff4065d677f1cc9b1cbd9f279517864988bfbfc73153f2a8380894150df3?d=identicon)[alecscodes](/maintainers/alecscodes)

---

Tags

laravellocalizationi18ntranslationsinertia

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/alecscodes-inertia-i18n/health.svg)

```
[![Health](https://phpackages.com/badges/alecscodes-inertia-i18n/health.svg)](https://phpackages.com/packages/alecscodes-inertia-i18n)
```

###  Alternatives

[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4821.5k](/packages/erag-laravel-lang-sync-inertia)[outhebox/laravel-translations

Manage your Laravel translations with a beautiful UI. Add, edit, delete, import, and export translations with ease.

81396.3k](/packages/outhebox-laravel-translations)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[moonshine/moonshine

Laravel administration panel

1.3k239.9k76](/packages/moonshine-moonshine)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90128.1k](/packages/emargareten-inertia-modal)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
