PHPackages                             codecng/laravel-inertia-translations - 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. codecng/laravel-inertia-translations

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

codecng/laravel-inertia-translations
====================================

Provides translations for an Inertia Based Project

1.2.1(3mo ago)4512MITPHPPHP ^8.3 || ^8.4 || ^8.5CI passing

Since Feb 13Pushed 2mo agoCompare

[ Source](https://github.com/codecng/laravel-inertia-translations)[ Packagist](https://packagist.org/packages/codecng/laravel-inertia-translations)[ Docs](https://github.com/codecng/laravel-inertia-translations)[ GitHub Sponsors](https://github.com/CodeCNG)[ RSS](/packages/codecng-laravel-inertia-translations/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (18)Versions (10)Used By (0)

Laravel Inertia Translations
============================

[](#laravel-inertia-translations)

[![Latest Version on Packagist](https://camo.githubusercontent.com/419992187174fddf6f1b942b15df872b3bb0c19d9122e288bd5657265a8e9c71/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6465636e672f6c61726176656c2d696e65727469612d7472616e736c6174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codecng/laravel-inertia-translations)[![Total Downloads](https://camo.githubusercontent.com/837d71efe3b865aebb1d9a9179ab5339d4226b08fb4c93b9268d3f208543ce5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6465636e672f6c61726176656c2d696e65727469612d7472616e736c6174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codecng/laravel-inertia-translations)

A zero-configuration Laravel package that automatically exports your Laravel translations for use with Inertia.js. Supports both React and Vue, with full TypeScript support!

Installation
------------

[](#installation)

```
composer require codecng/laravel-inertia-translations
```

That's it! No additional configuration needed.

Usage
-----

[](#usage)

Whenever you add or modify translations in your Laravel application, simply run:

```
php artisan translate
```

This command will:

1. Check if language files exist (if not, it will publish them automatically)
2. Process all your translation files (both JSON and PHP)
3. Generate JSON translation files in `resources/js/lang/`
4. Create appropriate utility files based on your stack (React/Vue + TypeScript)

### What Gets Processed

[](#what-gets-processed)

- ✅ JSON files in `lang/` directory
- ✅ PHP files in language subdirectories
- ✅ Automatically merges all translations by locale

### Generated Files Structure

[](#generated-files-structure)

```
resources/js/
├── lang/
│   ├── en.json
│   ├── es.json
│   └── fr.json
└── lib/
    └── translations.(js|ts|jsx|tsx)  # Based on your stack

```

Framework Support
-----------------

[](#framework-support)

### React

[](#react)

```
import { __ } from '@/lib/translations'

function Welcome() {
    return (

            {__('welcome.title')}
            {__('welcome.message')}
            {__('Users')}

    )
}
```

### Vue

[](#vue)

```

import { __ } from '@/lib/translations'

        {{ __('welcome.title') }}
        {{ __('welcome.message') }}

```

### Inertia Setup

[](#inertia-setup)

Make sure to include the current language in your Inertia shared props (in your HandleInertiaRequests middleware):

```
public function share(Request $request): array
{
    return array_merge(parent::share($request), [
        'language' => request()->user()->language ?? app()->getLocale(),
    ]);
}
```

Type Support
------------

[](#type-support)

When using TypeScript, you get full type support for your translation keys:

```
// The __ function is fully typed
__('welcome.title') // ✓ Valid
__('invalid.key')   // ✗ TypeScript error
```

Benefits
--------

[](#benefits)

- 🚀 Zero configuration required
- 🔄 Simple one-command updates
- 🛠 Works with both JSON and PHP translation files
- 💪 Full TypeScript support
- ⚡️ Supports both React and Vue
- 🔍 Automatic type generation for translation keys

Credits
-------

[](#credits)

- [Christian Negron](https://github.com/codecng)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance84

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 72.2% of commits — single point of failure

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

Every ~101 days

Total

5

Last Release

101d ago

PHP version history (2 changes)v1.0.0PHP ^8.3 || ^8.4

1.2.0PHP ^8.3 || ^8.4 || ^8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/198968601?v=4)[codecng](/maintainers/codecng)[@codecng](https://github.com/codecng)

---

Top Contributors

[![ChristianJoniel](https://avatars.githubusercontent.com/u/21225974?v=4)](https://github.com/ChristianJoniel "ChristianJoniel (39 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

laravelCodeCNGlaravel-inertia-translations

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/codecng-laravel-inertia-translations/health.svg)

```
[![Health](https://phpackages.com/badges/codecng-laravel-inertia-translations/health.svg)](https://phpackages.com/packages/codecng-laravel-inertia-translations)
```

###  Alternatives

[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.4k](/packages/typicms-base)[elegantly/laravel-translator

All on one translations management for Laravel

6333.1k](/packages/elegantly-laravel-translator)[slimani/filament-media-manager

A media manager plugin for Filament.

126.9k](/packages/slimani-filament-media-manager)[osama-98/laravel-enum-translatable

A Laravel package that provides translatable enum functionality with easy-to-use methods for working with enum values and their translations

561.2k](/packages/osama-98-laravel-enum-translatable)

PHPackages © 2026

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