phuongdev89 / yii2-multi-language
This will help multi-language for Yii2
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
Suggests
- phuongdev89/yii2-localeurls: @dev
This package is auto-updated.
Last update: 2024-10-26 12:25:53 UTC
README
This module allow you to create multi language use database. By default, Yii use Yii::t() for multi language. But you must stored the sentences on file, and it never suggested keywords for you. Now you can store it on mySql.
Requirements
Install & config:
Install
Preferred way to install this extension through composer
Either run
composer require phuongdev89/yii2-multi-language "^2.0"
Or add to require
section of composer.json
then run composer update
"phuongdev89/yii2-multi-language" : "^2.0"
Config:
[php]
'language' => 'en', //TODO Change this to 2 characters
.....................
'bootstrap' => [
'log',
'multiLanguage',
],
'components' => [
'multiLanguage' => [
'class' => '\phuongdev89\language\Component',
],
],
'modules' => [
'gridview' => [
'class' => '\kartik\grid\Module',
],
'language' => [
'class' => '\phuongdev89\language\Module',
/*TODO uncommented if you want to custom view*/
//'viewPath' => '@app/vendor/phuongdev89/yii2-multi-language/src/views',
/*TODO uncommented if you want to change suffix of translated table / model.
should be one word, lowercase only.*/
//'suffix' => 'translate',
],
],
Run Yii Migration, you will have two default language (English & Vietnamese):
php yii migrate/up --migrationPath=@vendor/phuongdev89/yii2-multi-language/src/migrations