Skip to content

Commit

Permalink
release 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Nov 26, 2015
1 parent bb42f2c commit ec2b91b
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 11 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<a name="2.3.0"></a>
# [2.3.0](https://github.com/kazupon/vue-i18n/compare/v2.2.0...v2.3.0) (2015-11-26)


### Bug Fixes

* **index:** cannot work at Vue 1.0.10 later ([6fd543e](https://github.com/kazupon/vue-i18n/commit/6fd543e)), closes [#9](https://github.com/kazupon/vue-i18n/issues/9)

### Features

* **index:** support automatically install for standalone ([ada2673](https://github.com/kazupon/vue-i18n/commit/ada2673))



# v2.2.0 / 2015-09-16

* Re-implemetation with ES6 (babel)
Expand Down
100 changes: 92 additions & 8 deletions dist/vue-i18n.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-i18n v2.2.0
* vue-i18n v2.3.0
* (c) 2015 kazuya kawaguchi
* Released under the MIT License.
*/
Expand Down Expand Up @@ -64,6 +64,7 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = install;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

Expand All @@ -72,18 +73,18 @@ return /******/ (function(modules) { // webpackBootstrap
var _extend2 = _interopRequireDefault(_extend);

/**
* plugin
* install
*
* @param {Object} Vue
* @param {Object} opts
*/

exports['default'] = function (Vue) {
function install(Vue) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? { lang: 'en', locales: {} } : arguments[1];

defineConfig(Vue.config, opts.lang);
(0, _extend2['default'])(Vue, opts.locales);
};
}

/**
* defineConfig
Expand All @@ -105,6 +106,14 @@ return /******/ (function(modules) { // webpackBootstrap
}
});
}

/**
* install automaticlly
*/

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(install);
}
module.exports = exports['default'];

/***/ },
Expand All @@ -123,6 +132,10 @@ return /******/ (function(modules) { // webpackBootstrap

var _format2 = _interopRequireDefault(_format);

var _compare = __webpack_require__(3);

var _compare2 = _interopRequireDefault(_compare);

/**
* extend
*
Expand All @@ -132,13 +145,13 @@ return /******/ (function(modules) { // webpackBootstrap
*/

exports['default'] = function (Vue, locales) {
var path = Vue.parsers.path;
var getPath = Vue.version && (0, _compare2['default'])('1.0.8', Vue.version) === -1 ? Vue.parsers.path.getPath : Vue.parsers.path.get;
var util = Vue.util;

function getVal(path, key, lang, args) {
function getVal(key, lang, args) {
var value = key;
try {
var val = path.get(locales[lang], key) || locales[lang][key];
var val = getPath(locales[lang], key) || locales[lang][key];
value = (args ? (0, _format2['default'])(val, args) : val) || key;
} catch (e) {
value = key;
Expand Down Expand Up @@ -179,7 +192,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
}

return getVal(path, key, language, args);
return getVal(key, language, args);
};

return Vue;
Expand Down Expand Up @@ -243,6 +256,77 @@ return /******/ (function(modules) { // webpackBootstrap

module.exports = exports['default'];

/***/ },
/* 3 */
/***/ function(module, exports) {

/**
* Version compare
* - Inspired:
* https://github.com/omichelsen/compare-versions
*/

'use strict';

Object.defineProperty(exports, '__esModule', {
value: true
});
var PATCH_PATTERN = /-([\w-.]+)/;

function split(v) {
var temp = v.split('.');
var arr = temp.splice(0, 2);
arr.push(temp.join('.'));
return arr;
}

/**
* compare
*
* @param {String} v1
* @param {String} v2
* @return {Number}
*/

exports['default'] = function (v1, v2) {
var s1 = split(v1);
var s2 = split(v2);

for (var i = 0; i < 3; i++) {
var n1 = parseInt(s1[i] || 0, 10);
var n2 = parseInt(s2[i] || 0, 10);

if (n1 > n2) {
return 1;
}
if (n2 > n1) {
return -1;
}
}

if ((s1[2] + s2[2] + '').indexOf('-') > -1) {
var p1 = (PATCH_PATTERN.exec(s1[2]) || [''])[0];
var p2 = (PATCH_PATTERN.exec(s2[2]) || [''])[0];

if (p1 === '') {
return 1;
}
if (p2 === '') {
return -1;
}
if (p1 > p2) {
return 1;
}
if (p2 > p1) {
return -1;
}
}

return 0;
};

module.exports = exports['default'];

/***/ }
/******/ ])
});
Expand Down
4 changes: 2 additions & 2 deletions dist/vue-i18n.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-i18n",
"description": "Internationalization plugin for Vue.js",
"version": "2.2.0",
"version": "2.3.0",
"author": {
"name": "kazuya kawaguchi",
"email": "[email protected]"
Expand Down

0 comments on commit ec2b91b

Please sign in to comment.