Browse Source

language as code, not bundle

tags/2.0.0-beta
Alexander Kochetov 11 years ago
parent
commit
594341fb16
  1. 9
      framework/yii/jui/DatePicker.php

9
framework/yii/jui/DatePicker.php

@ -17,7 +17,7 @@ use yii\helpers\Html;
* *
* ```php * ```php
* echo DatePicker::widget(array( * echo DatePicker::widget(array(
* 'language' => 'yii/jui/datepicker/i18n/ru', * 'language' => 'ru',
* 'model' => $model, * 'model' => $model,
* 'attribute' => 'country', * 'attribute' => 'country',
* 'clientOptions' => array( * 'clientOptions' => array(
@ -30,7 +30,7 @@ use yii\helpers\Html;
* *
* ```php * ```php
* echo DatePicker::widget(array( * echo DatePicker::widget(array(
* 'language' => 'yii/jui/datepicker/i18n/ru', * 'language' => 'ru',
* 'name' => 'country', * 'name' => 'country',
* 'clientOptions' => array( * 'clientOptions' => array(
* 'dateFormat' => 'yy-mm-dd', * 'dateFormat' => 'yy-mm-dd',
@ -45,7 +45,8 @@ use yii\helpers\Html;
class DatePicker extends InputWidget class DatePicker extends InputWidget
{ {
/** /**
* @var string the jQuery UI datepicker widget language bundle. * @var string the locale ID (eg 'fr', 'de') for the language to be used by the date picker.
* If this property set to false, I18N will not be involved. That is, the date picker will show in English.
*/ */
public $language = false; public $language = false;
/** /**
@ -62,7 +63,7 @@ class DatePicker extends InputWidget
echo $this->renderWidget() . "\n"; echo $this->renderWidget() . "\n";
$this->registerWidget('datepicker'); $this->registerWidget('datepicker');
if ($this->language !== false) { if ($this->language !== false) {
$this->getView()->registerAssetBundle($this->language); $this->getView()->registerAssetBundle("yii/jui/datepicker/i18n/$this->language");
} }
} }

Loading…
Cancel
Save