@lingui/core 3.14.0 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +384 -0
- package/build/LICENSE +21 -0
- package/build/cjs/compile.js +68 -0
- package/build/cjs/compile.js.map +1 -0
- package/{esm/core.development.js → build/cjs/index.js} +46 -87
- package/build/cjs/index.js.map +1 -0
- package/build/compile.d.ts +2 -0
- package/build/compile.js +1 -0
- package/build/esm/compile.js +66 -0
- package/build/esm/compile.js.map +1 -0
- package/{esm/dev.development.js → build/esm/index.js} +33 -79
- package/build/esm/index.js.map +1 -0
- package/{esm → build/esm}/package.json +0 -0
- package/build/index.d.ts +94 -0
- package/build/index.js +1 -0
- package/package.json +16 -13
- package/cjs/context.d.ts +0 -4
- package/cjs/context.d.ts.map +0 -1
- package/cjs/core.development.js +0 -542
- package/cjs/core.development.js.map +0 -1
- package/cjs/core.production.min.js +0 -2
- package/cjs/core.production.min.js.map +0 -1
- package/cjs/dev/compile.d.ts +0 -3
- package/cjs/dev/compile.d.ts.map +0 -1
- package/cjs/dev/index.d.ts +0 -4
- package/cjs/dev/index.d.ts.map +0 -1
- package/cjs/dev/loadLocaleData.d.ts +0 -5
- package/cjs/dev/loadLocaleData.d.ts.map +0 -1
- package/cjs/dev.development.js +0 -542
- package/cjs/dev.development.js.map +0 -1
- package/cjs/dev.production.min.js +0 -2
- package/cjs/dev.production.min.js.map +0 -1
- package/cjs/essentials.d.ts +0 -4
- package/cjs/essentials.d.ts.map +0 -1
- package/cjs/eventEmitter.d.ts +0 -10
- package/cjs/eventEmitter.d.ts.map +0 -1
- package/cjs/formats.d.ts +0 -4
- package/cjs/formats.d.ts.map +0 -1
- package/cjs/i18n.d.ts +0 -63
- package/cjs/i18n.d.ts.map +0 -1
- package/cjs/index.d.ts +0 -5
- package/cjs/index.d.ts.map +0 -1
- package/esm/context.d.ts +0 -4
- package/esm/context.d.ts.map +0 -1
- package/esm/core.development.js.map +0 -1
- package/esm/core.production.min.js +0 -2
- package/esm/core.production.min.js.map +0 -1
- package/esm/dev/compile.d.ts +0 -3
- package/esm/dev/compile.d.ts.map +0 -1
- package/esm/dev/index.d.ts +0 -4
- package/esm/dev/index.d.ts.map +0 -1
- package/esm/dev/loadLocaleData.d.ts +0 -5
- package/esm/dev/loadLocaleData.d.ts.map +0 -1
- package/esm/dev.development.js.map +0 -1
- package/esm/dev.js +0 -18
- package/esm/dev.production.min.js +0 -2
- package/esm/dev.production.min.js.map +0 -1
- package/esm/essentials.d.ts +0 -4
- package/esm/essentials.d.ts.map +0 -1
- package/esm/eventEmitter.d.ts +0 -10
- package/esm/eventEmitter.d.ts.map +0 -1
- package/esm/formats.d.ts +0 -4
- package/esm/formats.d.ts.map +0 -1
- package/esm/i18n.d.ts +0 -63
- package/esm/i18n.d.ts.map +0 -1
- package/esm/index.d.ts +0 -5
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -18
- package/index.js +0 -5
package/esm/context.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { CompiledMessage, Locales } from "./i18n";
|
|
2
|
-
export declare const UNICODE_REGEX: RegExp;
|
|
3
|
-
export declare function interpolate(translation: CompiledMessage, locale: string, locales: Locales, localeData: Object): (values: Object, formats?: Object) => string;
|
|
4
|
-
//# sourceMappingURL=context.d.ts.map
|
package/esm/context.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["packages/core/src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAIjD,eAAO,MAAM,aAAa,QAAyC,CAAC;AAuEpE,wBAAgB,WAAW,CACzB,WAAW,EAAE,eAAe,EAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,YAEF,MAAM,YAAW,MAAM,KAAQ,MAAM,CAsCtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import n from"@babel/runtime/helpers/inherits";import r from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/slicedToArray";import l from"@babel/runtime/helpers/objectWithoutProperties";var i=function(e){return"string"==typeof e},s=function(e){return"function"==typeof e},u=new Map,c=new Map;function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(i(r)&&(r=new Date(r)),n){var a=v(e,t),o=c.get(a);if(o)return o.format(r);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(r)}var s=new Intl.DateTimeFormat(e,t);return s.format(r)}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(n){var a=v(e,t),o=u.get(a);if(o)return o.format(r);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(r)}var i=new Intl.NumberFormat(e,t);return i.format(r)}}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Array.isArray(e)?e.sort().join("-"):e;return"".concat(n,"-").concat(JSON.stringify(t))}var m=Object.freeze({__proto__:null,date:f,number:h}),g=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function _(e){var t=e.locale,n=e.locales,r=e.values,a=e.formats,o=e.localeData,u=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{plurals:void 0},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t=t||e;var a=n.plurals,o=function(e){return i(e)?r[e]||{style:e}:e},u=function(e,n){return function(r){var a=s(n)?n(r):n,o=Array.isArray(a)?a:[a],l=h(t)(e);return o.map((function(e){return i(e)?e.replace("#",l):e}))}};return a||console.error("Plurals for locale ".concat(e," aren't loaded. Use i18n.loadLocaleData method to load plurals for specific locale. Using other plural rule as a fallback.")),{plural:function(e,t){var n=t.offset,r=void 0===n?0:n,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-r)]||o.other;return u(e-r,i)},selectordinal:function(e,t){var n=t.offset,r=void 0===n?0:n,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-r,!0)]||o.other;return u(e-r,i)},select:function(e,t){return t[e]||t.other},number:function(e,n){return h(t,o(n))(e)},date:function(e,n){return f(t,o(n))(e)},undefined:function(e){return e}}}(t,n,o,a);return function e(t,n,a){var o=r[t],l=u[n](o,a),i=s(l)?l(e):l;return Array.isArray(i)?i.join(""):i}}function d(e,t,n,r){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=_({locale:t,locales:n,localeData:r,formats:l,values:a}),u=function e(t){return Array.isArray(t)?t.reduce((function(t,n){if(i(n))return t+n;var r=o(n,3),a=r[0],l=r[1],u=r[2],c={};null==u||i(u)?c=u:Object.keys(u).forEach((function(t){c[t]=e(u[t])}));var f=s(a,l,c);return null==f?t:t+f}),""):t},c=u(e);return i(c)&&g.test(c)?JSON.parse('"'.concat(c.trim(),'"')):i(c)?c.trim():c}}var p=function(){function n(){e(this,n),this._events={}}return t(n,[{key:"on",value:function(e,t){var n=this;return this._hasEvent(e)||(this._events[e]=[]),this._events[e].push(t),function(){return n.removeListener(e,t)}}},{key:"removeListener",value:function(e,t){if(this._hasEvent(e)){var n=this._events[e].indexOf(t);~n&&this._events[e].splice(n,1)}}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];this._hasEvent(e)&&this._events[e].map((function(e){return e.apply(t,r)}))}},{key:"_hasEvent",value:function(e){return Array.isArray(this._events[e])}}]),n}();function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=a(e);if(t){var l=a(this).constructor;n=Reflect.construct(o,arguments,l)}else n=o.apply(this,arguments);return r(this,n)}}var b=function(r){n(o,r);var a=y(o);function o(t){var n;return e(this,o),n=a.call(this),n._messages={},n._localeData={},null!=t.missing&&(n._missing=t.missing),null!=t.messages&&n.load(t.messages),null!=t.localeData&&n.loadLocaleData(t.localeData),null==t.locale&&null==t.locales||n.activate(t.locale,t.locales),n}return t(o,[{key:"_loadLocaleData",value:function(e,t){null==this._localeData[e]?this._localeData[e]=t:Object.assign(this._localeData[e],t)}},{key:"loadLocaleData",value:function(e,t){var n=this;null!=t?this._loadLocaleData(e,t):Object.keys(e).forEach((function(t){return n._loadLocaleData(t,e[t])})),this.emit("change")}},{key:"_load",value:function(e,t){null==this._messages[e]?this._messages[e]=t:Object.assign(this._messages[e],t)}},{key:"load",value:function(e,t){var n=this;null!=t?this._load(e,t):Object.keys(e).forEach((function(t){return n._load(t,e[t])})),this.emit("change")}},{key:"activate",value:function(e,t){this._locale=e,this._locales=t,this.emit("change")}},{key:"_",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.message,a=n.formats,o=n.context;i(e)||(t=e.values||t,r=e.message,o=e.context,e=e.id);var l,u=!o&&!this.messages[e],c=o&&!this.messages[o][e],f=c||u,h=this._missing;return h&&f?s(h)?h(this._locale,e,o):h:(f&&this.emit("missing",{id:e,context:o,locale:this._locale}),l=o&&!c?this.messages[o][e]||r||e:this.messages[e]||r||e,i(l)&&g.test(l)?JSON.parse('"'.concat(l,'"')):i(l)?l:d(l,this._locale,this._locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return f(this._locales||this._locale,t)(e)}},{key:"number",value:function(e,t){return h(this._locales||this._locale,t)(e)}},{key:"locale",get:function(){return this._locale}},{key:"locales",get:function(){return this._locales}},{key:"messages",get:function(){var e;return null!==(e=this._messages[this._locale])&&void 0!==e?e:{}}},{key:"localeData",get:function(){var e;return null!==(e=this._localeData[this._locale])&&void 0!==e?e:{}}}]),o}(p);function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new b(e)}var k=D();export{b as I18n,m as formats,k as i18n,D as setupI18n};
|
|
2
|
-
//# sourceMappingURL=core.production.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/esm/dev/compile.d.ts
DELETED
package/esm/dev/compile.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../packages/core/src/dev/compile.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AA+CzC,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,OAAO,EAAE,MAAM,GACd,eAAe,CAOjB"}
|
package/esm/dev/index.d.ts
DELETED
package/esm/dev/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../packages/core/src/dev/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadLocaleData.d.ts","sourceRoot":"","sources":["../packages/core/src/dev/loadLocaleData.ts"],"names":[],"mappings":"iCAEwB,MAAM;;;AAA9B,wBAOC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/esm/dev.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
i18n as i18nProd,
|
|
3
|
-
setupI18n as setupI18nProd,
|
|
4
|
-
formats as formatsProd,
|
|
5
|
-
I18n as I18nProd
|
|
6
|
-
} from './dev.production.min.js';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
i18n as i18nDev,
|
|
10
|
-
setupI18n as setupI18nDev,
|
|
11
|
-
formats as formatsDev,
|
|
12
|
-
I18n as I18nDev
|
|
13
|
-
} from './dev.development.js';
|
|
14
|
-
|
|
15
|
-
export const i18n = process.env.NODE_ENV === 'production' ? i18nProd : i18nDev;
|
|
16
|
-
export const setupI18n = process.env.NODE_ENV === 'production' ? setupI18nProd : setupI18nDev;
|
|
17
|
-
export const formats = process.env.NODE_ENV === 'production' ? formatsProd : formatsDev;
|
|
18
|
-
export const I18n = process.env.NODE_ENV === 'production' ? I18nProd : I18nDev;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import n from"@babel/runtime/helpers/inherits";import r from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/slicedToArray";import l from"@babel/runtime/helpers/objectWithoutProperties";var i=function(e){return"string"==typeof e},s=function(e){return"function"==typeof e},u=new Map,c=new Map;function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(i(r)&&(r=new Date(r)),n){var a=v(e,t),o=c.get(a);if(o)return o.format(r);var l=new Intl.DateTimeFormat(e,t);return c.set(a,l),l.format(r)}var s=new Intl.DateTimeFormat(e,t);return s.format(r)}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(r){if(n){var a=v(e,t),o=u.get(a);if(o)return o.format(r);var l=new Intl.NumberFormat(e,t);return u.set(a,l),l.format(r)}var i=new Intl.NumberFormat(e,t);return i.format(r)}}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Array.isArray(e)?e.sort().join("-"):e;return"".concat(n,"-").concat(JSON.stringify(t))}var m=Object.freeze({__proto__:null,date:f,number:h}),g=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function _(e){var t=e.locale,n=e.locales,r=e.values,a=e.formats,o=e.localeData,u=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{plurals:void 0},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t=t||e;var a=n.plurals,o=function(e){return i(e)?r[e]||{style:e}:e},u=function(e,n){return function(r){var a=s(n)?n(r):n,o=Array.isArray(a)?a:[a],l=h(t)(e);return o.map((function(e){return i(e)?e.replace("#",l):e}))}};return a||console.error("Plurals for locale ".concat(e," aren't loaded. Use i18n.loadLocaleData method to load plurals for specific locale. Using other plural rule as a fallback.")),{plural:function(e,t){var n=t.offset,r=void 0===n?0:n,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-r)]||o.other;return u(e-r,i)},selectordinal:function(e,t){var n=t.offset,r=void 0===n?0:n,o=l(t,["offset"]),i=o[e]||o[null==a?void 0:a(e-r,!0)]||o.other;return u(e-r,i)},select:function(e,t){return t[e]||t.other},number:function(e,n){return h(t,o(n))(e)},date:function(e,n){return f(t,o(n))(e)},undefined:function(e){return e}}}(t,n,o,a);return function e(t,n,a){var o=r[t],l=u[n](o,a),i=s(l)?l(e):l;return Array.isArray(i)?i.join(""):i}}function d(e,t,n,r){return function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=_({locale:t,locales:n,localeData:r,formats:l,values:a}),u=function e(t){return Array.isArray(t)?t.reduce((function(t,n){if(i(n))return t+n;var r=o(n,3),a=r[0],l=r[1],u=r[2],c={};null==u||i(u)?c=u:Object.keys(u).forEach((function(t){c[t]=e(u[t])}));var f=s(a,l,c);return null==f?t:t+f}),""):t},c=u(e);return i(c)&&g.test(c)?JSON.parse('"'.concat(c.trim(),'"')):i(c)?c.trim():c}}var p=function(){function n(){e(this,n),this._events={}}return t(n,[{key:"on",value:function(e,t){var n=this;return this._hasEvent(e)||(this._events[e]=[]),this._events[e].push(t),function(){return n.removeListener(e,t)}}},{key:"removeListener",value:function(e,t){if(this._hasEvent(e)){var n=this._events[e].indexOf(t);~n&&this._events[e].splice(n,1)}}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];this._hasEvent(e)&&this._events[e].map((function(e){return e.apply(t,r)}))}},{key:"_hasEvent",value:function(e){return Array.isArray(this._events[e])}}]),n}();function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=a(e);if(t){var l=a(this).constructor;n=Reflect.construct(o,arguments,l)}else n=o.apply(this,arguments);return r(this,n)}}var b=function(r){n(o,r);var a=y(o);function o(t){var n;return e(this,o),n=a.call(this),n._messages={},n._localeData={},null!=t.missing&&(n._missing=t.missing),null!=t.messages&&n.load(t.messages),null!=t.localeData&&n.loadLocaleData(t.localeData),null==t.locale&&null==t.locales||n.activate(t.locale,t.locales),n}return t(o,[{key:"_loadLocaleData",value:function(e,t){null==this._localeData[e]?this._localeData[e]=t:Object.assign(this._localeData[e],t)}},{key:"loadLocaleData",value:function(e,t){var n=this;null!=t?this._loadLocaleData(e,t):Object.keys(e).forEach((function(t){return n._loadLocaleData(t,e[t])})),this.emit("change")}},{key:"_load",value:function(e,t){null==this._messages[e]?this._messages[e]=t:Object.assign(this._messages[e],t)}},{key:"load",value:function(e,t){var n=this;null!=t?this._load(e,t):Object.keys(e).forEach((function(t){return n._load(t,e[t])})),this.emit("change")}},{key:"activate",value:function(e,t){this._locale=e,this._locales=t,this.emit("change")}},{key:"_",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.message,a=n.formats,o=n.context;i(e)||(t=e.values||t,r=e.message,o=e.context,e=e.id);var l,u=!o&&!this.messages[e],c=o&&!this.messages[o][e],f=c||u,h=this._missing;return h&&f?s(h)?h(this._locale,e,o):h:(f&&this.emit("missing",{id:e,context:o,locale:this._locale}),l=o&&!c?this.messages[o][e]||r||e:this.messages[e]||r||e,i(l)&&g.test(l)?JSON.parse('"'.concat(l,'"')):i(l)?l:d(l,this._locale,this._locales,this.localeData)(t,a))}},{key:"date",value:function(e,t){return f(this._locales||this._locale,t)(e)}},{key:"number",value:function(e,t){return h(this._locales||this._locale,t)(e)}},{key:"locale",get:function(){return this._locale}},{key:"locales",get:function(){return this._locales}},{key:"messages",get:function(){var e;return null!==(e=this._messages[this._locale])&&void 0!==e?e:{}}},{key:"localeData",get:function(){var e;return null!==(e=this._localeData[this._locale])&&void 0!==e?e:{}}}]),o}(p);function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new b(e)}var k=D();export{b as I18n,m as formats,k as i18n,D as setupI18n};
|
|
2
|
-
//# sourceMappingURL=dev.production.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/esm/essentials.d.ts
DELETED
package/esm/essentials.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"essentials.d.ts","sourceRoot":"","sources":["packages/core/src/essentials.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,yBAA4C,CAAA;AACjE,eAAO,MAAM,UAAU,2BAAgD,CAAA;AACvE,wBAAgB,OAAO,CAAC,GAAG,KAAA,WAQ1B"}
|
package/esm/eventEmitter.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class EventEmitter<Events extends {
|
|
2
|
-
[name: string]: (...args: any[]) => any;
|
|
3
|
-
}> {
|
|
4
|
-
private readonly _events;
|
|
5
|
-
on(event: keyof Events, listener: Events[typeof event]): () => void;
|
|
6
|
-
removeListener(event: keyof Events, listener: Events[typeof event]): void;
|
|
7
|
-
emit(event: keyof Events, ...args: Parameters<Events[typeof event]>): void;
|
|
8
|
-
private _hasEvent;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=eventEmitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eventEmitter.d.ts","sourceRoot":"","sources":["packages/core/src/eventEmitter.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY,CACvB,MAAM,SAAS;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;CAAE;IAE1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAElB;IAEN,EAAE,CAAC,KAAK,EAAE,MAAM,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,KAAK,CAAC,GAAG,MAAM,IAAI;IAOnE,cAAc,CAAC,KAAK,EAAE,MAAM,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,KAAK,CAAC,GAAG,IAAI;IAOzE,IAAI,CAAC,KAAK,EAAE,MAAM,MAAM,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,GAAG,IAAI;IAM1E,OAAO,CAAC,SAAS;CAGlB"}
|
package/esm/formats.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Locales } from "./i18n";
|
|
2
|
-
export declare function date(locales: Locales, format?: Intl.DateTimeFormatOptions, memoize?: boolean): (value: string | Date) => string;
|
|
3
|
-
export declare function number(locales: Locales, format?: Intl.NumberFormatOptions, memoize?: boolean): (value: number) => string;
|
|
4
|
-
//# sourceMappingURL=formats.d.ts.map
|
package/esm/formats.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["packages/core/src/formats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAMhC,wBAAgB,IAAI,CAClB,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,IAAI,CAAC,qBAA0B,EACvC,OAAO,GAAE,OAAc,GACtB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAkBlC;AAED,wBAAgB,MAAM,CACpB,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,IAAI,CAAC,mBAAwB,EACrC,OAAO,GAAE,OAAc,GACtB,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAiB3B"}
|
package/esm/i18n.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "./eventEmitter";
|
|
2
|
-
export declare type MessageOptions = {
|
|
3
|
-
message?: string;
|
|
4
|
-
context?: string;
|
|
5
|
-
formats?: Object;
|
|
6
|
-
};
|
|
7
|
-
export declare type Locale = string;
|
|
8
|
-
export declare type Locales = Locale | Locale[];
|
|
9
|
-
export declare type LocaleData = {
|
|
10
|
-
plurals?: Function;
|
|
11
|
-
};
|
|
12
|
-
export declare type AllLocaleData = Record<Locale, LocaleData>;
|
|
13
|
-
export declare type CompiledMessage = string | Array<string | Array<string | (string | undefined) | Record<string, unknown>>>;
|
|
14
|
-
export declare type Messages = Record<string, CompiledMessage>;
|
|
15
|
-
export declare type AllMessages = Record<Locale, Messages>;
|
|
16
|
-
export declare type MessageDescriptor = {
|
|
17
|
-
id?: string;
|
|
18
|
-
comment?: string;
|
|
19
|
-
message?: string;
|
|
20
|
-
context?: string;
|
|
21
|
-
values?: Record<string, unknown>;
|
|
22
|
-
};
|
|
23
|
-
export declare type MissingMessageEvent = {
|
|
24
|
-
locale: Locale;
|
|
25
|
-
id: string;
|
|
26
|
-
context?: string;
|
|
27
|
-
};
|
|
28
|
-
declare type setupI18nProps = {
|
|
29
|
-
locale?: Locale;
|
|
30
|
-
locales?: Locales;
|
|
31
|
-
messages?: AllMessages;
|
|
32
|
-
localeData?: AllLocaleData;
|
|
33
|
-
missing?: string | ((message: any, id: any, context: any) => string);
|
|
34
|
-
};
|
|
35
|
-
declare type Events = {
|
|
36
|
-
change: () => void;
|
|
37
|
-
missing: (event: MissingMessageEvent) => void;
|
|
38
|
-
};
|
|
39
|
-
export declare class I18n extends EventEmitter<Events> {
|
|
40
|
-
_locale: Locale;
|
|
41
|
-
_locales: Locales;
|
|
42
|
-
_localeData: AllLocaleData;
|
|
43
|
-
_messages: AllMessages;
|
|
44
|
-
_missing: string | ((message: any, id: any, context: any) => string);
|
|
45
|
-
constructor(params: setupI18nProps);
|
|
46
|
-
get locale(): string;
|
|
47
|
-
get locales(): Locales;
|
|
48
|
-
get messages(): Messages;
|
|
49
|
-
get localeData(): LocaleData;
|
|
50
|
-
_loadLocaleData(locale: Locale, localeData: LocaleData): void;
|
|
51
|
-
loadLocaleData(allLocaleData: AllLocaleData): void;
|
|
52
|
-
loadLocaleData(locale: Locale, localeData: LocaleData): void;
|
|
53
|
-
_load(locale: Locale, messages: Messages): void;
|
|
54
|
-
load(allMessages: AllMessages): void;
|
|
55
|
-
load(locale: Locale, messages: Messages): void;
|
|
56
|
-
activate(locale: Locale, locales?: Locales): void;
|
|
57
|
-
_(id: MessageDescriptor | string, values?: Object | undefined, { message, formats, context }?: MessageOptions | undefined): string;
|
|
58
|
-
date(value: string | Date, format?: Intl.DateTimeFormatOptions): string;
|
|
59
|
-
number(value: number, format?: Intl.NumberFormatOptions): string;
|
|
60
|
-
}
|
|
61
|
-
declare function setupI18n(params?: setupI18nProps): I18n;
|
|
62
|
-
export { setupI18n };
|
|
63
|
-
//# sourceMappingURL=i18n.d.ts.map
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AE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAkBrD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;IAmB1C,CAAC,CACC,EAAE,EAAE,iBAAiB,GAAG,MAAM,EAC9B,MAAM,GAAE,MAAM,GAAG,SAAc,EAC/B,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAE,cAAc,GAAG,SAAc;IAmDhE,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,GAAG,MAAM;IAIvE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,mBAAmB,GAAG,MAAM;CAGjE;AAED,iBAAS,SAAS,CAAC,MAAM,GAAE,cAAmB,GAAG,IAAI,CAEpD;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
package/esm/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { setupI18n, I18n, AllMessages, MessageDescriptor, Messages, AllLocaleData, LocaleData, Locale, Locales, } from "./i18n";
|
|
2
|
-
export declare const i18n: import("./i18n").I18n;
|
|
3
|
-
import * as formats from "./formats";
|
|
4
|
-
export { formats };
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["packages/core/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,WAAW,EACX,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,UAAU,EACV,MAAM,EACN,OAAO,GACR,MAAM,QAAQ,CAAA;AAIf,eAAO,MAAM,IAAI,uBAAc,CAAA;AAE/B,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
package/esm/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
i18n as i18nProd,
|
|
3
|
-
setupI18n as setupI18nProd,
|
|
4
|
-
formats as formatsProd,
|
|
5
|
-
I18n as I18nProd
|
|
6
|
-
} from './core.production.min.js';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
i18n as i18nDev,
|
|
10
|
-
setupI18n as setupI18nDev,
|
|
11
|
-
formats as formatsDev,
|
|
12
|
-
I18n as I18nDev
|
|
13
|
-
} from './core.development.js';
|
|
14
|
-
|
|
15
|
-
export const i18n = process.env.NODE_ENV === 'production' ? i18nProd : i18nDev;
|
|
16
|
-
export const setupI18n = process.env.NODE_ENV === 'production' ? setupI18nProd : setupI18nDev;
|
|
17
|
-
export const formats = process.env.NODE_ENV === 'production' ? formatsProd : formatsDev;
|
|
18
|
-
export const I18n = process.env.NODE_ENV === 'production' ? I18nProd : I18nDev;
|