Skip to content

Commit 88a3a82

Browse files
author
Igor Chepurnoy
committed
update translations
1 parent 7edcc82 commit 88a3a82

File tree

9 files changed

+34
-32
lines changed

9 files changed

+34
-32
lines changed

controllers/DefaultController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function actionCreate($entity)
6464
} else {
6565
return [
6666
'status' => 'error',
67-
'message' => Yii::t('app', 'Oops, something went wrong. Please try again later.')
67+
'message' => Yii::t('yii2mod.comments', 'Oops, something went wrong. Please try again later.')
6868
];
6969
}
7070
}
@@ -78,10 +78,10 @@ public function actionCreate($entity)
7878
public function actionDelete($id)
7979
{
8080
if ($this->findModel($id)->deleteComment()) {
81-
return Yii::t('app', 'Comment was deleted.');
81+
return Yii::t('yii2mod.comments', 'Comment was deleted.');
8282
} else {
8383
Yii::$app->response->setStatusCode(500);
84-
return Yii::t('app', 'Comment has not been deleted. Please try again!');
84+
return Yii::t('yii2mod.comments', 'Comment has not been deleted. Please try again!');
8585
}
8686
}
8787

@@ -99,7 +99,7 @@ protected function findModel($id)
9999
if (($model = $commentModelClass::findOne($id)) !== null) {
100100
return $model;
101101
} else {
102-
throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));
102+
throw new NotFoundHttpException(Yii::t('yii2mod.comments', 'The requested page does not exist.'));
103103
}
104104
}
105105
}

controllers/ManageController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function actionUpdate($id)
9090
$model = $this->findModel($id);
9191

9292
if ($model->load(Yii::$app->request->post()) && $model->save()) {
93-
Yii::$app->session->setFlash('success', 'Comment has been saved.');
93+
Yii::$app->session->setFlash('success', Yii::t('yii2mod.comments', 'Comment has been saved.'));
9494
return $this->redirect(['index']);
9595
}
9696

@@ -109,7 +109,7 @@ public function actionUpdate($id)
109109
public function actionDelete($id)
110110
{
111111
$this->findModel($id)->delete();
112-
Yii::$app->session->setFlash('success', 'Comment has been deleted.');
112+
Yii::$app->session->setFlash('success', Yii::t('yii2mod.comments', 'Comment has been deleted.'));
113113
return $this->redirect(['index']);
114114
}
115115

@@ -125,7 +125,7 @@ protected function findModel($id)
125125
if (($model = CommentModel::findOne($id)) !== null) {
126126
return $model;
127127
} else {
128-
throw new NotFoundHttpException('The requested page does not exist.');
128+
throw new NotFoundHttpException(Yii::t('yii2mod.comments', 'The requested page does not exist.'));
129129
}
130130
}
131131
}

models/CommentModel.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function validateParentID($attribute)
6868
if ($this->{$attribute} !== null) {
6969
$comment = self::find()->where(['id' => $this->{$attribute}, 'entity' => $this->entity, 'entityId' => $this->entityId])->active()->exists();
7070
if ($comment === false) {
71-
$this->addError('content', 'Oops, something went wrong. Please try again later.');
71+
$this->addError('content', Yii::t('yii2mod.comments', 'Oops, something went wrong. Please try again later.'));
7272
}
7373
}
7474
}
@@ -107,16 +107,16 @@ public function behaviors()
107107
public function attributeLabels()
108108
{
109109
return [
110-
'id' => Yii::t('app', 'ID'),
111-
'content' => Yii::t('app', 'Comment'),
112-
'entity' => Yii::t('app', 'Entity'),
113-
'status' => Yii::t('app', 'Status'),
114-
'level' => Yii::t('app', 'Level'),
115-
'createdBy' => Yii::t('app', 'Created by'),
116-
'updatedBy' => Yii::t('app', 'Updated by'),
117-
'relatedTo' => Yii::t('app', 'Related to'),
118-
'createdAt' => Yii::t('app', 'Created date'),
119-
'updatedAt' => Yii::t('app', 'Updated date'),
110+
'id' => Yii::t('yii2mod.comments', 'ID'),
111+
'content' => Yii::t('yii2mod.comments', 'Comment'),
112+
'entity' => Yii::t('yii2mod.comments', 'Entity'),
113+
'status' => Yii::t('yii2mod.comments', 'Status'),
114+
'level' => Yii::t('yii2mod.comments', 'Level'),
115+
'createdBy' => Yii::t('yii2mod.comments', 'Created by'),
116+
'updatedBy' => Yii::t('yii2mod.comments', 'Updated by'),
117+
'relatedTo' => Yii::t('yii2mod.comments', 'Related to'),
118+
'createdAt' => Yii::t('yii2mod.comments', 'Created date'),
119+
'updatedAt' => Yii::t('yii2mod.comments', 'Updated date'),
120120
];
121121
}
122122

models/enums/CommentStatus.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
class CommentStatus extends BaseEnum
1212
{
13+
public static $messageCategory = 'yii2mod.comments';
1314
const ACTIVE = 1;
1415
const DELETED = 2;
1516

views/manage/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/* @var $searchModel \yii2mod\comments\models\CommentSearchModel */
1414
/* @var $commentModel \yii2mod\comments\models\CommentModel */
1515

16-
$this->title = Yii::t('app', 'Comments Management');
16+
$this->title = Yii::t('yii2mod.comments', 'Comments Management');
1717
$this->params['breadcrumbs'][] = $this->title;
1818
?>
1919
<div class="comments-index">
@@ -42,7 +42,7 @@
4242
return $model->getAuthorName();
4343
},
4444
'filter' => $commentModel::getListAuthorsNames(),
45-
'filterInputOptions' => ['prompt' => 'Select Author', 'class' => 'form-control'],
45+
'filterInputOptions' => ['prompt' => Yii::t('yii2mod.comments', 'Select Author'), 'class' => 'form-control'],
4646
],
4747
[
4848
'class' => EditableColumn::className(),
@@ -59,7 +59,7 @@
5959
];
6060
},
6161
'filter' => CommentStatus::listData(),
62-
'filterInputOptions' => ['prompt' => 'Select Status', 'class' => 'form-control'],
62+
'filterInputOptions' => ['prompt' => Yii::t('yii2mod.comments', 'Select Status'), 'class' => 'form-control'],
6363
],
6464
[
6565
'attribute' => 'createdAt',

views/manage/update.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
/* @var $this yii\web\View */
99
/* @var $model \yii2mod\comments\models\CommentModel */
1010
/* @var $form yii\widgets\ActiveForm */
11-
$this->title = 'Update Comment: ' . $model->id;
12-
$this->params['breadcrumbs'][] = ['label' => 'Comments Management', 'url' => ['index']];
13-
$this->params['breadcrumbs'][] = 'Update';
11+
12+
$this->title = Yii::t('yii2mod.comments', 'Update Comment: ') . $model->id;
13+
$this->params['breadcrumbs'][] = ['label' => Yii::t('yii2mod.comments', 'Comments Management'), 'url' => ['index']];
14+
$this->params['breadcrumbs'][] = Yii::t('yii2mod.comments', 'Update');
1415
?>
1516
<div class="comment-update">
1617

@@ -29,7 +30,7 @@
2930
?>
3031
<?php echo $form->field($model, 'status')->dropDownList(CommentStatus::listData()); ?>
3132
<div class="form-group">
32-
<?php echo Html::submitButton('Update', ['class' => 'btn btn-primary']) ?>
33+
<?php echo Html::submitButton(Yii::t('yii2mod.comments', 'Update'), ['class' => 'btn btn-primary']) ?>
3334
</div>
3435
<?php ActiveForm::end(); ?>
3536
</div>

widgets/Comment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ class Comment extends Widget
7777
public function init()
7878
{
7979
if (empty($this->model)) {
80-
throw new InvalidConfigException('The "model" property must be set.');
80+
throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "model" property must be set.'));
8181
}
8282
$this->pjaxContainerId = 'comment-pjax-container-' . $this->getId();
8383
$this->entity = hash('crc32', get_class($this->model));
8484
$this->entityId = $this->model->{$this->entityIdAttribute};
8585
if (empty($this->entityId)) {
86-
throw new InvalidConfigException('The "entityIdAttribute" value for widget model cannot be empty.');
86+
throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "entityIdAttribute" value for widget model cannot be empty.'));
8787
}
8888
if (empty($this->relatedTo)) {
8989
$this->relatedTo = get_class($this->model) . ':' . $this->entityId;

widgets/views/_form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
'validateOnBlur' => false
2121
]); ?>
2222

23-
<?php echo $form->field($commentModel, 'content', ['template' => '{input}{error}'])->textarea(['placeholder' => 'Add a comment...', 'rows' => 4, 'data' => ['comment' => 'content']]) ?>
23+
<?php echo $form->field($commentModel, 'content', ['template' => '{input}{error}'])->textarea(['placeholder' => Yii::t('yii2mod.comments', 'Add a comment...'), 'rows' => 4, 'data' => ['comment' => 'content']]) ?>
2424
<?php echo $form->field($commentModel, 'parentId', ['template' => '{input}'])->hiddenInput(['data' => ['comment' => 'parent-id']]); ?>
2525
<div class="comment-box-partial">
2626
<div class="button-container show">
27-
<?php echo Html::a(Yii::t('app', 'Click here to cancel reply.'), '#', ['id' => 'cancel-reply', 'class' => 'pull-right', 'data' => ['action' => 'cancel-reply']]); ?>
28-
<?php echo Html::submitButton(Yii::t('app', 'Comment'), ['class' => 'btn btn-primary comment-submit']); ?>
27+
<?php echo Html::a(Yii::t('yii2mod.comments', 'Click here to cancel reply.'), '#', ['id' => 'cancel-reply', 'class' => 'pull-right', 'data' => ['action' => 'cancel-reply']]); ?>
28+
<?php echo Html::submitButton(Yii::t('yii2mod.comments', 'Comment'), ['class' => 'btn btn-primary comment-submit']); ?>
2929
</div>
3030
</div>
3131
<?php $form->end(); ?>

widgets/views/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
<div class="comments row">
1919
<div class="col-md-12 col-sm-12">
2020
<div class="title-block clearfix">
21-
<h3 class="h3-body-title"><?php echo Yii::t('app', 'Comments'); ?></h3>
21+
<h3 class="h3-body-title"><?php echo Yii::t('yii2mod.comments', 'Comments'); ?></h3>
2222
<div class="title-separator"></div>
2323
</div>
2424
<ol class="comments-list">
2525
<?php echo $this->render('_list', ['comments' => $comments, 'maxLevel' => $maxLevel]) ?>
2626
</ol>
27-
<?php if (!\Yii::$app->user->isGuest) : ?>
27+
<?php if (!Yii::$app->user->isGuest): ?>
2828
<?php echo $this->render('_form', [
2929
'commentModel' => $commentModel,
3030
'encryptedEntity' => $encryptedEntity,

0 commit comments

Comments
 (0)