Socket
Socket
Sign inDemoInstall

svelte-i18n

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-i18n - npm Package Compare versions

Comparing version 3.4.0 to 3.4.1

92

dist/cli.js

@@ -35,37 +35,2 @@ #!/usr/bin/env node

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
/* eslint-disable no-multi-assign */

@@ -91,2 +56,4 @@ /* eslint-disable no-return-assign */

return exprNode.properties.reduce((acc, prop) => {
if (prop.type === 'SpreadElement')
return acc;
// we only want primitives

@@ -128,2 +95,3 @@ if (prop.value.type === 'Literal' &&

/* eslint-disable @typescript-eslint/no-non-null-assertion */
const LIB_NAME = 'svelte-i18n';

@@ -153,6 +121,6 @@ const DEFINE_MESSAGES_METHOD_NAME = 'defineMessages';

function getLibImportDeclarations(ast) {
var _a, _b;
var _a, _b, _c, _d;
const bodyElements = [
...(((_a = ast.instance) === null || _a === void 0 ? void 0 : _a.content.body) || []),
...(((_b = ast.module) === null || _b === void 0 ? void 0 : _b.content.body) || []),
...((_b = (_a = ast.instance) === null || _a === void 0 ? void 0 : _a.content.body) !== null && _b !== void 0 ? _b : []),
...((_d = (_c = ast.module) === null || _c === void 0 ? void 0 : _c.content.body) !== null && _d !== void 0 ? _d : []),
];

@@ -181,6 +149,14 @@ return bodyElements.filter((node) => node.type === 'ImportDeclaration' && node.source.value === LIB_NAME);

}
// @ts-expect-error - https://github.com/Rich-Harris/estree-walker/issues/28
estreeWalker.walk(ast.instance, { enter });
// @ts-expect-error - https://github.com/Rich-Harris/estree-walker/issues/28
estreeWalker.walk(ast.html, { enter });
return calls;
}
// walk(ast: import("estree").BaseNode, { enter, leave }: {
// enter?: (this: {
// skip: () => void;
// remove: () => void;
// replace: (node: import("estree").BaseNode) => void;
// }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void;
function collectMessageDefinitions(ast) {

@@ -203,3 +179,5 @@ const definitions = [];

};
// @ts-expect-error - https://github.com/Rich-Harris/estree-walker/issues/28
estreeWalker.walk(ast.instance, nodeStepInstructions);
// @ts-expect-error - https://github.com/Rich-Harris/estree-walker/issues/28
estreeWalker.walk(ast.module, nodeStepInstructions);

@@ -245,3 +223,3 @@ return definitions.flatMap((definitionDict) => definitionDict.properties.map((propNode) => {

}
function extractMessages(markup, { accumulator = {}, shallow = false, overwrite = false } = {}) {
function extractMessages(markup, { accumulator = {}, shallow = false, } = {}) {
collectMessages(markup).forEach((messageObj) => {

@@ -253,12 +231,9 @@ let defaultValue = messageObj.default;

if (shallow) {
if (overwrite === false && messageObj.id in accumulator) {
if (messageObj.id in accumulator)
return;
}
accumulator[messageObj.id] = defaultValue;
}
else {
if (overwrite === false &&
typeof delve(accumulator, messageObj.id) !== 'undefined') {
if (typeof delve(accumulator, messageObj.id) !== 'undefined')
return;
}
deepSet(accumulator, messageObj.id, defaultValue);

@@ -282,3 +257,2 @@ }

.action(async (globStr, output, { shallow, overwrite, config }) => {
var e_1, _a;
const filesToExtract = (await glob__default["default"](globStr)).filter((file) => file.match(/\.html|svelte$/i));

@@ -295,23 +269,13 @@ const svelteConfig = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(path.resolve(config, 'svelte.config.js')).catch(() => null);

}
try {
for (var filesToExtract_1 = __asyncValues(filesToExtract), filesToExtract_1_1; filesToExtract_1_1 = await filesToExtract_1.next(), !filesToExtract_1_1.done;) {
const filePath = filesToExtract_1_1.value;
const buffer = await readFile(filePath);
let content = buffer.toString();
if (svelteConfig === null || svelteConfig === void 0 ? void 0 : svelteConfig.preprocess) {
const processed = await compiler.preprocess(content, svelteConfig.preprocess, {
filename: filePath,
});
content = processed.code;
}
extractMessages(content, { filePath, accumulator, shallow });
for await (const filePath of filesToExtract) {
const buffer = await readFile(filePath);
let content = buffer.toString();
if (svelteConfig === null || svelteConfig === void 0 ? void 0 : svelteConfig.preprocess) {
const processed = await compiler.preprocess(content, svelteConfig.preprocess, {
filename: filePath,
});
content = processed.code;
}
extractMessages(content, { accumulator, shallow });
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (filesToExtract_1_1 && !filesToExtract_1_1.done && (_a = filesToExtract_1.return)) await _a.call(filesToExtract_1);
}
finally { if (e_1) throw e_1.error; }
}
const jsonDictionary = JSON.stringify(accumulator, null, ' ');

@@ -318,0 +282,0 @@ if (output == null)

@@ -1,16 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("svelte/store"),t=require("deepmerge"),n=require("intl-messageformat");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(t),i=o(n);const s={},a=(e,t,n)=>n?(t in s||(s[t]={}),e in s[t]||(s[t][e]=n),n):n,l=(e,t)=>{if(null==t)return;if(t in s&&e in s[t])return s[t][e];const n=k(t);for(let o=0;o<n.length;o++){const r=f(n[o],e);if(r)return a(e,t,r)}};let u;const c=e.writable({});function m(e){return e in u}function f(e,t){if(!m(e))return null;const n=function(e){return u[e]||null}(e);return function(e,t){if(null==t)return;if(t in e)return e[t];const n=t.split(".");let o=e;for(let e=0;e<n.length;e++)if("object"==typeof o){if(e>0){const t=n.slice(e,n.length).join(".");if(t in o){o=o[t];break}}o=o[n[e]]}else o=void 0;return o}(n,t)}function d(e,...t){delete s[e],c.update((n=>(n[e]=r.default.all([n[e]||{},...t]),n)))}const g=e.derived([c],(([e])=>Object.keys(e)));c.subscribe((e=>u=e));const p={};function h(e){return p[e]}function w(e){return null!=e&&k(e).some((e=>{var t;return null===(t=h(e))||void 0===t?void 0:t.size}))}function b(e,t){const n=Promise.all(t.map((t=>(function(e,t){p[e].delete(t),0===p[e].size&&delete p[e]}(e,t),t().then((e=>e.default||e))))));return n.then((t=>d(e,...t)))}const v={};function y(e){if(!w(e))return e in v?v[e]:Promise.resolve();const t=function(e){return k(e).map((e=>{const t=h(e);return[e,t?[...t]:[]]})).filter((([,e])=>e.length>0))}(e);return v[e]=Promise.all(t.map((([e,t])=>b(e,t)))).then((()=>{if(w(e))return y(e);delete v[e]})),v[e]}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function x(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function O({locale:e,id:t}){console.warn(`[svelte-i18n] The message "${t}" was not found in "${k(e).join('", "')}".${w(P())?"\n\nNote: there are at least one loader still registered to this locale that wasn't executed.":""}`)}const j={fallbackLocale:null,loadingDelay:200,formats:{number:{scientific:{notation:"scientific"},engineering:{notation:"engineering"},compactLong:{notation:"compact",compactDisplay:"long"},compactShort:{notation:"compact",compactDisplay:"short"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},warnOnMissingMessages:!0,handleMissingMessage:void 0,ignoreTag:!0};function M(){return j}const L=e.writable(!1);let F;const T=e.writable(null);function $(e){return e.split("-").map(((e,t,n)=>n.slice(0,t+1).join("-"))).reverse()}function k(e,t=M().fallbackLocale){const n=$(e);return t?[...new Set([...n,...$(t)])]:n}function P(){return null!=F?F:void 0}T.subscribe((e=>{F=null!=e?e:void 0,"undefined"!=typeof window&&null!=e&&document.documentElement.setAttribute("lang",e)}));const D=Object.assign(Object.assign({},T),{set:e=>{if(e&&function(e){if(null==e)return;const t=k(e);for(let e=0;e<t.length;e++){const n=t[e];if(m(n))return n}}(e)&&w(e)){const{loadingDelay:t}=M();let n;return"undefined"!=typeof window&&null!=P()&&t?n=window.setTimeout((()=>L.set(!0)),t):L.set(!0),y(e).then((()=>{T.set(e)})).finally((()=>{clearTimeout(n),L.set(!1)}))}return T.set(e)}}),E=(e,t)=>{const n=e.split("&").find((e=>0===e.indexOf(`${t}=`)));return n?n.split("=").pop():null},N=(e,t)=>{const n=t.exec(e);return n&&n[1]||null},S=e=>{const t=Object.create(null);return n=>{const o=JSON.stringify(n);return o in t?t[o]:t[o]=e(n)}},A=(e,t)=>{const{formats:n}=M();if(e in n&&t in n[e])return n[e][t];throw new Error(`[svelte-i18n] Unknown "${t}" ${e} format.`)},I=S((e=>{var{locale:t,format:n}=e,o=x(e,["locale","format"]);if(null==t)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return n&&(o=A("number",n)),new Intl.NumberFormat(t,o)})),q=S((e=>{var{locale:t,format:n}=e,o=x(e,["locale","format"]);if(null==t)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return n?o=A("date",n):0===Object.keys(o).length&&(o=A("date","short")),new Intl.DateTimeFormat(t,o)})),_=S((e=>{var{locale:t,format:n}=e,o=x(e,["locale","format"]);if(null==t)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return n?o=A("time",n):0===Object.keys(o).length&&(o=A("time","short")),new Intl.DateTimeFormat(t,o)})),z=(e={})=>{var{locale:t=P()}=e,n=x(e,["locale"]);return I(Object.assign({locale:t},n))},H=(e={})=>{var{locale:t=P()}=e,n=x(e,["locale"]);return q(Object.assign({locale:t},n))},Z=(e={})=>{var{locale:t=P()}=e,n=x(e,["locale"]);return _(Object.assign({locale:t},n))},C=S(((e,t=P())=>new i.default(e,t,M().formats,{ignoreTag:M().ignoreTag}))),G=(e,t={})=>{var n,o,r,i;let s=t;"object"==typeof e&&(s=e,e=s.id);const{values:a,locale:u=P(),default:c}=s;if(null==u)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let m=l(e,u);if(m){if("string"!=typeof m)return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof m}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),m}else m=null!==(i=null!==(r=null===(o=(n=M()).handleMissingMessage)||void 0===o?void 0:o.call(n,{locale:u,id:e,defaultValue:c}))&&void 0!==r?r:c)&&void 0!==i?i:e;if(!a)return m;let f=m;try{f=C(m,u).format(a)}catch(t){console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,t.message)}return f},J=(e,t)=>Z(t).format(e),Q=(e,t)=>H(t).format(e),U=(e,t)=>z(t).format(e),V=(e,t=P())=>l(e,t),B=e.derived([D,c],(()=>G)),K=e.derived([D],(()=>J)),R=e.derived([D],(()=>Q)),W=e.derived([D],(()=>U)),X=e.derived([D,c],(()=>V));exports._=B,exports.addMessages=d,exports.date=R,exports.defineMessages=function(e){return e},exports.dictionary=c,exports.format=B,exports.getDateFormatter=H,exports.getLocaleFromHash=e=>"undefined"==typeof window?null:E(window.location.hash.substr(1),e),exports.getLocaleFromHostname=e=>"undefined"==typeof window?null:N(window.location.hostname,e),exports.getLocaleFromNavigator=()=>"undefined"==typeof window?null:window.navigator.language||window.navigator.languages[0],exports.getLocaleFromPathname=e=>"undefined"==typeof window?null:N(window.location.pathname,e),exports.getLocaleFromQueryString=e=>"undefined"==typeof window?null:E(window.location.search.substr(1),e),exports.getMessageFormatter=C,exports.getNumberFormatter=z,exports.getTimeFormatter=Z,exports.init=function(e){const{formats:t}=e,n=x(e,["formats"]),o=e.initialLocale||e.fallbackLocale;return n.warnOnMissingMessages&&(delete n.warnOnMissingMessages,null==n.handleMissingMessage?n.handleMissingMessage=O:console.warn('[svelte-i18n] The "warnOnMissingMessages" option is deprecated. Please use the "handleMissingMessage" option instead.')),Object.assign(j,n,{initialLocale:o}),t&&("number"in t&&Object.assign(j.formats.number,t.number),"date"in t&&Object.assign(j.formats.date,t.date),"time"in t&&Object.assign(j.formats.time,t.time)),D.set(o)},exports.isLoading=L,exports.json=X,exports.locale=D,exports.locales=g,exports.number=W,exports.register=function(e,t){h(e)||function(e){p[e]=new Set}(e);const n=h(e);h(e).has(t)||(m(e)||c.update((t=>(t[e]={},t))),n.add(t))},exports.t=B,exports.time=K,exports.waitLocale=function(e){return y(e||P()||M().initialLocale)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("svelte/store"),t=require("deepmerge"),n=require("intl-messageformat");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(t),i=o(n);const s={},l=(e,t,n)=>n?(t in s||(s[t]={}),e in s[t]||(s[t][e]=n),n):n,a=(e,t)=>{if(null==t)return;if(t in s&&e in s[t])return s[t][e];const n=$(t);for(let o=0;o<n.length;o++){const r=d(n[o],e);if(r)return l(e,t,r)}};let u;const c=e.writable({});function m(e){return e in u}function d(e,t){if(!m(e))return null;const n=function(e){return u[e]||null}(e);return function(e,t){if(null==t)return;if(t in e)return e[t];const n=t.split(".");let o=e;for(let e=0;e<n.length;e++)if("object"==typeof o){if(e>0){const t=n.slice(e,n.length).join(".");if(t in o){o=o[t];break}}o=o[n[e]]}else o=void 0;return o}(n,t)}function f(e,...t){delete s[e],c.update((n=>(n[e]=r.default.all([n[e]||{},...t]),n)))}const g=e.derived([c],(([e])=>Object.keys(e)));c.subscribe((e=>u=e));const p={};function h(e){return p[e]}function w(e){return null!=e&&$(e).some((e=>{var t;return null===(t=h(e))||void 0===t?void 0:t.size}))}function b(e,t){const n=Promise.all(t.map((t=>(function(e,t){p[e].delete(t),0===p[e].size&&delete p[e]}(e,t),t().then((e=>e.default||e))))));return n.then((t=>f(e,...t)))}const v={};function y(e){if(!w(e))return e in v?v[e]:Promise.resolve();const t=function(e){return $(e).map((e=>{const t=h(e);return[e,t?[...t]:[]]})).filter((([,e])=>e.length>0))}(e);return v[e]=Promise.all(t.map((([e,t])=>b(e,t)))).then((()=>{if(w(e))return y(e);delete v[e]})),v[e]}function x({locale:e,id:t}){console.warn(`[svelte-i18n] The message "${t}" was not found in "${$(e).join('", "')}".${w(k())?"\n\nNote: there are at least one loader still registered to this locale that wasn't executed.":""}`)}const M={fallbackLocale:null,loadingDelay:200,formats:{number:{scientific:{notation:"scientific"},engineering:{notation:"engineering"},compactLong:{notation:"compact",compactDisplay:"long"},compactShort:{notation:"compact",compactDisplay:"short"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},warnOnMissingMessages:!0,handleMissingMessage:void 0,ignoreTag:!0};function j(){return M}const O=e.writable(!1);let L;const F=e.writable(null);function T(e){return e.split("-").map(((e,t,n)=>n.slice(0,t+1).join("-"))).reverse()}function $(e,t=j().fallbackLocale){const n=T(e);return t?[...new Set([...n,...T(t)])]:n}function k(){return null!=L?L:void 0}F.subscribe((e=>{L=null!=e?e:void 0,"undefined"!=typeof window&&null!=e&&document.documentElement.setAttribute("lang",e)}));const D={...F,set:e=>{if(e&&function(e){if(null==e)return;const t=$(e);for(let e=0;e<t.length;e++){const n=t[e];if(m(n))return n}}(e)&&w(e)){const{loadingDelay:t}=j();let n;return"undefined"!=typeof window&&null!=k()&&t?n=window.setTimeout((()=>O.set(!0)),t):O.set(!0),y(e).then((()=>{F.set(e)})).finally((()=>{clearTimeout(n),O.set(!1)}))}return F.set(e)}},E=(e,t)=>{const n=e.split("&").find((e=>0===e.indexOf(`${t}=`)));return n?n.split("=").pop():null},N=(e,t)=>{const n=t.exec(e);return n&&n[1]||null},P=e=>{const t=Object.create(null);return n=>{const o=JSON.stringify(n);return o in t?t[o]:t[o]=e(n)}},S=(e,t)=>{const{formats:n}=j();if(e in n&&t in n[e])return n[e][t];throw new Error(`[svelte-i18n] Unknown "${t}" ${e} format.`)},A=P((({locale:e,format:t,...n})=>{if(null==e)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return t&&(n=S("number",t)),new Intl.NumberFormat(e,n)})),q=P((({locale:e,format:t,...n})=>{if(null==e)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return t?n=S("date",t):0===Object.keys(n).length&&(n=S("date","short")),new Intl.DateTimeFormat(e,n)})),I=P((({locale:e,format:t,...n})=>{if(null==e)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return t?n=S("time",t):0===Object.keys(n).length&&(n=S("time","short")),new Intl.DateTimeFormat(e,n)})),_=({locale:e=k(),...t}={})=>A({locale:e,...t}),z=({locale:e=k(),...t}={})=>q({locale:e,...t}),H=({locale:e=k(),...t}={})=>I({locale:e,...t}),Z=P(((e,t=k())=>new i.default(e,t,j().formats,{ignoreTag:j().ignoreTag}))),C=(e,t={})=>{var n,o,r,i;let s=t;"object"==typeof e&&(s=e,e=s.id);const{values:l,locale:u=k(),default:c}=s;if(null==u)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let m=a(e,u);if(m){if("string"!=typeof m)return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof m}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),m}else m=null!==(i=null!==(r=null===(o=(n=j()).handleMissingMessage)||void 0===o?void 0:o.call(n,{locale:u,id:e,defaultValue:c}))&&void 0!==r?r:c)&&void 0!==i?i:e;if(!l)return m;let d=m;try{d=Z(m,u).format(l)}catch(t){t instanceof Error&&console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,t.message)}return d},G=(e,t)=>H(t).format(e),J=(e,t)=>z(t).format(e),Q=(e,t)=>_(t).format(e),U=(e,t=k())=>a(e,t),V=e.derived([D,c],(()=>C)),B=e.derived([D],(()=>G)),K=e.derived([D],(()=>J)),R=e.derived([D],(()=>Q)),W=e.derived([D,c],(()=>U));exports._=V,exports.addMessages=f,exports.date=K,exports.defineMessages=function(e){return e},exports.dictionary=c,exports.format=V,exports.getDateFormatter=z,exports.getLocaleFromHash=e=>"undefined"==typeof window?null:E(window.location.hash.substr(1),e),exports.getLocaleFromHostname=e=>"undefined"==typeof window?null:N(window.location.hostname,e),exports.getLocaleFromNavigator=()=>"undefined"==typeof window?null:window.navigator.language||window.navigator.languages[0],exports.getLocaleFromPathname=e=>"undefined"==typeof window?null:N(window.location.pathname,e),exports.getLocaleFromQueryString=e=>"undefined"==typeof window?null:E(window.location.search.substr(1),e),exports.getMessageFormatter=Z,exports.getNumberFormatter=_,exports.getTimeFormatter=H,exports.init=function(e){const{formats:t,...n}=e,o=e.initialLocale||e.fallbackLocale;return n.warnOnMissingMessages&&(delete n.warnOnMissingMessages,null==n.handleMissingMessage?n.handleMissingMessage=x:console.warn('[svelte-i18n] The "warnOnMissingMessages" option is deprecated. Please use the "handleMissingMessage" option instead.')),Object.assign(M,n,{initialLocale:o}),t&&("number"in t&&Object.assign(M.formats.number,t.number),"date"in t&&Object.assign(M.formats.date,t.date),"time"in t&&Object.assign(M.formats.time,t.time)),D.set(o)},exports.isLoading=O,exports.json=W,exports.locale=D,exports.locales=g,exports.number=R,exports.register=function(e,t){h(e)||function(e){p[e]=new Set}(e);const n=h(e);h(e).has(t)||(m(e)||c.update((t=>(t[e]={},t))),n.add(t))},exports.t=V,exports.time=B,exports.waitLocale=function(e){return y(e||k()||j().initialLocale)};

@@ -0,11 +1,17 @@

import * as svelte_store from 'svelte/store';
import IntlMessageFormat, { FormatXMLElementFn, Formats } from 'intl-messageformat';
import * as svelte_store from 'svelte/store';
declare const $locale: {
set: (newLocale: string | null | undefined) => void | Promise<void>;
update(this: void, updater: svelte_store.Updater<string | null | undefined>): void;
subscribe(this: void, run: svelte_store.Subscriber<string | null | undefined>, invalidate?: ((value?: string | null | undefined) => void) | undefined): svelte_store.Unsubscriber;
};
interface LocaleDictionary {
[key: string]: LocaleDictionary | string | Array<string | LocaleDictionary> | null;
}
declare type LocalesDictionary = {
type LocalesDictionary = {
[key: string]: LocaleDictionary;
};
declare type InterpolationValues = Record<string, string | number | boolean | Date | FormatXMLElementFn<unknown> | null | undefined> | undefined;
type InterpolationValues = Record<string, string | number | boolean | Date | FormatXMLElementFn<unknown> | null | undefined> | undefined;
interface MessageObject {

@@ -18,7 +24,7 @@ id: string;

}
declare type MessageFormatter = (id: string | MessageObject, options?: Omit<MessageObject, 'id'>) => string;
declare type TimeFormatter = (d: Date | number, options?: IntlFormatterOptions<Intl.DateTimeFormatOptions>) => string;
declare type DateFormatter = (d: Date | number, options?: IntlFormatterOptions<Intl.DateTimeFormatOptions>) => string;
declare type NumberFormatter = (d: number, options?: IntlFormatterOptions<Intl.NumberFormatOptions>) => string;
declare type IntlFormatterOptions<T> = T & {
type MessageFormatter = (id: string | MessageObject, options?: Omit<MessageObject, 'id'>) => string;
type TimeFormatter = (d: Date | number, options?: IntlFormatterOptions<Intl.DateTimeFormatOptions>) => string;
type DateFormatter = (d: Date | number, options?: IntlFormatterOptions<Intl.DateTimeFormatOptions>) => string;
type NumberFormatter = (d: number, options?: IntlFormatterOptions<Intl.NumberFormatOptions>) => string;
type IntlFormatterOptions<T> = T & {
format?: string;

@@ -33,3 +39,3 @@ locale?: string;

}
declare type MissingKeyHandlerInput = {
type MissingKeyHandlerInput = {
locale: string;

@@ -39,4 +45,4 @@ id: string;

};
declare type MissingKeyHandlerOutput = string | void | undefined;
declare type MissingKeyHandler = (input: MissingKeyHandlerInput) => MissingKeyHandlerOutput;
type MissingKeyHandlerOutput = string | void | undefined;
type MissingKeyHandler = (input: MissingKeyHandlerInput) => MissingKeyHandlerOutput;
interface ConfigureOptions {

@@ -66,10 +72,4 @@ /** The global fallback locale * */

}
declare type ConfigureOptionsInit = Pick<ConfigureOptions, 'fallbackLocale'> & Partial<Omit<ConfigureOptions, 'fallbackLocale'>>;
type ConfigureOptionsInit = Pick<ConfigureOptions, 'fallbackLocale'> & Partial<Omit<ConfigureOptions, 'fallbackLocale'>>;
declare const $locale: {
set: (newLocale: string | null | undefined) => void | Promise<void>;
update(this: void, updater: svelte_store.Updater<string | null | undefined>): void;
subscribe(this: void, run: svelte_store.Subscriber<string | null | undefined>, invalidate?: ((value?: string | null | undefined) => void) | undefined): svelte_store.Unsubscriber;
};
declare function init(opts: ConfigureOptionsInit): void | Promise<void>;

@@ -95,6 +95,6 @@

declare const $formatNumber: svelte_store.Readable<NumberFormatter>;
declare const $getJSON: svelte_store.Readable<(id: string, locale?: string | null | undefined) => unknown>;
declare const $getJSON: svelte_store.Readable<(id: string, locale?: string | undefined) => unknown>;
declare type MemoizedNumberFormatterFactoryOptional = MemoizedIntlFormatterOptional<Intl.NumberFormat, Intl.NumberFormatOptions>;
declare type MemoizedDateTimeFormatterFactoryOptional = MemoizedIntlFormatterOptional<Intl.DateTimeFormat, Intl.DateTimeFormatOptions>;
type MemoizedNumberFormatterFactoryOptional = MemoizedIntlFormatterOptional<Intl.NumberFormat, Intl.NumberFormatOptions>;
type MemoizedDateTimeFormatterFactoryOptional = MemoizedIntlFormatterOptional<Intl.DateTimeFormat, Intl.DateTimeFormatOptions>;
declare const getNumberFormatter: MemoizedNumberFormatterFactoryOptional;

@@ -101,0 +101,0 @@ declare const getDateFormatter: MemoizedDateTimeFormatterFactoryOptional;

@@ -1,15 +0,1 @@

import{writable as e,derived as n}from"svelte/store";import t from"deepmerge";import o from"intl-messageformat";const r={},i=(e,n,t)=>t?(n in r||(r[n]={}),e in r[n]||(r[n][e]=t),t):t,l=(e,n)=>{if(null==n)return;if(n in r&&e in r[n])return r[n][e];const t=E(n);for(let o=0;o<t.length;o++){const r=c(t[o],e);if(r)return i(e,n,r)}};let a;const s=e({});function u(e){return e in a}function c(e,n){if(!u(e))return null;const t=function(e){return a[e]||null}(e);return function(e,n){if(null==n)return;if(n in e)return e[n];const t=n.split(".");let o=e;for(let e=0;e<t.length;e++)if("object"==typeof o){if(e>0){const n=t.slice(e,t.length).join(".");if(n in o){o=o[n];break}}o=o[t[e]]}else o=void 0;return o}(t,n)}function m(e,...n){delete r[e],s.update((o=>(o[e]=t.all([o[e]||{},...n]),o)))}const f=n([s],(([e])=>Object.keys(e)));s.subscribe((e=>a=e));const d={};function g(e){return d[e]}function h(e){return null!=e&&E(e).some((e=>{var n;return null===(n=g(e))||void 0===n?void 0:n.size}))}function w(e,n){const t=Promise.all(n.map((n=>(function(e,n){d[e].delete(n),0===d[e].size&&delete d[e]}(e,n),n().then((e=>e.default||e))))));return t.then((n=>m(e,...n)))}const p={};function b(e){if(!h(e))return e in p?p[e]:Promise.resolve();const n=function(e){return E(e).map((e=>{const n=g(e);return[e,n?[...n]:[]]})).filter((([,e])=>e.length>0))}(e);return p[e]=Promise.all(n.map((([e,n])=>w(e,n)))).then((()=>{if(h(e))return b(e);delete p[e]})),p[e]}function y(e,n){g(e)||function(e){d[e]=new Set}(e);const t=g(e);g(e).has(n)||(u(e)||s.update((n=>(n[e]={},n))),t.add(n))}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function v(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}function O({locale:e,id:n}){console.warn(`[svelte-i18n] The message "${n}" was not found in "${E(e).join('", "')}".${h(P())?"\n\nNote: there are at least one loader still registered to this locale that wasn't executed.":""}`)}const j={fallbackLocale:null,loadingDelay:200,formats:{number:{scientific:{notation:"scientific"},engineering:{notation:"engineering"},compactLong:{notation:"compact",compactDisplay:"long"},compactShort:{notation:"compact",compactDisplay:"short"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},warnOnMissingMessages:!0,handleMissingMessage:void 0,ignoreTag:!0};function M(){return j}function $(e){const{formats:n}=e,t=v(e,["formats"]),o=e.initialLocale||e.fallbackLocale;return t.warnOnMissingMessages&&(delete t.warnOnMissingMessages,null==t.handleMissingMessage?t.handleMissingMessage=O:console.warn('[svelte-i18n] The "warnOnMissingMessages" option is deprecated. Please use the "handleMissingMessage" option instead.')),Object.assign(j,t,{initialLocale:o}),n&&("number"in n&&Object.assign(j.formats.number,n.number),"date"in n&&Object.assign(j.formats.date,n.date),"time"in n&&Object.assign(j.formats.time,n.time)),D.set(o)}const k=e(!1);let T;const L=e(null);function x(e){return e.split("-").map(((e,n,t)=>t.slice(0,n+1).join("-"))).reverse()}function E(e,n=M().fallbackLocale){const t=x(e);return n?[...new Set([...t,...x(n)])]:t}function P(){return null!=T?T:void 0}L.subscribe((e=>{T=null!=e?e:void 0,"undefined"!=typeof window&&null!=e&&document.documentElement.setAttribute("lang",e)}));const D=Object.assign(Object.assign({},L),{set:e=>{if(e&&function(e){if(null==e)return;const n=E(e);for(let e=0;e<n.length;e++){const t=n[e];if(u(t))return t}}(e)&&h(e)){const{loadingDelay:n}=M();let t;return"undefined"!=typeof window&&null!=P()&&n?t=window.setTimeout((()=>k.set(!0)),n):k.set(!0),b(e).then((()=>{L.set(e)})).finally((()=>{clearTimeout(t),k.set(!1)}))}return L.set(e)}}),S=(e,n)=>{const t=e.split("&").find((e=>0===e.indexOf(`${n}=`)));return t?t.split("=").pop():null},N=(e,n)=>{const t=n.exec(e);return t&&t[1]||null},A=e=>"undefined"==typeof window?null:N(window.location.hostname,e),I=e=>"undefined"==typeof window?null:N(window.location.pathname,e),F=()=>"undefined"==typeof window?null:window.navigator.language||window.navigator.languages[0],z=e=>"undefined"==typeof window?null:S(window.location.search.substr(1),e),Z=e=>"undefined"==typeof window?null:S(window.location.hash.substr(1),e),C=e=>{const n=Object.create(null);return t=>{const o=JSON.stringify(t);return o in n?n[o]:n[o]=e(t)}},G=(e,n)=>{const{formats:t}=M();if(e in t&&n in t[e])return t[e][n];throw new Error(`[svelte-i18n] Unknown "${n}" ${e} format.`)},J=C((e=>{var{locale:n,format:t}=e,o=v(e,["locale","format"]);if(null==n)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return t&&(o=G("number",t)),new Intl.NumberFormat(n,o)})),U=C((e=>{var{locale:n,format:t}=e,o=v(e,["locale","format"]);if(null==n)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return t?o=G("date",t):0===Object.keys(o).length&&(o=G("date","short")),new Intl.DateTimeFormat(n,o)})),V=C((e=>{var{locale:n,format:t}=e,o=v(e,["locale","format"]);if(null==n)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return t?o=G("time",t):0===Object.keys(o).length&&(o=G("time","short")),new Intl.DateTimeFormat(n,o)})),_=(e={})=>{var{locale:n=P()}=e,t=v(e,["locale"]);return J(Object.assign({locale:n},t))},q=(e={})=>{var{locale:n=P()}=e,t=v(e,["locale"]);return U(Object.assign({locale:n},t))},B=(e={})=>{var{locale:n=P()}=e,t=v(e,["locale"]);return V(Object.assign({locale:n},t))},H=C(((e,n=P())=>new o(e,n,M().formats,{ignoreTag:M().ignoreTag}))),K=(e,n={})=>{var t,o,r,i;let a=n;"object"==typeof e&&(a=e,e=a.id);const{values:s,locale:u=P(),default:c}=a;if(null==u)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let m=l(e,u);if(m){if("string"!=typeof m)return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof m}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),m}else m=null!==(i=null!==(r=null===(o=(t=M()).handleMissingMessage)||void 0===o?void 0:o.call(t,{locale:u,id:e,defaultValue:c}))&&void 0!==r?r:c)&&void 0!==i?i:e;if(!s)return m;let f=m;try{f=H(m,u).format(s)}catch(n){console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,n.message)}return f},Q=(e,n)=>B(n).format(e),R=(e,n)=>q(n).format(e),W=(e,n)=>_(n).format(e),X=(e,n=P())=>l(e,n),Y=n([D,s],(()=>K)),ee=n([D],(()=>Q)),ne=n([D],(()=>R)),te=n([D],(()=>W)),oe=n([D,s],(()=>X));function re(e){return e}function ie(e){return b(e||P()||M().initialLocale)}export{Y as _,m as addMessages,ne as date,re as defineMessages,s as dictionary,Y as format,q as getDateFormatter,Z as getLocaleFromHash,A as getLocaleFromHostname,F as getLocaleFromNavigator,I as getLocaleFromPathname,z as getLocaleFromQueryString,H as getMessageFormatter,_ as getNumberFormatter,B as getTimeFormatter,$ as init,k as isLoading,oe as json,D as locale,f as locales,te as number,y as register,Y as t,ee as time,ie as waitLocale};
import{writable as e,derived as n}from"svelte/store";import t from"deepmerge";import o from"intl-messageformat";const i={},r=(e,n,t)=>t?(n in i||(i[n]={}),e in i[n]||(i[n][e]=t),t):t,s=(e,n)=>{if(null==n)return;if(n in i&&e in i[n])return i[n][e];const t=E(n);for(let o=0;o<t.length;o++){const i=c(t[o],e);if(i)return r(e,n,i)}};let l;const a=e({});function u(e){return e in l}function c(e,n){if(!u(e))return null;const t=function(e){return l[e]||null}(e);return function(e,n){if(null==n)return;if(n in e)return e[n];const t=n.split(".");let o=e;for(let e=0;e<t.length;e++)if("object"==typeof o){if(e>0){const n=t.slice(e,t.length).join(".");if(n in o){o=o[n];break}}o=o[t[e]]}else o=void 0;return o}(t,n)}function m(e,...n){delete i[e],a.update((o=>(o[e]=t.all([o[e]||{},...n]),o)))}const f=n([a],(([e])=>Object.keys(e)));a.subscribe((e=>l=e));const d={};function g(e){return d[e]}function h(e){return null!=e&&E(e).some((e=>{var n;return null===(n=g(e))||void 0===n?void 0:n.size}))}function w(e,n){const t=Promise.all(n.map((n=>(function(e,n){d[e].delete(n),0===d[e].size&&delete d[e]}(e,n),n().then((e=>e.default||e))))));return t.then((n=>m(e,...n)))}const p={};function b(e){if(!h(e))return e in p?p[e]:Promise.resolve();const n=function(e){return E(e).map((e=>{const n=g(e);return[e,n?[...n]:[]]})).filter((([,e])=>e.length>0))}(e);return p[e]=Promise.all(n.map((([e,n])=>w(e,n)))).then((()=>{if(h(e))return b(e);delete p[e]})),p[e]}function y(e,n){g(e)||function(e){d[e]=new Set}(e);const t=g(e);g(e).has(n)||(u(e)||a.update((n=>(n[e]={},n))),t.add(n))}function v({locale:e,id:n}){console.warn(`[svelte-i18n] The message "${n}" was not found in "${E(e).join('", "')}".${h(D())?"\n\nNote: there are at least one loader still registered to this locale that wasn't executed.":""}`)}const M={fallbackLocale:null,loadingDelay:200,formats:{number:{scientific:{notation:"scientific"},engineering:{notation:"engineering"},compactLong:{notation:"compact",compactDisplay:"long"},compactShort:{notation:"compact",compactDisplay:"short"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},warnOnMissingMessages:!0,handleMissingMessage:void 0,ignoreTag:!0};function j(){return M}function O(e){const{formats:n,...t}=e,o=e.initialLocale||e.fallbackLocale;return t.warnOnMissingMessages&&(delete t.warnOnMissingMessages,null==t.handleMissingMessage?t.handleMissingMessage=v:console.warn('[svelte-i18n] The "warnOnMissingMessages" option is deprecated. Please use the "handleMissingMessage" option instead.')),Object.assign(M,t,{initialLocale:o}),n&&("number"in n&&Object.assign(M.formats.number,n.number),"date"in n&&Object.assign(M.formats.date,n.date),"time"in n&&Object.assign(M.formats.time,n.time)),x.set(o)}const $=e(!1);let k;const T=e(null);function L(e){return e.split("-").map(((e,n,t)=>t.slice(0,n+1).join("-"))).reverse()}function E(e,n=j().fallbackLocale){const t=L(e);return n?[...new Set([...t,...L(n)])]:t}function D(){return null!=k?k:void 0}T.subscribe((e=>{k=null!=e?e:void 0,"undefined"!=typeof window&&null!=e&&document.documentElement.setAttribute("lang",e)}));const x={...T,set:e=>{if(e&&function(e){if(null==e)return;const n=E(e);for(let e=0;e<n.length;e++){const t=n[e];if(u(t))return t}}(e)&&h(e)){const{loadingDelay:n}=j();let t;return"undefined"!=typeof window&&null!=D()&&n?t=window.setTimeout((()=>$.set(!0)),n):$.set(!0),b(e).then((()=>{T.set(e)})).finally((()=>{clearTimeout(t),$.set(!1)}))}return T.set(e)}},N=(e,n)=>{const t=e.split("&").find((e=>0===e.indexOf(`${n}=`)));return t?t.split("=").pop():null},A=(e,n)=>{const t=n.exec(e);return t&&t[1]||null},P=e=>"undefined"==typeof window?null:A(window.location.hostname,e),S=e=>"undefined"==typeof window?null:A(window.location.pathname,e),F=()=>"undefined"==typeof window?null:window.navigator.language||window.navigator.languages[0],I=e=>"undefined"==typeof window?null:N(window.location.search.substr(1),e),z=e=>"undefined"==typeof window?null:N(window.location.hash.substr(1),e),Z=e=>{const n=Object.create(null);return t=>{const o=JSON.stringify(t);return o in n?n[o]:n[o]=e(t)}},C=(e,n)=>{const{formats:t}=j();if(e in t&&n in t[e])return t[e][n];throw new Error(`[svelte-i18n] Unknown "${n}" ${e} format.`)},G=Z((({locale:e,format:n,...t})=>{if(null==e)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return n&&(t=C("number",n)),new Intl.NumberFormat(e,t)})),J=Z((({locale:e,format:n,...t})=>{if(null==e)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return n?t=C("date",n):0===Object.keys(t).length&&(t=C("date","short")),new Intl.DateTimeFormat(e,t)})),U=Z((({locale:e,format:n,...t})=>{if(null==e)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return n?t=C("time",n):0===Object.keys(t).length&&(t=C("time","short")),new Intl.DateTimeFormat(e,t)})),V=({locale:e=D(),...n}={})=>G({locale:e,...n}),_=({locale:e=D(),...n}={})=>J({locale:e,...n}),q=({locale:e=D(),...n}={})=>U({locale:e,...n}),B=Z(((e,n=D())=>new o(e,n,j().formats,{ignoreTag:j().ignoreTag}))),H=(e,n={})=>{var t,o,i,r;let l=n;"object"==typeof e&&(l=e,e=l.id);const{values:a,locale:u=D(),default:c}=l;if(null==u)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let m=s(e,u);if(m){if("string"!=typeof m)return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof m}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),m}else m=null!==(r=null!==(i=null===(o=(t=j()).handleMissingMessage)||void 0===o?void 0:o.call(t,{locale:u,id:e,defaultValue:c}))&&void 0!==i?i:c)&&void 0!==r?r:e;if(!a)return m;let f=m;try{f=B(m,u).format(a)}catch(n){n instanceof Error&&console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,n.message)}return f},K=(e,n)=>q(n).format(e),Q=(e,n)=>_(n).format(e),R=(e,n)=>V(n).format(e),W=(e,n=D())=>s(e,n),X=n([x,a],(()=>H)),Y=n([x],(()=>K)),ee=n([x],(()=>Q)),ne=n([x],(()=>R)),te=n([x,a],(()=>W));function oe(e){return e}function ie(e){return b(e||D()||j().initialLocale)}export{X as _,m as addMessages,ee as date,oe as defineMessages,a as dictionary,X as format,_ as getDateFormatter,z as getLocaleFromHash,P as getLocaleFromHostname,F as getLocaleFromNavigator,S as getLocaleFromPathname,I as getLocaleFromQueryString,B as getMessageFormatter,V as getNumberFormatter,q as getTimeFormatter,O as init,$ as isLoading,te as json,x as locale,f as locales,ne as number,y as register,X as t,Y as time,ie as waitLocale};
{
"name": "svelte-i18n",
"version": "3.4.0",
"version": "3.4.1",
"main": "dist/runtime.cjs.js",

@@ -24,15 +24,2 @@ "module": "dist/runtime.esm.js",

},
"scripts": {
"clean": "rm -rf dist/",
"build": "rollup -c",
"dev": "rollup -c -w",
"test": "cross-env NODE_ICU_DATA=node_modules/full-icu jest",
"test:ci": "yarn test -- --silent",
"lint": "eslint \"{src,test}/**/*.ts\"",
"format": "prettier --loglevel silent --write \"{src,test}/**/*.ts\"",
"release": " git add package.json && git commit -m \"chore(release): v$npm_package_version :tada:\"",
"prebuild": "yarn clean",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1 && git add CHANGELOG.md",
"prepublishOnly": "yarn test && yarn build"
},
"files": [

@@ -71,43 +58,53 @@ "dist/"

"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@kiwi/eslint-config": "^1.16.6",
"@kiwi/prettier-config": "^1.16.6",
"@babel/core": "^7.20.2",
"@babel/preset-env": "^7.20.2",
"@kiwi/eslint-config": "^1.19.5",
"@kiwi/prettier-config": "^1.19.5",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-typescript": "^8.2.5",
"@rollup/plugin-typescript": "^9.0.2",
"@types/dlv": "^1.1.2",
"@types/estree": "0.0.45",
"@types/estree": "1.0.0",
"@types/intl": "^1.2.0",
"@types/jest": "^26.0.14",
"@types/node": "^14.14.35",
"@types/sade": "^1.7.2",
"@types/jest": "^26.0.24",
"@types/node": "^14.18.33",
"@types/sade": "^1.7.4",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^26.3.0",
"conventional-changelog-cli": "^2.1.0",
"cross-env": "^7.0.2",
"eslint": "^7.32.0",
"full-icu": "^1.3.1",
"husky": "^4.3.0",
"jest": "^26.4.2",
"lint-staged": "^10.4.0",
"prettier": "^2.4.1",
"rollup": "^2.27.1",
"babel-jest": "^26.6.3",
"conventional-changelog-cli": "^2.2.2",
"cross-env": "^7.0.3",
"eslint": "^8.28.0",
"full-icu": "^1.5.0",
"husky": "^4.3.8",
"jest": "^26.6.3",
"lint-staged": "^10.5.4",
"prettier": "^2.7.1",
"rollup": "^2.79.1",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-dts": "^4.2.0",
"rollup-plugin-dts": "^4.2.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.27.2",
"sass": "^1.26.11",
"svelte": "^3.25.1",
"svelte-preprocess": "^4.3.0",
"ts-jest": "^26.4.0",
"typescript": "^4.0.3"
"sass": "^1.56.1",
"svelte": "^3.53.1",
"svelte-preprocess": "^4.10.7",
"ts-jest": "^26.5.6",
"typescript": "^4.9.3"
},
"dependencies": {
"deepmerge": "^4.2.2",
"estree-walker": "^2.0.1",
"intl-messageformat": "^9.3.15",
"sade": "^1.7.4",
"tiny-glob": "^0.2.6"
"estree-walker": "^2",
"intl-messageformat": "^9.13.0",
"sade": "^1.8.1",
"tiny-glob": "^0.2.9"
},
"scripts": {
"clean": "rm -rf dist/",
"build": "rollup -c",
"dev": "rollup -c -w",
"test": "cross-env NODE_ICU_DATA=node_modules/full-icu jest",
"test:ci": "yarn test -- --silent",
"lint": "eslint \"{src,test}/**/*.ts\"",
"format": "prettier --loglevel silent --write \"{src,test}/**/*.ts\"",
"release": " git add package.json && git commit -m \"chore(release): v$npm_package_version :tada:\"",
"prebuild": "yarn clean",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1 && git add CHANGELOG.md"
}
}
}

@@ -0,1 +1,3 @@

> :information_source: `svelte-i18n` is due to some reworking, like moving from a singleton to instances. This will be worked on when I find the time and priority :pray:
[![npm version](https://badge.fury.io/js/svelte-i18n.svg)](https://badge.fury.io/js/svelte-i18n) ![](https://github.com/kaisermann/svelte-i18n/workflows/CI/badge.svg)

@@ -48,4 +50,4 @@

- [Documentation](/docs/Getting%20Started.md)
- [Sapper Template](https://github.com/kaisermann/sapper-template-i18n)
- [Documentation / Getting Started](/docs/Getting%20Started.md)
- [Usage with Svelte Kit](/docs/SvelteKit.md)
- [i18n VSCode extension (3rd party)](https://github.com/antfu/i18n-ally)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc