Skip to content

Commit

Permalink
Upgrade to release v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Nov 28, 2014
1 parent c479b99 commit 57e08a5
Show file tree
Hide file tree
Showing 84 changed files with 20 additions and 28 deletions.
10 changes: 10 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Version 1.5.0
=============
**Date:** 29-Nov-2014

- (enh #20): Enhance language locale file parsing and registering
- Remove `_localeLang` property
- Rename `locale` folder to `locales` to be consistent with `datepicker` and `datetimepicker` plugins
- Utilize enhancements in krajee base [enh #9](https://github.com/kartik-v/yii2-krajee-base/issues/9) and [enh #10 ](https://github.com/kartik-v/yii2-krajee-base/issues/10)
- Update `LanguageAsset` for new path

Version 1.4.0
=============
**Date:** 25-Nov-2014
Expand Down
28 changes: 5 additions & 23 deletions DateRangePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014
* @package yii2-date-range
* @version 1.4.0
* @version 1.5.0
*/

namespace kartik\daterange;
Expand Down Expand Up @@ -182,17 +182,10 @@ protected function initRange()
* Initialize locale settings
*/
protected function initLocale() {
$this->initLanguage();
$this->_localeLang = strtolower($this->language);
if (empty($this->_lang) || $this->_localeLang === 'en') {
$this->setLanguage('');
if (empty($this->_langFile)) {
return;
}
if (!static::isTranslatable($this->_localeLang)) {
$this->_localeLang = $this->_lang;
if (!static::isTranslatable($this->_localeLang)) {
return;
}
}
$localeSettings = ArrayHelper::getValue($this->pluginOptions, 'locale', []);
$localeSettings += [
'applyLabel' => Yii::t('kvdrp', 'Apply'),
Expand All @@ -208,17 +201,6 @@ protected function initLocale() {
$this->pluginOptions['locale'] = $localeSettings;
}

/**
* Check if a translation is possible
* @param string $lang the language code
* @return bool
*/
protected static function isTranslatable($lang) {
$s = DIRECTORY_SEPARATOR;
$file = __DIR__ . "{$s}assets{$s}js{$s}locale{$s}{$lang}.js";
return (!empty($lang) && $lang !== 'en' && file_exists($file));
}

/**
* Parses and returns a JsExpression
*
Expand Down Expand Up @@ -258,8 +240,8 @@ public function registerAssets()
if ($this->hideInput) {
$id = 'jQuery("#' . $this->containerOptions['id'] . '")';
}
if ($this->_localeLang != 'en') {
LanguageAsset::register($view)->js[] = "{$this->_localeLang}.js";
if (!empty($this->_langFile)) {
LanguageAsset::register($view)->js[] = $this->_langFile;
}
DateRangePickerAsset::register($view);
if (empty($this->callback)) {
Expand Down
2 changes: 1 addition & 1 deletion DateRangePickerAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014
* @package yii2-date-range
* @version 1.4.0
* @version 1.5.0
*/

namespace kartik\daterange;
Expand Down
4 changes: 2 additions & 2 deletions LanguageAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014
* @package yii2-date-range
* @version 1.4.0
* @version 1.5.0
*/

namespace kartik\daterange;
Expand All @@ -21,7 +21,7 @@ class LanguageAsset extends \kartik\base\AssetBundle

public function init()
{
$this->setSourcePath(__DIR__ . '/assets/js/locale');
$this->setSourcePath(__DIR__ . '/assets');
parent::init();
}

Expand Down
2 changes: 1 addition & 1 deletion MomentAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014
* @package yii2-date-range
* @version 1.4.0
* @version 1.5.0
*/

namespace kartik\daterange;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Additional enhancements added for this widget (by Krajee):
You can see detailed [documentation](http://demos.krajee.com/date-range) on usage of the extension.

### Latest Release
The latest version of the extension is release v1.3.0. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-date-range/blob/master/CHANGE.md) for details of various releases.
The latest version of the extension is release v1.5.0. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-date-range/blob/master/CHANGE.md) for details of various releases.

## Installation

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 57e08a5

Please sign in to comment.