PHP code example of omcrn / yii2-i18ncontent

1. Go to this page and download the library: Download omcrn/yii2-i18ncontent library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

omcrn / yii2-i18ncontent example snippets


'i18ncontent' => [
    'class' => 'centigen\i18ncontent\Module',
    'defaultLayout' => '/admin', //Default layout which will be used for rendering i18ncontent pages
],


"i18n" => [
    "translations" => [
        '...',
        'i18ncontent' => [
            'class' => 'yii\i18n\PhpMessageSource',
            'basePath' => '@vendor/omcrn/yii2-i18ncontent/messages',
        ],
    ]
]
'formatter' => [
    'class' => 'centigen\base\i18n\Formatter'
],
'i18ncontent' => [
    'class' => 'centigen\i18ncontent\I18nContent',
    'userClass' => 'common\models\User', //User model class. If you do not have user model, generate it from user table. Make sure this models extends \yii\db\ActiveRecord class
    'mediaUrlPrefix' => null, //In texts which may contain <img> or other media object tags (texts which come from WYSIWYG editors)
                             // `$mediaUrlPrefix` strings are replaced with `$mediaUrlReplacement` string when calling `Html::encodeMediaItemUrls`
                             // and vice versa when calling `Html::decodeMediaItemUrls`
    'mediaUrlReplacement' => '{{media_item_url_prefix}}' //See `$mediaUrlPrefix`
],

'params' => [
    '...',
    'availableLocales' => [
        'en-US' => 'English',
        'ru-RU' => 'Русский'
        ...
    ],
]