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 today

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 22% 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://www.gravatar.com/avatar/d4bbc2d45986a2e7147c4c0ecb9a7b269fd5b8158efa2094ed5665500aa3d553?d=identicon)[gleads](/maintainers/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

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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