@kong-ui-public/i18n 2.1.4-pr.1170.bda7c038.0 → 2.1.4
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/dist/i18n.es.js +6 -5
- package/dist/i18n.umd.js +1 -1
- package/package.json +1 -1
package/dist/i18n.es.js
CHANGED
|
@@ -3408,13 +3408,14 @@ const fr = (e = null) => Ue({
|
|
|
3408
3408
|
return i.split(a).filter(Boolean);
|
|
3409
3409
|
};
|
|
3410
3410
|
return () => {
|
|
3411
|
-
|
|
3411
|
+
var s;
|
|
3412
|
+
const i = Object.keys(n).filter((u) => u !== "_"), a = ((s = (e || t.i18n).messages[t.keypath]) == null ? void 0 : s.toString()) || "";
|
|
3412
3413
|
let o = r(a);
|
|
3413
|
-
return o = o.filter((
|
|
3414
|
-
if (!
|
|
3414
|
+
return o = o.filter((u) => u !== ""), o.forEach((u, l) => {
|
|
3415
|
+
if (!u.startsWith("{") && !u.endsWith("}"))
|
|
3415
3416
|
return;
|
|
3416
|
-
const
|
|
3417
|
-
|
|
3417
|
+
const h = u.replace(/[\{\}]/g, "");
|
|
3418
|
+
h === "0" && n.default ? o[l] = n.default() : i.includes(h) && n[h] && (o[l] = n[h]());
|
|
3418
3419
|
}), Ve(t.tag, t, o);
|
|
3419
3420
|
};
|
|
3420
3421
|
}
|
package/dist/i18n.umd.js
CHANGED
|
@@ -19,4 +19,4 @@ Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
|
19
19
|
Try polyfilling it using "@formatjs/intl-relativetimeformat"
|
|
20
20
|
`,P.MISSING_INTL_API));try{return er(e,t,i).format(n,r)}catch(o){e.onError(new H("Error formatting relative time.",e.locale,o))}return String(n)}var rr=["style","currency","unit","unitDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","currencyDisplay","currencySign","notation","signDisplay","unit","unitDisplay","numberingSystem","trailingZeroDisplay","roundingPriority","roundingIncrement","roundingMode"];function Fe(e,t,n){var r=e.locale,i=e.formats,a=e.onError;n===void 0&&(n={});var o=n.format,s=o&&ie(i,"number",o,a)||{},u=M(n,rr,s);return t(r,u)}function nr(e,t,n,r){r===void 0&&(r={});try{return Fe(e,t,r).format(n)}catch(i){e.onError(new H("Error formatting number.",e.locale,i))}return String(n)}function ir(e,t,n,r){r===void 0&&(r={});try{return Fe(e,t,r).formatToParts(n)}catch(i){e.onError(new H("Error formatting number.",e.locale,i))}return[]}function ar(e){var t=e?e[Object.keys(e)[0]]:void 0;return typeof t=="string"}function or(e){e.onWarn&&e.defaultRichTextElements&&ar(e.messages||{})&&e.onWarn(`[@formatjs/intl] "defaultRichTextElements" was specified but "message" was not pre-compiled.
|
|
21
21
|
Please consider using "@formatjs/cli" to pre-compile your messages for performance.
|
|
22
|
-
For more details see https://formatjs.io/docs/getting-started/message-distribution`)}function sr(e,t){var n=Gt(t),r=f(f({},Ft),e),i=r.locale,a=r.defaultLocale,o=r.onError;return i?!Intl.NumberFormat.supportedLocalesOf(i).length&&o?o(new Pe('Missing locale data for locale: "'.concat(i,'" in Intl.NumberFormat. Using default locale: "').concat(a,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):!Intl.DateTimeFormat.supportedLocalesOf(i).length&&o&&o(new Pe('Missing locale data for locale: "'.concat(i,'" in Intl.DateTimeFormat. Using default locale: "').concat(a,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):(o&&o(new Mt('"locale" was not configured, using "'.concat(a,'" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details'))),r.locale=r.defaultLocale||"en"),or(r),f(f({},r),{formatters:n,formatNumber:nr.bind(null,r,n.getNumberFormat),formatNumberToParts:ir.bind(null,r,n.getNumberFormat),formatRelativeTime:tr.bind(null,r,n.getRelativeTimeFormat),formatDate:Vt.bind(null,r,n.getDateTimeFormat),formatDateToParts:Xt.bind(null,r,n.getDateTimeFormat),formatTime:kt.bind(null,r,n.getDateTimeFormat),formatDateTimeRange:jt.bind(null,r,n.getDateTimeFormat),formatTimeToParts:Wt.bind(null,r,n.getDateTimeFormat),formatPlural:$t.bind(null,r,n.getPluralRules),formatMessage:Me.bind(null,r,n),$t:Me.bind(null,r,n),formatList:Qt.bind(null,r,n.getListFormat),formatListToParts:we.bind(null,r,n.getListFormat),formatDisplayName:zt.bind(null,r,n.getDisplayNames)})}function ur(e){return e&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function hr(e){return e}function lr(e,t){t=t||{};const n=t.delimiter||".",r=t.maxDepth,i=t.transformKey||hr,a={};function o(s,u,l){l=l||1,Object.keys(s).forEach(function(h){const c=s[h],m=t.safe&&Array.isArray(c),E=Object.prototype.toString.call(c),y=ur(c),v=E==="[object Object]"||E==="[object Array]",d=u?u+n+i(h):i(h);if(!m&&!y&&v&&Object.keys(c).length&&(!t.maxDepth||l<r))return o(c,d,l+1);a[d]=c})}return o(e),a}const fr=Re();let Ge;const Ue={year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"},cr=(e,t,n=!1)=>{var y;const r=typeof n=="boolean",i=sr({...r?null:n,locale:e,messages:lr(t,{safe:!0}),formats:{...r?null:n.formats,date:{...r?null:(y=n.formats)==null?void 0:y.date,datetime:Ue}}},fr),{$t:a,...o}=i,s=o,u=v=>{const d="Invalid Date";if(!v)return d;try{const x=new Date(v*1e3);return s.formatDate(x,Ue)}catch{return d}},E={formatUnixTimeStamp:u,formatIsoDate:v=>{const d=Date.parse(v)/1e3;return u(d)},t:(v,d,x)=>s.formatMessage({id:v},d,x),te:v=>!!s.messages[v],tm:v=>s.messages[v]||[],...s,source:t};return(typeof n=="boolean"&&n===!0||typeof n!="boolean"&&n.isGlobal===!0)&&(Ge=E),E};function mr(){return Ge}const Ve=(e=null)=>w.defineComponent({name:"I18nT",props:{i18n:{type:Object,default:null},keypath:{type:String,required:!0},tag:{type:String,default:"span"}},setup(t,{slots:n}){const r=i=>{if(!i)return[];const a=/(\{[^}]+\})/g;return i.split(a).filter(Boolean)};return()=>{const i=Object.keys(n).filter(
|
|
22
|
+
For more details see https://formatjs.io/docs/getting-started/message-distribution`)}function sr(e,t){var n=Gt(t),r=f(f({},Ft),e),i=r.locale,a=r.defaultLocale,o=r.onError;return i?!Intl.NumberFormat.supportedLocalesOf(i).length&&o?o(new Pe('Missing locale data for locale: "'.concat(i,'" in Intl.NumberFormat. Using default locale: "').concat(a,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):!Intl.DateTimeFormat.supportedLocalesOf(i).length&&o&&o(new Pe('Missing locale data for locale: "'.concat(i,'" in Intl.DateTimeFormat. Using default locale: "').concat(a,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):(o&&o(new Mt('"locale" was not configured, using "'.concat(a,'" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details'))),r.locale=r.defaultLocale||"en"),or(r),f(f({},r),{formatters:n,formatNumber:nr.bind(null,r,n.getNumberFormat),formatNumberToParts:ir.bind(null,r,n.getNumberFormat),formatRelativeTime:tr.bind(null,r,n.getRelativeTimeFormat),formatDate:Vt.bind(null,r,n.getDateTimeFormat),formatDateToParts:Xt.bind(null,r,n.getDateTimeFormat),formatTime:kt.bind(null,r,n.getDateTimeFormat),formatDateTimeRange:jt.bind(null,r,n.getDateTimeFormat),formatTimeToParts:Wt.bind(null,r,n.getDateTimeFormat),formatPlural:$t.bind(null,r,n.getPluralRules),formatMessage:Me.bind(null,r,n),$t:Me.bind(null,r,n),formatList:Qt.bind(null,r,n.getListFormat),formatListToParts:we.bind(null,r,n.getListFormat),formatDisplayName:zt.bind(null,r,n.getDisplayNames)})}function ur(e){return e&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function hr(e){return e}function lr(e,t){t=t||{};const n=t.delimiter||".",r=t.maxDepth,i=t.transformKey||hr,a={};function o(s,u,l){l=l||1,Object.keys(s).forEach(function(h){const c=s[h],m=t.safe&&Array.isArray(c),E=Object.prototype.toString.call(c),y=ur(c),v=E==="[object Object]"||E==="[object Array]",d=u?u+n+i(h):i(h);if(!m&&!y&&v&&Object.keys(c).length&&(!t.maxDepth||l<r))return o(c,d,l+1);a[d]=c})}return o(e),a}const fr=Re();let Ge;const Ue={year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"},cr=(e,t,n=!1)=>{var y;const r=typeof n=="boolean",i=sr({...r?null:n,locale:e,messages:lr(t,{safe:!0}),formats:{...r?null:n.formats,date:{...r?null:(y=n.formats)==null?void 0:y.date,datetime:Ue}}},fr),{$t:a,...o}=i,s=o,u=v=>{const d="Invalid Date";if(!v)return d;try{const x=new Date(v*1e3);return s.formatDate(x,Ue)}catch{return d}},E={formatUnixTimeStamp:u,formatIsoDate:v=>{const d=Date.parse(v)/1e3;return u(d)},t:(v,d,x)=>s.formatMessage({id:v},d,x),te:v=>!!s.messages[v],tm:v=>s.messages[v]||[],...s,source:t};return(typeof n=="boolean"&&n===!0||typeof n!="boolean"&&n.isGlobal===!0)&&(Ge=E),E};function mr(){return Ge}const Ve=(e=null)=>w.defineComponent({name:"I18nT",props:{i18n:{type:Object,default:null},keypath:{type:String,required:!0},tag:{type:String,default:"span"}},setup(t,{slots:n}){const r=i=>{if(!i)return[];const a=/(\{[^}]+\})/g;return i.split(a).filter(Boolean)};return()=>{var s;const i=Object.keys(n).filter(u=>u!=="_"),a=((s=(e||t.i18n).messages[t.keypath])==null?void 0:s.toString())||"";let o=r(a);return o=o.filter(u=>u!==""),o.forEach((u,l)=>{if(!u.startsWith("{")&&!u.endsWith("}"))return;const h=u.replace(/[\{\}]/g,"");h==="0"&&n.default?o[l]=n.default():i.includes(h)&&n[h]&&(o[l]=n[h]())}),w.h(t.tag,t,o)}}}),gr={install(e,t){const{i18n:n}=t;e.component("I18nT",Ve(n))}};A.Translation=gr,A.createI18n=cr,A.i18nTComponent=Ve,A.useI18n=mr,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|