PHPackages                             m1sh0u/laravel-polyglot-translator - 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. m1sh0u/laravel-polyglot-translator

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

m1sh0u/laravel-polyglot-translator
==================================

Polyglot.php translator for Laravel

v1.1(5y ago)12MITPHP

Since May 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/M1Sh0u/laravel-polyglot-translator)[ Packagist](https://packagist.org/packages/m1sh0u/laravel-polyglot-translator)[ Docs](https://github.com/m1sh0u/laravel-polyglot-translator)[ RSS](/packages/m1sh0u-laravel-polyglot-translator/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Laravel Polyglot.php Translator
===============================

[](#laravel-polyglotphp-translator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3c03809e4845f6a15f9c606c9d20f9ce840d3e1fb58202c5de11c429992999d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d31736830752f6c61726176656c2d706f6c79676c6f742d7472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/m1sh0u/laravel-polyglot-translator)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Code Quality](https://camo.githubusercontent.com/3336d9b27145fa605e0ba4467a05f5427d166305a237153ede82bb6b16a42069/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d31536830752f6c61726176656c2d706f6c79676c6f742d7472616e736c61746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572267374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/M1Sh0u/laravel-polyglot-translator/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/10cfcdc8361f82a8dca3a50655066d396d2dd25ddce634369067ba8841f40469/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d31736830752f6c61726176656c2d706f6c79676c6f742d7472616e736c61746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/m1sh0u/laravel-polyglot-translator)

Installing this package will enable using [Polyglot.php](https://github.com/M1Sh0u/polyglot.php) to translate phrases through a Laravel application.

When installed, the `trans` and `trans_choice` will use the `Polyglot.php` library to translate the given phrases:

```
trans('Hello, %{placeholder}', ['placeholder' => 'World']);
trans('1 vote %{period} |||| %{smart_count} votes %{period}', ['smart_count' => 4, 'period' => 'today'])

trans_choice('1 vote %{period} |||| %{smart_count} votes %{period}', 4, ['period' => 'today']);
```

### Installation

[](#installation)

You can install the package via composer:

```
composer require m1sh0u/laravel-polyglot-translator

```

In `config/app.php` (Laravel) or `bootstrap/app.php` (Lumen) you should replace Laravel's translation service provider,

```
Illuminate\Translation\TranslationServiceProvider::class,

```

by the one included in this package:

```
LaravelPolyglot\Providers\TranslationServiceProvider

```

Optionally you could publish the config file using the command:

```
php artisan vendor:publish --provider="LaravelPolyglot\Providers\TranslationServiceProvider" --tag="config"

```

This is the contents of the published config file:

```
return [
    // @see https://github.com/M1Sh0u/polyglot.php for the meaning of each polyglot configuration parameter
    'polyglot' => [

        'allowMissing' => true,
        'delimiter' => '||||',
        'interpolation' => [
            'prefix' => '%{',
            'suffix' => '}'
        ],
        'pluralRules' => [],

        // Set a callback function to be called whenever a missing key is found.
        // It could be useful if you need to store the missing keys into the database or to do something else.
        // Please note that the return of this callback will be the actual string returned by the translator. @see https://github.com/M1Sh0u/polyglot.php
        'onMissingKey' => null,
        'onMissingKeyEnvs' => ['local', 'staging']
    ]
];
```

> Note: publishing assets doesn't work out of the box in Lumen. Instead you have to copy the files from the repo.

### Usage

[](#usage)

For more information about Polyglot.php' capabilities please follow its [documentation](https://github.com/M1Sh0u/polyglot.php)

### License

[](#license)

The MIT License (MIT). Please see License File for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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 ~3 days

Total

2

Last Release

2172d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e193a0831f8a49b4fa04eba02a6fd28224a5347fbf2603668c9f30eed1f85f4?d=identicon)[M1Sh0u](/maintainers/M1Sh0u)

---

Top Contributors

[![M1Sh0u](https://avatars.githubusercontent.com/u/3706005?v=4)](https://github.com/M1Sh0u "M1Sh0u (2 commits)")

---

Tags

laraveli18nlanguagetranslatorpolyglot

### Embed Badge

![Health badge](/badges/m1sh0u-laravel-polyglot-translator/health.svg)

```
[![Health](https://phpackages.com/badges/m1sh0u-laravel-polyglot-translator/health.svg)](https://phpackages.com/packages/m1sh0u-laravel-polyglot-translator)
```

###  Alternatives

[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.6M17](/packages/barryvdh-laravel-translation-manager)[vluzrmos/language-detector

Detect the language for your application using browser preferences, subdomains or route prefixes.

109554.8k3](/packages/vluzrmos-language-detector)[badinansoft/nova-language-switch

A Laravel Nova package to switch language in your application

26506.4k1](/packages/badinansoft-nova-language-switch)[jrmajor/fluent

Fluent localization system for PHP

2716.9k5](/packages/jrmajor-fluent)[highsolutions/laravel-translation-manager

Manage Laravel Translations

1518.8k](/packages/highsolutions-laravel-translation-manager)[jrmajor/laravel-fluent

Fluent translations for Laravel

208.4k](/packages/jrmajor-laravel-fluent)

PHPackages © 2026

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