PHPackages                             skysplit/laravel5-intl-translation - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. skysplit/laravel5-intl-translation

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

skysplit/laravel5-intl-translation
==================================

Laravel 5 package for better translation syntax using php-intl extension

4.1(5y ago)10106.2k7[1 PRs](https://github.com/Skysplit/laravel5-intl-translation/pulls)MITPHPPHP &gt;=7.4.0

Since Jun 11Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Skysplit/laravel5-intl-translation)[ Packagist](https://packagist.org/packages/skysplit/laravel5-intl-translation)[ RSS](/packages/skysplit-laravel5-intl-translation/feed)WikiDiscussions 2.0 Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (22)Used By (0)

Laravel Intl Translator
=======================

[](#laravel-intl-translator)

[![Build Status](https://camo.githubusercontent.com/1c336451a465a26f345194bfc4bf423911be74db10bdda8318cb20745315d472/68747470733a2f2f7472617669732d63692e6f72672f536b7973706c69742f6c61726176656c352d696e746c2d7472616e736c6174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Skysplit/laravel5-intl-translation)[![Latest Stable Version](https://camo.githubusercontent.com/433a40e7043678564ec4596eecf862f32710c63ba6b0fdbe70dbcfded4389ee9/68747470733a2f2f706f7365722e707567782e6f72672f736b7973706c69742f6c61726176656c352d696e746c2d7472616e736c6174696f6e2f762f737461626c65)](https://packagist.org/packages/skysplit/laravel5-intl-translation)[![Latest Unstable Version](https://camo.githubusercontent.com/6d649d11a82fe4fc25290d9d9814155c9b2aebe1904d3a28f81cfda30a5e40e7/68747470733a2f2f706f7365722e707567782e6f72672f736b7973706c69742f6c61726176656c352d696e746c2d7472616e736c6174696f6e2f762f756e737461626c65)](https://packagist.org/packages/skysplit/laravel5-intl-translation)

- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
    - [Publishing config and language files](#publishing-config-and-language-files)
        - [Currently adapted locales](#currently-adapted-locales)
- [Usage examples](#usage-examples)
    - [Placeholders](#placeholders)
    - [Select](#select)
    - [Plurals](#plurals)
        - [Plural offset](#plural-offset)
- [Formatting in details](#formatting-in-details)

Introduction
============

[](#introduction)

**Laravel Intl Translator** uses php-intl extension to provide translation for your application.

Please mind that this package **breaks framework default behaviour for validators**.

Due to `MessageFormatter::formatMessage` method, `Validator::replacer` method should return **array of parameters as *key-value* pair**, instead replacing placeholders in message.

Besides that `app('translator')->get($key)` always returns message in raw format (unparsed). Translated messages are returned by:

```
app('translator')->trans($key)
app('translator')->formatMessage($locale, $message, $params)
```

Requirements
============

[](#requirements)

- Laravel **6**
- php-intl extension installed

Please feel free to contribute to this package for other Laravel versions support!

Installation
============

[](#installation)

If you do not have **php-intl** extension you can install it by following command (Ubuntu, Debian)

```
$ sudo apt-get install php-intl
```

If you have other OS, you can use it's respective package manager

All versions
------------

[](#all-versions)

In your `config/app.php` providers
Remove line

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

And add line:

```
Skysplit\Laravel\Translation\TranslationServiceProvider::class,
Skysplit\Laravel\Translation\ValidationServiceProvider::class,
```

Publishing config and language files
------------------------------------

[](#publishing-config-and-language-files)

> Be careful! This will override your existing `resources/lang/{lang}` files! Check **Currently adapted locales** table to see which files could be overriden.

```
php artisan vendor:publish --provider="Skysplit\Laravel\Translation\TranslationServiceProvider" --force
```

If you would like to publish only config

```
php artisan vendor:publish --provider="Skysplit\Laravel\Translation\TranslationServiceProvider" --tag=config
```

If you would like to publish only one language files set

```
php artisan vendor:publish --provider="Skysplit\Laravel\Translation\TranslationServiceProvider" --force --tag="lang.{locale}[,lang.{other_locale}]"
```

---

### Currently adapted locales

[](#currently-adapted-locales)

LocalePublished files**en**`auth.php`, `validation.php`**pl**`auth.php`, `pagination.php`, `passwords.php`, `validation.php`Usage examples
==============

[](#usage-examples)

Both `trans()` and `trans_choice()` helper functions use this translator, so the only thing you have to change is your language files.

For detailed documentation please visit php's [MessageFormatter](http://php.net/manual/en/class.messageformatter.php) docs and links related there

Placeholders
------------

[](#placeholders)

`app/resources/lang/en/custom.php`

```
return [
	'placeholder' => 'Hello there, {username}!'
]
```

`view.blade.php`

```
{{ trans('custom.placeholder', ['username' => 'Jane']); }}
```

Returns

```
Hello there, Jane!

```

Select
------

[](#select)

`app/resources/lang/en/custom.php`

```
return [
	'select' => '{gender, select, male{He} female{She} other{It}} has two legs and is {gender}!'
]
```

`view.blade.php`

```
{{ trans('custom.select', ['gender' => 'male']); }}
{{ trans('custom.select', ['gender' => 'female']); }}
{{ trans('custom.select', ['gender' => 'penguin']); }}
```

Returns

```
He has two legs and is male!
She has two legs and is female!
It has two legs and is penguin!

```

Plurals
-------

[](#plurals)

`app/resources/lang/en/custom.php`

```
return [
	'plural' => 'Jon has {n, plural, =0{no apples} one{# apple} other{# apples}}'
]
```

`view.blade.php`

```
{{ trans_choice('custom.plural', 0); }}
{{ trans_choice('custom.plural', 1); }}
{{ trans_choice('custom.plural', 2); }}
```

Returns

```
Jon has no apples
Jon has 1 apples
Jon has 2 apples

```

Instead of `trans_choice()` you can you use `trans()` helper as well.

`resources/lang/en/custom.php`

```
return [
	'custom.plural' => 'Jon has {0, plural, =0{no apples} one{# apple} other{# apples}}, {grapes, plural, =0{no grapes} one{# grape} other{# grapes} and {oranges, plural, =0{no oranges} one{# orange} other{# oranges}}'
];

```

`view.blade.php`

```
{{ trans('custom.plural', [3, 'grapes' => 1, 'oranges' => 0]) }}
```

Returns

```
Jon has 3 apples, 1 grape and no oranges

```

---

As you can see, the only thing `trans_choice()` do is passing first argument as `n` parameter to `trans()` helper.

### Plural offset

[](#plural-offset)

You can set offset for your plural rules. Consider this example:

```
You {n, plural, offset:1 =0{do not like this yet} =1{liked this} one{and one other person liked this} other{and # others liked this}}

```

Result:

```
You do not like this yet // n = 0
You liked this // n = 1
You and one other person liked this // n = 2
You and 2 others liked this // n = 3
You and 3 others liked this // n = 4

```

---

Plural rule are often very complex for languages. Intl does handle it for you.
For example in Polish `few` rule is applied when `n % 10 = 2..4 and n % 100 != 12..14`, while `many` rule is applied when `n != 1 and n % 10 = 0..1` or `n % 10 = 5..9` or `n % 100 = 12..14`.
In Serbian `=1` will match when `n = 1`, but `one` will apply when `n = 1, 21, 31, 41` etc.

> Remember! You **always** have to provide `other` rule for plural translations.

For more details about pluralization please visit [CLDR Plural Rules](http://cldr.unicode.org/index/cldr-spec/plural-rules) specificaton and [CLDR Language plural rules](http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html).

Formatting in details
=====================

[](#formatting-in-details)

PHP's MessageFormatter also supports **ordinal**, **spellout**, **number**, **date**, **time** and **duration** formatting.
For detailed information please visit this great [Yii2 Framework i18n Guide](http://www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html) which covers every **intl** topic wonderfully.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 54.9% 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 ~250 days

Recently: every ~403 days

Total

13

Last Release

568d ago

Major Versions

1.0.0 → 2.0.02016-09-01

2.0.1 → 3.0.0-rc12020-04-07

3.0.0 → 4.0.0-rc12020-04-23

2.0.x-dev → 4.2.1-beta2024-10-21

PHP version history (3 changes)3.0.0-rc1PHP &gt;=7.2.0

4.0.0-rc1PHP &gt;=7.4.0

4.2.1-betaPHP &gt;=7.4.0|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/62dd323cf0029c9a50efc74258300be1afbc49c7ea2c208e648813ee74512026?d=identicon)[skysplit](/maintainers/skysplit)

---

Top Contributors

[![Skysplit](https://avatars.githubusercontent.com/u/3975381?v=4)](https://github.com/Skysplit "Skysplit (28 commits)")[![duxthefux](https://avatars.githubusercontent.com/u/6758162?v=4)](https://github.com/duxthefux "duxthefux (22 commits)")[![kduszczy](https://avatars.githubusercontent.com/u/768116?v=4)](https://github.com/kduszczy "kduszczy (1 commits)")

---

Tags

laravelintlvalidationtranslation

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/skysplit-laravel5-intl-translation/health.svg)

```
[![Health](https://phpackages.com/badges/skysplit-laravel5-intl-translation/health.svg)](https://phpackages.com/packages/skysplit-laravel5-intl-translation)
```

###  Alternatives

[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)[galahad/laravel-addressing

Laravel package providing addressing functionality

70316.6k](/packages/galahad-laravel-addressing)

PHPackages © 2026

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