altynbek07/yii2-qazaq-transliterator

Transliteration Kazakh symbols on the new

0.2 2018-04-24 08:53 UTC

This package is auto-updated.

Last update: 2024-11-10 20:16:21 UTC


README

Yii2 qazaq transliterator behavior Qazaq Transliterator

Installation

Composer

The preferred way to install this extension is through Composer.

Either run composer require altynbek07/yii2-qazaq-transliterator:^0.2

or add "altynbek07/yii2-qazaq-transliterator": "^0.2" to the require section of your composer.json

Using

Attach the behavior in your model:

public function behaviors()
{
    return [
        'transliterate' => [
            'class' => 'altynbek07\yii2QazaqTransliterator\QazaqTransliteratorBehavior',
            'attributes' => 'name',
        ]
    ];
}

Transliteration multiple attributes:

public function behaviors()
{
    return [
        'transliterate' => [
            ...
            'attributes' => ['name', 'text'],
            ...
        ]
    ];
}

If you have multilanguage model, you can add this attributes:

public function behaviors()
{
    return [
        'transliterate' => [
            ...
            'isTranslationModel' => true,
            'languageColumnName' => 'lang',     // Name of language column in model table
            'languageColumnValue' => 'qq-KZ',   // Value from new qazaq language column in model table
            ...
        ]
    ];
}

Author

Altynbek Kazezov, e-mail: altinbek__97@mail.ru