PHPackages                             pavlinter/yii2-dot-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. [Localization &amp; i18n](/categories/localization)
4. /
5. pavlinter/yii2-dot-translation

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

pavlinter/yii2-dot-translation
==============================

Yii2: Component that translates short texts

v2.1.0(8y ago)356011BSD-3-ClausePHPPHP &gt;=5.4.0

Since Jan 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pavlinter/yii2-dot-translation)[ Packagist](https://packagist.org/packages/pavlinter/yii2-dot-translation)[ RSS](/packages/pavlinter-yii2-dot-translation/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (3)Versions (16)Used By (1)

Yii2 Dot Trasnlation
====================

[](#yii2-dot-trasnlation)

[![Screen Shot](https://github.com/pavlinter/yii2-dot-translation/raw/master/screenshot.png?raw=true)](https://github.com/pavlinter/yii2-dot-translation/blob/master/screenshot.png?raw=true)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist pavlinter/yii2-dot-translation "*"

```

or add

```
"pavlinter/yii2-dot-translation": "*"

```

to the require section of your `composer.json` file.

Configuration
-------------

[](#configuration)

- Run migration file

    ```
    yii migrate --migrationPath=@vendor/pavlinter/yii2-dot-translation/migrations
    ```
- Update config file

```
'bootstrap' => [
   'i18n',
   ...
],
'components' => [
    'i18n' => [
        'class'=>'pavlinter\translation\I18N',
        //'translations' => [
            //'myCategory' => [
                //'class' => 'pavlinter\translation\DbMessageSource',
                //'forceTranslation' => true,
                //'autoInsert' => true, //if message key doesn't exist in the database, message key will be created automatically
                //'dotMode' => null, //default state: show or hide dot
            //],
        //],
        //default settings

        //'dialog' => 'bs', //Bootstrap Modal Or jQuery Dialog (bs or jq)
        //'access' => 'dots-control',  //user permissions or function(){ return true || false; }
        //'nl2br' => true,
        //'dotClass' => 'dot-translation',
        //'dotSymbol' => '&bull;',
        //'nl2br' => true //nl2br filter text
        //languages table
        //'langTable' => '{{%languages}}', //string || null if table not exist
        //'langColCode' => 'code',
        //'langColLabel' => 'name',
        //'langColUpdatedAt' => 'updated_at', //string || null
        //'langWhere' => ['active' => 1], //$query->where(['active' => 1]);
        //'langOrder' => 'weight', //$query->orderBy('weight');

        //'enableCaching' => true, //for langTable cache
        //'durationCaching' => 0, //langTable cache
        //'router' => '/site/dot-translation', //'site' your controller
        //'langParam' => 'lang', // $_GET KEY
    ],
    ...
],
```

- Update controller

```
//SiteController.php
public function actions()
{
    return [
        'dot-translation' => [
            'class' => 'pavlinter\translation\TranslationAction',
            //'adminLink' => null;  //array|string|function
            //'htmlEncode' => true, //encode new message
            //'access' => null, //default Yii::$app->i18n->access
        ],
        ...
    ];
}
```

Usage
-----

[](#usage)

Change language:

```
/index.php?r=site/index&lang=ru
```

Example:

```
echo Yii::t('app', 'Hello world.'); used global settings

//individual adjustment
echo Yii::t('app', 'Hi {username}.', ['username' => 'Bob', 'dot' => true]); //enable dot

echo Yii::t('app', 'Hello world.', ['dot' => false , 'nl2br' => false]); //or 'br' => false //disable dot and disable nl2br filter

echo Html::submitInput(Yii::t('app', 'Submit', ['dot' => false])); //disable dot

echo Yii::$app->i18n->getPrevDot(); // show previous dot

// Or

echo Yii::t('app', 'Submit', ['dot' => '.']); //show only dot
```

```
Yii::$app->i18n->disableDot(); //force disable all dots

echo Yii::t('app', 'Submit'); //hidden dot
echo Yii::t('app', 'Submit', ['dot' => true]); //force enable dot

Yii::$app->i18n->resetDot(); //reset settings
Yii::$app->i18n->enableDot();//OR enable dot
```

```
//Add description variables to popup.
echo Yii::t('app', 'Count: ', ['dot' => true, 'var' => ['count' => 'Count email', 'owner']]);
```

```
//render languages
echo \yii\widgets\Menu::widget([
    'items' => Yii::$app->i18n->menuItems(),
    'encodeLabels' => false,
]);
```

```
//get array with current url
Yii::$app->i18n->getLanguages(true); //true|callable
/*
Array
(
    [1] => Array
    (
        [id] => 1
        [code] => en
        [name] => English
        [image] => /files/en.png
        [weight] => 130
        [active] => 1
        [updated_at] => 1424504802
        [url] => /en/site/index
    )
    ...
)
*/
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Recently: every ~140 days

Total

15

Last Release

2995d ago

Major Versions

v1.4.0 → 2.0.0-beta12016-08-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/aa81148f518734b069ef57f90038de857b4022a2a1b8d59a0f75ccada1747409?d=identicon)[pavlinter](/maintainers/pavlinter)

---

Top Contributors

[![pavlinter](https://avatars.githubusercontent.com/u/6838002?v=4)](https://github.com/pavlinter "pavlinter (126 commits)")

---

Tags

dottranslationyii2component

### Embed Badge

![Health badge](/badges/pavlinter-yii2-dot-translation/health.svg)

```
[![Health](https://phpackages.com/badges/pavlinter-yii2-dot-translation/health.svg)](https://phpackages.com/packages/pavlinter-yii2-dot-translation)
```

###  Alternatives

[uran1980/yii2-translate-panel

Yii2 Translate Panel makes the translation of your application awesome!

2518.3k1](/packages/uran1980-yii2-translate-panel)[yiimaker/yii2-translatable

Translatable behavior aggregates logic of linking translations to the primary model

1534.0k1](/packages/yiimaker-yii2-translatable)[geertw/yii2-translatable-url-rule

A custom URL rule class for Yii 2 which allows to create translated URL rules

1420.3k](/packages/geertw-yii2-translatable-url-rule)

PHPackages © 2026

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