Commit 594341fb by Alexander Kochetov

language as code, not bundle

parent ca86a3e2
...@@ -17,7 +17,7 @@ use yii\helpers\Html; ...@@ -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; ...@@ -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; ...@@ -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 ...@@ -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");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment