2018-03-25 17:30:42 +00:00
|
|
|
!function(e,n){"function"==typeof define&&define.amd?define("i18n",function(){return n(e)}):"object"==typeof module&&module.exports?module.exports=n(e):e.I18n=n(e)}(this,function(e){"use strict";var n=e&&e.I18n||{},o=Array.prototype.slice,t=function(e){return("0"+e.toString()).substr(-2)},a=function(e){var n=typeof e;return"function"===n||"object"===n},r=function(e){return"function"===typeof e},i=function(e){return void 0!==e&&null!==e},s=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)},u=function(e){return"string"==typeof value||"[object String]"===Object.prototype.toString.call(e)},l=function(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)},c=function(e){return!0===e||!1===e},d=function(e,n,o){return void 0===o||0==+o?Math[e](n):(n=+n,o=+o,isNaN(n)||"number"!=typeof o||o%1!=0?NaN:(n=n.toString().split("e"),n=Math[e](+(n[0]+"e"+(n[1]?+n[1]-o:-o))),+((n=n.toString().split("e"))[0]+"e"+(n[1]?+n[1]+o:o))))},m=function(e,n){return r(e)?e(n):e},p=function(e,n){var o,t;for(o in n)n.hasOwnProperty(o)&&(t=n[o],u(t)||l(t)||c(t)?e[o]=t:(null==e[o]&&(e[o]={}),p(e[o],t)));return e},_={day_names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbr_day_names:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],month_names:[null,"January","February","March","April","May","June","July","August","September","October","November","December"],abbr_month_names:[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridian:["AM","PM"]},h={precision:3,separator:".",delimiter:",",strip_insignificant_zeros:!1},g={unit:"$",precision:2,format:"%u%n",sign_first:!0,delimiter:",",separator:"."},b={unit:"%",precision:3,format:"%n%u",separator:".",delimiter:""},f=[null,"kb","mb","gb","tb"],y={defaultLocale:"en",locale:"en",defaultSeparator:".",placeholder:/(?:\{\{|%\{)(.*?)(?:\}\}?)/gm,fallbacks:!1,translations:{},missingBehaviour:"message",missingTranslationPrefix:""};return n.reset=function(){var e;for(e in y)this[e]=y[e]},n.initializeOptions=function(){var e;for(e in y)i(this[e])||(this[e]=y[e])},n.initializeOptions(),n.locales={},n.locales.get=function(e){var o=this[e]||this[n.locale]||this.default;return r(o)&&(o=o(e)),!1===s(o)&&(o=[o]),o},n.locales.default=function(e){var o=[],t=[];return e&&o.push(e),!e&&n.locale&&o.push(n.locale),n.fallbacks&&n.defaultLocale&&o.push(n.defaultLocale),o.forEach(function(e){var o=e.split("-"),a=null,r=null;3===o.length?(a=[o[0],o[1]].join("-"),r=o[0]):2===o.length&&(a=o[0]),-1===t.indexOf(e)&&t.push(e),n.fallbacks&&[a,r].forEach(function(n){void 0!==n&&null!==n&&n!==e&&-1===t.indexOf(n)&&t.push(n)})}),o.length||o.push("en"),t},n.pluralization={},n.pluralization.get=function(e){return this[e]||this[n.locale]||this.default},n.pluralization.default=function(e){switch(e){case 0:return["zero","other"];case 1:return["one"];default:return["other"]}},n.currentLocale=function(){return this.locale||this.defaultLocale},n.isSet=i,n.lookup=function(e,n){n=n||{};var o,t,a,r,s=this.locales.get(n.locale).slice();s[0];for(a=this.getFullScope(e,n);s.length;)if(o=s.shift(),t=a.split(this.defaultSeparator),r=this.translations[o]){for(;t.length&&void 0!==(r=r[t.shift()])&&null!==r;);if(void 0!==r&&null!==r)return r}if(i(n.defaultValue))return m(n.defaultValue,e)},n.pluralizationLookupWithoutFallback=function(e,n,o){var t,r,s=this.pluralization.get(n)(e);if(a(o))for(;s.length;)if(t=s.shift(),i(o[t])){r=o[t];break}return r},n.pluralizationLookup=function(e,n,o){o=o||{};var t,r,s,u,l=this.locales.get(o.locale).slice();l[0];for(n=this.getFullScope(n,o);l.length;)if(t=l.shift(),r=n.split(this.defaultSeparator),s=this.translations[t]){for(;r.length&&(s=s[r.shift()],a(s));)0==r.length&&(u=this.pluralizationLookupWithoutFallback(e,t,s));if(null!=u&&void 0!=u)break}return null!=u&&void 0!=u||i(o.defaultValue)&&(u=a(o.defaultValue)?this.pluralizationLookupWithoutFallback(e,o.locale,o.defaultValue):o.defaultValue,s=o.defaultValue),{message:u,translations:s}},n.meridian=function(){var e=this.lookup("time"),n=this.l
|