PHPackages                             cakephp/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. [Framework](/categories/framework)
4. /
5. cakephp/i18n

ActiveLibrary[Framework](/categories/framework)

cakephp/i18n
============

CakePHP Internationalization library with support for messages translation and dates and numbers localization

5.3.3(2mo ago)28155.8k—1.1%418MITPHPPHP &gt;=8.2

Since Feb 5Pushed 2mo ago26 watchersCompare

[ Source](https://github.com/cakephp/i18n)[ Packagist](https://packagist.org/packages/cakephp/i18n)[ Docs](https://cakephp.org)[ RSS](/packages/cakephp-i18n/feed)WikiDiscussions 5.x Synced 1mo ago

READMEChangelogDependencies (4)Versions (337)Used By (18)

[![Total Downloads](https://camo.githubusercontent.com/83eda6d77a63a854cf10eff96bf5695711ec48f00deaa590ebaa14c41a09efc4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63616b657068702f6931386e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cakephp/i18n)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

CakePHP Internationalization Library
====================================

[](#cakephp-internationalization-library)

The I18n library provides a `I18n` service locator that can be used for setting the current locale, building translation bundles and translating messages.

Additionally, it provides the `Time` and `Number` classes which can be used to output dates, currencies and any numbers in the right format for the specified locale.

Usage
-----

[](#usage)

Internally, the `I18n` class uses [Aura.Intl](https://github.com/auraphp/Aura.Intl). Getting familiar with it will help you understand how to build and manipulate translation bundles, should you wish to create them manually instead of using the conventions this library uses.

### Setting the Current Locale

[](#setting-the-current-locale)

```
use Cake\I18n\I18n;

I18n::setLocale('en_US');
```

### Setting path to folder containing po files.

[](#setting-path-to-folder-containing-po-files)

```
use Cake\Core\Configure;

Configure::write('App.paths.locales', ['/path/with/trailing/slash/']);
```

Please refer to the [CakePHP Manual](https://book.cakephp.org/5/en/core-libraries/internationalization-and-localization.html#language-files) for details about expected folder structure and file naming.

### Translating a Message

[](#translating-a-message)

```
echo __(
    'Hi {0,string}, your balance on the {1,date} is {2,number,currency}',
    ['Charles', '2014-01-13 11:12:00', 1354.37]
);

// Returns
Hi Charles, your balance on the Jan 13, 2014, 11:12 AM is $ 1,354.37
```

### Creating Your Own Translators

[](#creating-your-own-translators)

```
use Cake\I18n\I18n;
use Cake\I18n\Package;

I18n::translator('animals', 'fr_FR', function () {
    $package = new Package(
        'default', // The formatting strategy (ICU)
        'default', // The fallback domain
    );
    $package->setMessages([
        'Dog' => 'Chien',
        'Cat' => 'Chat',
        'Bird' => 'Oiseau'
        ...
    ]);

    return $package;
});

I18n::getLocale('fr_FR');
__d('animals', 'Dog'); // Returns "Chien"
```

### Formatting Time

[](#formatting-time)

```
$time = Time::now();
echo $time; // shows '4/20/14, 10:10 PM' for the en-US locale
```

### Formatting Numbers

[](#formatting-numbers)

```
echo Number::format(100100100);
```

```
echo Number::currency(123456.7890, 'EUR');
// outputs €123,456.79
```

Documentation
-------------

[](#documentation)

Please make sure you check the [official I18n documentation](https://book.cakephp.org/5/en/core-libraries/internationalization-and-localization.html).

The [documentation for the Time class](https://book.cakephp.org/5/en/core-libraries/time.html) contains instructions on how to configure and output time strings for selected locales.

The [documentation for the Number class](https://book.cakephp.org/5/en/core-libraries/number.html) shows how to use the `Number` class for displaying numbers in specific locales.

###  Health Score

69

—

FairBetter than 100% of packages

Maintenance87

Actively maintained with recent releases

Popularity44

Moderate usage in the ecosystem

Community38

Small or concentrated contributor base

Maturity95

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

331

Last Release

62d ago

Major Versions

4.5.3 → 5.0.42023-12-26

4.5.5 → 5.0.82024-03-26

4.5.10 → 5.1.22024-10-10

4.6.0 → 5.2.02025-01-20

5.x-dev → 6.x-dev2026-03-18

PHP version history (7 changes)3.4.9PHP &gt;=5.6.0

4.0.0-beta1PHP &gt;=7.2.0

3.9.6PHP &gt;=5.6.0,&lt;8.0.0

4.4.0PHP &gt;=7.4.0

5.0.0-beta1PHP &gt;=8.1

5.3.0-RC1PHP &gt;=8.2

6.x-devPHP &gt;=8.4

### Community

Maintainers

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

---

Top Contributors

[![ADmad](https://avatars.githubusercontent.com/u/142658?v=4)](https://github.com/ADmad "ADmad (305 commits)")[![markstory](https://avatars.githubusercontent.com/u/24086?v=4)](https://github.com/markstory "markstory (267 commits)")[![lorenzo](https://avatars.githubusercontent.com/u/37621?v=4)](https://github.com/lorenzo "lorenzo (117 commits)")[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (104 commits)")[![othercorey](https://avatars.githubusercontent.com/u/24221186?v=4)](https://github.com/othercorey "othercorey (104 commits)")[![antograssiot](https://avatars.githubusercontent.com/u/4977112?v=4)](https://github.com/antograssiot "antograssiot (26 commits)")[![ravage84](https://avatars.githubusercontent.com/u/625761?v=4)](https://github.com/ravage84 "ravage84 (19 commits)")[![LordSimal](https://avatars.githubusercontent.com/u/9105243?v=4)](https://github.com/LordSimal "LordSimal (14 commits)")[![bcrowe](https://avatars.githubusercontent.com/u/752603?v=4)](https://github.com/bcrowe "bcrowe (12 commits)")[![Theaxiom](https://avatars.githubusercontent.com/u/57013?v=4)](https://github.com/Theaxiom "Theaxiom (10 commits)")[![Zuluru](https://avatars.githubusercontent.com/u/514172?v=4)](https://github.com/Zuluru "Zuluru (10 commits)")[![burzum](https://avatars.githubusercontent.com/u/162789?v=4)](https://github.com/burzum "burzum (9 commits)")[![ritesh-pandey](https://avatars.githubusercontent.com/u/1433681?v=4)](https://github.com/ritesh-pandey "ritesh-pandey (8 commits)")[![andrej-griniuk](https://avatars.githubusercontent.com/u/2722793?v=4)](https://github.com/andrej-griniuk "andrej-griniuk (7 commits)")[![AD7six](https://avatars.githubusercontent.com/u/33387?v=4)](https://github.com/AD7six "AD7six (6 commits)")[![Schlaefer](https://avatars.githubusercontent.com/u/143224?v=4)](https://github.com/Schlaefer "Schlaefer (6 commits)")[![bancer](https://avatars.githubusercontent.com/u/3830106?v=4)](https://github.com/bancer "bancer (5 commits)")[![Harfusha](https://avatars.githubusercontent.com/u/47174548?v=4)](https://github.com/Harfusha "Harfusha (5 commits)")[![segy](https://avatars.githubusercontent.com/u/1355459?v=4)](https://github.com/segy "segy (4 commits)")[![CauanCabral](https://avatars.githubusercontent.com/u/83092?v=4)](https://github.com/CauanCabral "CauanCabral (3 commits)")

---

Tags

localizationinternationalizationi18ntranslationcakephpdatenumberinternationalisationlocalisation

### Embed Badge

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

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

###  Alternatives

[tractorcow/silverstripe-fluent

Simple localisation for Silverstripe

92421.6k26](/packages/tractorcow-silverstripe-fluent)[laravel-lang/publisher

Localization publisher for your Laravel application

2167.7M24](/packages/laravel-lang-publisher)[cakephp/database

Flexible and powerful Database abstraction library with a familiar PDO-like API

9824.6M33](/packages/cakephp-database)[laravel-lang/common

Easily connect the necessary language packs to the application

1463.1M22](/packages/laravel-lang-common)[punic/punic

PHP-Unicode CLDR

1542.9M29](/packages/punic-punic)[yiisoft/translator

Yii Message Translator

26472.6k16](/packages/yiisoft-translator)

PHPackages © 2026

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