public static function getStatus($id = null)
 {
     $statuses = [self::STATUS_TRANSLATED => Module::t('Translated'), self::STATUS_NOT_TRANSLATED => Module::t('Not translated')];
     if ($id !== null) {
         return ArrayHelper::getValue($statuses, $id, null);
     }
     return $statuses;
 }
 /**
  *
  * @param array|integer $id            
  * @return SourceMessage|SourceMessage[]
  * @throws NotFoundHttpException
  */
 protected function findModel($id)
 {
     $query = SourceMessage::find()->where('id = :id', [':id' => $id]);
     $models = is_array($id) ? $query->all() : $query->one();
     if (!empty($models)) {
         return $models;
     } else {
         throw new NotFoundHttpException(Module::t('The requested page does not exist'));
     }
 }
Example #3
0
I18nAsset::register($this);
$this->title = Module::t('Translations');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box box-solid">
	<div class="box-body no-padding">
    <?php 
echo GridView::widget(['layout' => "{items}", 'filterModel' => $searchModel, 'dataProvider' => $dataProvider, "tableOptions" => ['class' => 'table table-hover table-striped no-margin'], 'columns' => [['attribute' => 'message', 'format' => 'raw', 'contentOptions' => ['class' => 'source-message'], 'value' => function ($model, $index, $widget) {
    return Html::a($model->message, ['update', 'id' => $model->id], ["class" => "source-message-content"]);
}], ['class' => ActionColumn::className(), 'header' => '<i class="fa fa-copy"></i>', 'template' => '{copy}', 'headerOptions' => ['width' => '30'], 'buttons' => ['copy' => function ($url, $model, $key) {
    return Html::a('<i class="fa fa-arrow-right "></i>', 'javascript:void(0);', ['class' => 'btn btn-xs btn-default btn-translation-copy-from-source', 'title' => Module::t('Copy from source message')]);
}]], ['attribute' => 'messages', 'headerOptions' => ['width' => '400'], 'contentOptions' => ['class' => 'tabs-mini'], 'value' => function ($model, $key, $index, $column) {
    return $this->render('_message-tabs', ['model' => $model, 'key' => $key, 'index' => $index, 'column' => $column]);
}, 'format' => 'raw'], ['attribute' => 'category', 'headerOptions' => ['width' => '150'], 'contentOptions' => ['class' => 'text-align-center'], 'value' => function ($model, $key, $index, $dataColumn) {
    return $model->category;
}, 'filter' => ArrayHelper::map($searchModel::getCategories(), 'category', 'category')], ['attribute' => 'status', 'headerOptions' => ['width' => '150'], 'contentOptions' => ['class' => 'text-align-center'], 'value' => function ($model, $index, $widget) {
    /** @var SourceMessage $model */
    return $model->isTranslated() ? 'Translated' : 'Not translated';
}, 'filter' => $searchModel->getStatus()], ['class' => ActionColumn::className(), 'template' => '{save} ', 'buttons' => ['save' => function ($url, $model, $key) {
    return Html::a('<i class="glyphicon glyphicon-download"></i> ' . Module::t('Save'), 'javascript:void(0);', ['class' => 'btn btn-xs btn-success btn-translation-save', "data-url" => Url::to(["update", "id" => $model->primaryKey])]);
}]]]]);
?>
	</div>
	<div class="box-footer">
		<div class="box-tools pull-right">
			<?php 
echo yii\widgets\LinkPager::widget(['pagination' => $dataProvider->pagination, 'options' => ['class' => 'pagination pagination-sm inline']]);
?>
		</div>
	</div>
</div>
Example #4
0
$this->title = Module::t('Update') . ': ' . $model->message;
?>
<div class="message-update">
    <div class="message-form">
        <?php 
$form = ActiveForm::begin();
?>
        <div class="field">
            <div class="ui grid">
                <?php 
foreach ($model->messages as $language => $message) {
    ?>
                    <div class="four wide column">
                        <?php 
    echo $form->field($model->messages[$language], '[' . $language . ']translation')->label($language);
    ?>
                    </div>
                <?php 
}
?>
            </div>
        </div>
        <?php 
echo Html::submitButton(Module::t('Update'), ['class' => 'ui primary button']);
?>
        <?php 
$form::end();
?>
    </div>
</div>
Example #5
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('ID'), 'category' => Module::t('Category'), 'message' => Module::t('Message'), 'status' => Module::t('Translation status')];
 }
Example #6
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('ID'), 'language' => Module::t('Language'), 'translation' => Module::t('Translation')];
 }