PHPackages                             nativecodein/laravel-translation-scanner - 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. [Templating &amp; Views](/categories/templating)
4. /
5. nativecodein/laravel-translation-scanner

ActiveLibrary[Templating &amp; Views](/categories/templating)

nativecodein/laravel-translation-scanner
========================================

Laravel translation scanner that auto-extracts \_\_(), trans() and t() strings from PHP, Blade, and Inertia React (JS/TS/JSX/TSX) files into resources/lang/en.json. Supports Laravel 10, 11, 12 and 13.

v1.2.0(2w ago)15MITPHPPHP ^8.2

Since May 20Pushed 2w agoCompare

[ Source](https://github.com/nativecodein/laravel-translation-scanner)[ Packagist](https://packagist.org/packages/nativecodein/laravel-translation-scanner)[ Docs](https://github.com/nativecodein/laravel-translation-scanner)[ RSS](/packages/nativecodein-laravel-translation-scanner/feed)WikiDiscussions main Synced 1w ago

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

Laravel Translation Scanner
===========================

[](#laravel-translation-scanner)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bbdcd792e415c0beeb6eec0aeb1fad6361d972c810473f24d18b4a9e3119ec27/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6174697665636f6465696e2f6c61726176656c2d7472616e736c6174696f6e2d7363616e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nativecodein/laravel-translation-scanner)[![Total Downloads](https://camo.githubusercontent.com/c08ac50d9f72add3abe3a8151674e3c80c8fd52a5eb278e4b778e8102fd65eb5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6174697665636f6465696e2f6c61726176656c2d7472616e736c6174696f6e2d7363616e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nativecodein/laravel-translation-scanner)[![License: MIT](https://camo.githubusercontent.com/1b01ef0024ba0866c115986b895301f657c1b21fc29f05c4844b7f2e8d89204d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e7376673f7374796c653d666c61742d737175617265)](LICENSE)

**Laravel Translation Scanner** is a zero-config Laravel package that scans your entire project — **PHP, Blade, and Inertia React (JS / TS / JSX / TSX)** files — and automatically appends every missing translation string to `resources/lang/en.json`.

Stop manually copy-pasting strings into your language files. Run one Artisan command and ship i18n-ready Laravel apps in seconds.

> Works seamlessly with **Laravel + Inertia.js + React**, **Blade**, and pure PHP controllers. Supports Laravel **10, 11, 12, and 13**.

---

Why Laravel Translation Scanner?
--------------------------------

[](#why-laravel-translation-scanner)

- **Automatic discovery** — finds every `__()`, `trans()`, and `t()` call across your codebase
- **Inertia React aware** — scans `.js`, `.ts`, `.jsx`, and `.tsx` files for `t("...")`, `t(\`...`)`, and `t(variable)` usage
- **Local-variable resolution** — resolves `const title = "Settings"; t(title)` and adds `Settings`
- **Auto translation support** — generate translated JSON language files instantly
- **Bulk translate support** — translate multiple locales in one command
- **Provider fallback system** — automatically switches between translation providers
- **Rate-limit protection** — built-in delay handling to reduce API blocking
- **Non-destructive** — only appends missing keys; never overwrites your existing translations
- **Sorted output** — keys are alphabetically sorted in `en.json` for clean diffs
- **Smart exclusions** — skips `vendor/`, `node_modules/`, `bootstrap/`, `storage/`, `tests/`, and other noise
- **Zero configuration** — install and run

---

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

[](#installation)

Install via [Composer](https://getcomposer.org):

```
composer require nativecodein/laravel-translation-scanner
```

The service provider is auto-discovered. No further setup required.

---

Scan Translations
=================

[](#scan-translations)

Run the scanner from your Laravel project root:

```
php artisan translations:scan
```

The command will:

1. Read existing `resources/lang/en.json` (or create it if missing).
2. Recursively scan your project for translatable strings.
3. Append any missing keys with the key as the default value.
4. Save the sorted `en.json` back to disk.

---

Auto Translate Language Files
=============================

[](#auto-translate-language-files)

Generate translated language JSON files automatically:

```
php artisan translations:translate ta
```

Example generated file:

```
resources/lang/ta.json
```

---

Bulk Translate
==============

[](#bulk-translate)

Translate multiple languages in one command:

```
php artisan translations:translate ta ar ro
```

Generated:

```
resources/lang/ta.json
resources/lang/ar.json
resources/lang/ro.json
```

---

Translation Providers
=====================

[](#translation-providers)

The package automatically falls back between:

```
Google Translate
LibreTranslate
Lingva Translate
```

If one provider fails, the next provider is used automatically.

---

Rate Limit Protection
=====================

[](#rate-limit-protection)

Built-in API protection:

```
usleep(300000);
```

This helps reduce temporary API blocking from free translation services.

---

Supported Translation Patterns
------------------------------

[](#supported-translation-patterns)

### PHP / Blade

[](#php--blade)

```
{{ __('Dashboard') }}

{{ __('Plugins') }}

return trans('Welcome Back');
```

### Inertia React / JS / TS / JSX / TSX

[](#inertia-react--js--ts--jsx--tsx)

```
t("Login");

t("Register");

t(`Dashboard`);
```

### Local Variable Resolution

[](#local-variable-resolution)

```
const title = "Settings";

t(title);
```

---

Example Output
--------------

[](#example-output)

After running `php artisan translations:scan`, your `resources/lang/en.json`:

```
{
  "Dashboard": "Dashboard",
  "Login": "Login",
  "Plugins": "Plugins",
  "Register": "Register",
  "Settings": "Settings",
  "Welcome Back": "Welcome Back"
}
```

Console output:

```
Added: Dashboard
Added: Plugins
Added: Welcome Back
Added: Login
Added: Settings
Translation scan completed.
```

---

Supported File Types
--------------------

[](#supported-file-types)

ExtensionScans For`.php``__('...')`, `trans('...')``.blade.php``__('...')`, `trans('...')``.js``t('...')`, `t(\`...`)`, `t(variable)``.ts``t('...')`, `t(\`...`)`, `t(variable)``.jsx``t('...')`, `t(\`...`)`, `t(variable)``.tsx``t('...')`, `t(\`...`)`, `t(variable)`---

Excluded Folders
----------------

[](#excluded-folders)

The scanner automatically skips these directories:

```
bootstrap/
config/
database/
routes/
storage/
tests/
vendor/
node_modules/
```

---

Supported Laravel Versions
--------------------------

[](#supported-laravel-versions)

LaravelStatus10.xSupported11.xSupported12.xSupported13.xSupported---

Updating
--------

[](#updating)

```
composer update nativecodein/laravel-translation-scanner
```

Then re-run:

```
php artisan translations:scan

php artisan translations:translate ta ar ro
```

---

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

---

Security
--------

[](#security)

If you discover any security-related issues, please email **** instead of using the public issue tracker.

---

Support
-------

[](#support)

- Issues:
- Email: ****

---

License
-------

[](#license)

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

Copyright © NativeCode.

---

 Contributed by [**NativeCode**](https://nativecode.in)

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance96

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

4

Last Release

20d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e03b544ea991ef6b77ad20073cc179154eee019e45dbc97216ac94e063bc8124?d=identicon)[nativecodein](/maintainers/nativecodein)

---

Top Contributors

[![iamkbkarthikeyan](https://avatars.githubusercontent.com/u/39895890?v=4)](https://github.com/iamkbkarthikeyan "iamkbkarthikeyan (5 commits)")

---

Tags

auto-translateauto-translation-scanneren-jsoninternationalizationlaravel-translation-scannerlocalizationphplaravellocalizationinternationalizationi18ntranslationslanguagel10ntranslationlaravel-packagebladeinertialangreactinertiajsauto-translatemissing translationstranslation-generatortranslation-extractortranslation-scanneren.json

### Embed Badge

![Health badge](/badges/nativecodein-laravel-translation-scanner/health.svg)

```
[![Health](https://phpackages.com/badges/nativecodein-laravel-translation-scanner/health.svg)](https://phpackages.com/packages/nativecodein-laravel-translation-scanner)
```

###  Alternatives

[laravel-lang/publisher

Localization publisher for your Laravel application

2168.5M45](/packages/laravel-lang-publisher)[gettext/languages

gettext languages with plural rules

7532.0M12](/packages/gettext-languages)[laravel-lang/common

Easily connect the necessary language packs to the application

1563.6M32](/packages/laravel-lang-common)[outhebox/laravel-translations

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

81096.3k](/packages/outhebox-laravel-translations)[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.

4721.5k](/packages/erag-laravel-lang-sync-inertia)[punic/punic

PHP-Unicode CLDR

1573.0M30](/packages/punic-punic)

PHPackages © 2026

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