@pluginjs/i18n
Advanced tools
Comparing version 0.7.15 to 0.7.16
/*! | ||
* @pluginjs/i18n v0.7.15 (https://pluginjs.com) | ||
* @pluginjs/i18n v0.7.16 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License. |
/*! | ||
* @pluginjs/i18n v0.7.15 (https://pluginjs.com) | ||
* @pluginjs/i18n v0.7.16 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License. |
/*! | ||
* @pluginjs/i18n v0.7.15 (https://pluginjs.com) | ||
* @pluginjs/i18n v0.7.16 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License. |
/*! | ||
* @pluginjs/i18n v0.7.15 (https://pluginjs.com) | ||
* @pluginjs/i18n v0.7.16 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License. |
/*! | ||
* @pluginjs/i18n v0.7.15 (https://pluginjs.com) | ||
* @pluginjs/i18n v0.7.16 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
@@ -4,0 +4,0 @@ * Released under the GPL-3.0 License. |
/*! | ||
* @pluginjs/i18n v0.7.15 (https://pluginjs.com) | ||
* @pluginjs/i18n v0.7.16 (https://pluginjs.com) | ||
* Copyright 2019 Creation Studio Limited | ||
* Released under the GPL-3.0 License. | ||
*/ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@pluginjs/utils"),require("@pluginjs/template")):"function"==typeof define&&define.amd?define(["@pluginjs/utils","@pluginjs/template"],t):(n=n||self)["@pluginjs/i18n"]=t(n["@pluginjs/utils"],n["@pluginjs/template"])}(this,function(n,t){"use strict";function e(n,t){for(var e=0;e<t.length;e++){var a=t[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,a.key,a)}}t=t&&t.hasOwnProperty("default")?t.default:t;var a=function(){function a(t,e){!function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),this.defaults=n.deepMerge(a.defaults,t),this.translations=e||{}}var i,l,r;return i=a,(l=[{key:"hasTranslation",value:function(n){return n in this.translations}},{key:"addTranslation",value:function(n,t){this.translations[n]?Object.assign(this.translations[n],t):this.translations[n]=t}},{key:"getTranslation",value:function(n){return this.translations[n]?this.translations[n]:{}}},{key:"instance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=this,i=n.deepMerge(a.defaults,e),l=i.locale;function r(t,e){var i=a.getTranslation(e);return n.getValueByPath(i,t)}return{translate:function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l,o=r(n,s);if(void 0===o&&i.fallbacks){var u=s.split("-");if(u.length>1&&a.hasTranslation(u[0])&&(o=r(n,u[0])),void 0===o)o=r(n,!0!==i.fallbacks&&a.hasTranslation(i.fallbacks)?i.fallbacks:a.defaults.locale)}if("[object Array]"===Object.prototype.toString.call(o)&&o.length>=2&&"string"==typeof e._number&&void 0!==e[e._number]){var c=parseInt(e[e._number],10);1===c?o=o[0]:c>1?o=o[1]:0===c&&o.length>=3&&(o=o[2])}if("string"==typeof o){var f,d=t.parse(o);if(!d)return o;for(var g=0;g<d.length;g++)void 0===e[f=d[g]]?e[f]=i.missingPlaceholder(f):null===e[f]&&(e[f]=i.nullPlaceholder(f));return t.render(o,e)}return Object(o)===o?o:'[missing "'.concat(s,".").concat(n,'" translation]')},setLocale:function(n){l=n},getLocale:function(){return l}}}},{key:"setTranslations",value:function(n){this.translations=n}}])&&e(i.prototype,l),r&&e(i,r),a}();return a.defaults={locale:"en",fallbacks:!0,nullPlaceholder:function(n){return"[missing {{".concat(n,"}} value]")},missingPlaceholder:function(n){return"[missing {{".concat(n,"}} value]")}},a}); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@pluginjs/utils"),require("@pluginjs/template")):"function"==typeof define&&define.amd?define(["@pluginjs/utils","@pluginjs/template"],t):(n=n||self)["@pluginjs/i18n"]=t(n["@pluginjs/utils"],n["@pluginjs/template"])}(this,(function(n,t){"use strict";function e(n,t){for(var e=0;e<t.length;e++){var a=t[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,a.key,a)}}t=t&&t.hasOwnProperty("default")?t.default:t;var a=function(){function a(t,e){!function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),this.defaults=n.deepMerge(a.defaults,t),this.translations=e||{}}var i,l,r;return i=a,(l=[{key:"hasTranslation",value:function(n){return n in this.translations}},{key:"addTranslation",value:function(n,t){this.translations[n]?Object.assign(this.translations[n],t):this.translations[n]=t}},{key:"getTranslation",value:function(n){return this.translations[n]?this.translations[n]:{}}},{key:"instance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=this,i=n.deepMerge(a.defaults,e),l=i.locale;function r(t,e){var i=a.getTranslation(e);return n.getValueByPath(i,t)}return{translate:function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l,o=r(n,s);if(void 0===o&&i.fallbacks){var u=s.split("-");u.length>1&&a.hasTranslation(u[0])&&(o=r(n,u[0])),void 0===o&&(o=r(n,!0!==i.fallbacks&&a.hasTranslation(i.fallbacks)?i.fallbacks:a.defaults.locale))}if("[object Array]"===Object.prototype.toString.call(o)&&o.length>=2&&"string"==typeof e._number&&void 0!==e[e._number]){var c=parseInt(e[e._number],10);1===c?o=o[0]:c>1?o=o[1]:0===c&&o.length>=3&&(o=o[2])}if("string"==typeof o){var f,d=t.parse(o);if(!d)return o;for(var g=0;g<d.length;g++)void 0===e[f=d[g]]?e[f]=i.missingPlaceholder(f):null===e[f]&&(e[f]=i.nullPlaceholder(f));return t.render(o,e)}return Object(o)===o?o:'[missing "'.concat(s,".").concat(n,'" translation]')},setLocale:function(n){l=n},getLocale:function(){return l}}}},{key:"setTranslations",value:function(n){this.translations=n}}])&&e(i.prototype,l),r&&e(i,r),a}();return a.defaults={locale:"en",fallbacks:!0,nullPlaceholder:function(n){return"[missing {{".concat(n,"}} value]")},missingPlaceholder:function(n){return"[missing {{".concat(n,"}} value]")}},a})); |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "0.7.15", | ||
"version": "0.7.16", | ||
"category": "core", | ||
@@ -37,9 +37,9 @@ "main": "dist/i18n.common.js", | ||
"dependencies": { | ||
"@pluginjs/template": "^0.7.15", | ||
"@pluginjs/utils": "^0.7.15" | ||
"@pluginjs/template": "^0.7.16", | ||
"@pluginjs/utils": "^0.7.16" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.5.5", | ||
"@pluginjs/browserslist-config": "^1.2.10", | ||
"@pluginjs/cli": "^0.7.13", | ||
"@babel/core": "^7.6.0", | ||
"@pluginjs/browserslist-config": "^1.2.11", | ||
"@pluginjs/cli": "^0.7.14", | ||
"babel-jest": "*", | ||
@@ -70,4 +70,4 @@ "jest": "*", | ||
], | ||
"gitHead": "2d2c629bf12f5a071c43b3074a6becdd4afadedc", | ||
"gitHead": "d1b3d9591a2fa49f13758c5ad8effcb021b096fc", | ||
"title": "Plugin" | ||
} |
28669
Updated@pluginjs/template@^0.7.16
Updated@pluginjs/utils@^0.7.16