Made ActionColumn Yii::t() tags static again (#13489)

* 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
This commit is contained in:
Carsten Brandt
2017-02-02 19:46:42 +01:00
committed by GitHub
parent d74d18cee4
commit 284cadfe03
2 changed files with 14 additions and 1 deletions

View File

@ -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 #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 2.0.11 February 01, 2017

View File

@ -161,7 +161,19 @@ class ActionColumn extends Column
{ {
if (!isset($this->buttons[$name]) && strpos($this->template, '{' . $name . '}') !== false) { if (!isset($this->buttons[$name]) && strpos($this->template, '{' . $name . '}') !== false) {
$this->buttons[$name] = function ($url, $model, $key) use ($name, $iconName, $additionalOptions) { $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([ $options = array_merge([
'title' => $title, 'title' => $title,
'aria-label' => $title, 'aria-label' => $title,