omcrn/yii2-i18ncontent 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

omcrn/yii2-i18ncontent

Composer 安装命令:

composer require omcrn/yii2-i18ncontent

包简介

Show text widgets, pages, articles in chosen language

README 文档

README

yii2-i18ncontent is yii2 module for creating several types of contents in different languages. It support creating the following contents:

  • Translatable article categories and articles
  • Translatable Pages
  • Carousels with translatable caption texts
  • Translatable portions of text.
  • Menu contents (Non translatable yet)

Installation

  1. Run composer require omcrn/yii2-i18ncontent or add "omcrn/yii2-i18ncontent": "~2.0.0" in your projects composer.json.
  2. Make sure you have user table in your database with primary key id.
  3. Run migrations to create tables by php console/yii migrate --migrationPath=@yii/i18n/migrations from projects root directory
  4. Run migrations to create tables by php console/yii migrate --migrationPath=@vendor/omcrn/yii2-i18ncontent/migrations from projects root directory

Configuration

Add the following code in projects configuration file under modules section

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

Add the following code in project's configuration file under components section

"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`
],

Add availableLocales array to application configuration params array.

For each language listed here tab will be displayed to provide content.

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

Urls for administration

Append the following urls to the domain to see administration pages

Content Url
Article categories i18ncontent/article-category/index
Articles i18ncontent/article/index
Pages i18ncontent/page/index
Text widgets i18ncontent/widget-text/index
Carousels i18ncontent/widget-carousel/index
Menus i18ncontent/widget-menu/index

统计信息

  • 总下载量: 512
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-12-26