PHPackages                             gleads/yii18n - 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. gleads/yii18n

ActiveYii2-extension[Localization &amp; i18n](/categories/localization)

gleads/yii18n
=============

i18n for javascript files

0189PHP

Since Dec 20Pushed 8y agoCompare

[ Source](https://github.com/gleads/yii18n-js)[ Packagist](https://packagist.org/packages/gleads/yii18n)[ RSS](/packages/gleads-yii18n/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii18n Javascript
=================

[](#yii18n-javascript)

---

Requirements
------------

[](#requirements)

- PHP &gt;= 5.6.x
- Yii &gt;= 2.0.x

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

[](#installation)

Add in your composer.json file `"gleads/yii18n": "dev-master"`

Then run in your terminal: `composer update`

Usage
-----

[](#usage)

You must add the translator module in your config/web.php

```
    'modules' => [
        'translator' => [
            'class' => 'gleads\yii18n\TranslatorModule'
        ]
    ],
```

Add the class message source with class 'gleads\\yii18n\\PhpMessageSource'

```
    'components' => [
        'i18n' => [
            'translations' => [
                'app*' => [
                    'class' => 'gleads\yii18n\PhpMessageSource',  // Add This class
                    'fileMap' => [
                        'app' => 'app.php',
                        'app/error' => 'error.php',
                    ],
                ],
            ],
        ],
    ],

```

---

`note: you need set urlmanager > enablePrettyUrl as true`

in your view you must add the translator asset:

```
    gleads\yii18n\TranslatorAsset::register($this);
```

then it's already to use you can use like yii::t() style

in your js file:

```
    yii.t('category', 'message', 'params');
```

Todo
----

[](#todo)

- Remove sync request
- Add plural
- Add ordinal

---

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.3% 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.

### Community

Maintainers

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

---

Top Contributors

[![arthurfsilva](https://avatars.githubusercontent.com/u/66808811?v=4)](https://github.com/arthurfsilva "arthurfsilva (26 commits)")[![useername](https://avatars.githubusercontent.com/u/5609866?v=4)](https://github.com/useername "useername (1 commits)")

### Embed Badge

![Health badge](/badges/gleads-yii18n/health.svg)

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

###  Alternatives

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1926.6k1](/packages/smmoosavi-php-gettext)[laradevs/spanish

labels translated to spanish

166.7k](/packages/laradevs-spanish)

PHPackages © 2026

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