Skip to content

Commit

Permalink
Made ActionColumn Yii::t() tags static again (#13489)
Browse files Browse the repository at this point in the history
* Made ActionColumn Yii::t() tags static again

this was changed in 2.0.11 and cause the messages translation to not
recognize them anymore.

* Fixed formatting
  • Loading branch information
cebe authored Feb 2, 2017
1 parent d74d18c commit 284cadf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Yii Framework 2 Change Log
------------------------

- Bug #11502: Fixed `yii\console\controllers\MessageController` to properly populate missing languages in case of extraction with "db" format (bizley)
- Bug #13489: Fixed button names in ActionColumn to contain proper `Yii::t()` tags and restored missing translations for `ja` and `ru` (cebe, softark)


2.0.11 February 01, 2017
Expand Down
14 changes: 13 additions & 1 deletion framework/grid/ActionColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,19 @@ protected function initDefaultButton($name, $iconName, $additionalOptions = [])
{
if (!isset($this->buttons[$name]) && strpos($this->template, '{' . $name . '}') !== false) {
$this->buttons[$name] = function ($url, $model, $key) use ($name, $iconName, $additionalOptions) {
$title = Yii::t('yii', ucfirst($name));
switch ($name) {
case 'view':
$title = Yii::t('yii', 'View');
break;
case 'update':
$title = Yii::t('yii', 'Update');
break;
case 'delete':
$title = Yii::t('yii', 'Delete');
break;
default:
$title = ucfirst($name);
}
$options = array_merge([
'title' => $title,
'aria-label' => $title,
Expand Down

0 comments on commit 284cadf

Please sign in to comment.