diff --git a/CHANGELOG.md b/CHANGELOG.md index 79998e3..84f018f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ Prefix your message with one of the following: All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## Unreleased +## v4.4.3 - Feb 15, 2024 - [Changed] Revert exports change back, as it has caused way too much friction. diff --git a/docs/index.html b/docs/index.html index 66ebc93..f732153 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,12 +5,12 @@ - - + +

- The page been moved to https://fnando.github.io/i18n/v4.4.2/ + The page been moved to https://fnando.github.io/i18n/v4.4.3/

diff --git a/docs/v4.4.3/.nojekyll b/docs/v4.4.3/.nojekyll new file mode 100644 index 0000000..e2ac661 --- /dev/null +++ b/docs/v4.4.3/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/v4.4.3/assets/highlight.css b/docs/v4.4.3/assets/highlight.css new file mode 100644 index 0000000..3a8b584 --- /dev/null +++ b/docs/v4.4.3/assets/highlight.css @@ -0,0 +1,148 @@ +:root { + --light-hl-0: #AF00DB; + --dark-hl-0: #C586C0; + --light-hl-1: #000000; + --dark-hl-1: #D4D4D4; + --light-hl-2: #001080; + --dark-hl-2: #9CDCFE; + --light-hl-3: #A31515; + --dark-hl-3: #CE9178; + --light-hl-4: #0000FF; + --dark-hl-4: #569CD6; + --light-hl-5: #0070C1; + --dark-hl-5: #4FC1FF; + --light-hl-6: #795E26; + --dark-hl-6: #DCDCAA; + --light-hl-7: #008000; + --dark-hl-7: #6A9955; + --light-hl-8: #800000; + --dark-hl-8: #808080; + --light-hl-9: #267F99; + --dark-hl-9: #4EC9B0; + --light-hl-10: #000000FF; + --dark-hl-10: #D4D4D4; + --light-hl-11: #098658; + --dark-hl-11: #B5CEA8; + --light-hl-12: #811F3F; + --dark-hl-12: #D16969; + --light-hl-13: #D16969; + --dark-hl-13: #CE9178; + --light-hl-14: #000000; + --dark-hl-14: #D7BA7D; + --light-hl-15: #800000; + --dark-hl-15: #569CD6; + --light-hl-16: #0451A5; + --dark-hl-16: #9CDCFE; + --light-hl-17: #EE0000; + --dark-hl-17: #D7BA7D; + --light-code-background: #FFFFFF; + --dark-code-background: #1E1E1E; +} + +@media (prefers-color-scheme: light) { :root { + --hl-0: var(--light-hl-0); + --hl-1: var(--light-hl-1); + --hl-2: var(--light-hl-2); + --hl-3: var(--light-hl-3); + --hl-4: var(--light-hl-4); + --hl-5: var(--light-hl-5); + --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); + --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); + --hl-10: var(--light-hl-10); + --hl-11: var(--light-hl-11); + --hl-12: var(--light-hl-12); + --hl-13: var(--light-hl-13); + --hl-14: var(--light-hl-14); + --hl-15: var(--light-hl-15); + --hl-16: var(--light-hl-16); + --hl-17: var(--light-hl-17); + --code-background: var(--light-code-background); +} } + +@media (prefers-color-scheme: dark) { :root { + --hl-0: var(--dark-hl-0); + --hl-1: var(--dark-hl-1); + --hl-2: var(--dark-hl-2); + --hl-3: var(--dark-hl-3); + --hl-4: var(--dark-hl-4); + --hl-5: var(--dark-hl-5); + --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); + --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); + --hl-10: var(--dark-hl-10); + --hl-11: var(--dark-hl-11); + --hl-12: var(--dark-hl-12); + --hl-13: var(--dark-hl-13); + --hl-14: var(--dark-hl-14); + --hl-15: var(--dark-hl-15); + --hl-16: var(--dark-hl-16); + --hl-17: var(--dark-hl-17); + --code-background: var(--dark-code-background); +} } + +:root[data-theme='light'] { + --hl-0: var(--light-hl-0); + --hl-1: var(--light-hl-1); + --hl-2: var(--light-hl-2); + --hl-3: var(--light-hl-3); + --hl-4: var(--light-hl-4); + --hl-5: var(--light-hl-5); + --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); + --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); + --hl-10: var(--light-hl-10); + --hl-11: var(--light-hl-11); + --hl-12: var(--light-hl-12); + --hl-13: var(--light-hl-13); + --hl-14: var(--light-hl-14); + --hl-15: var(--light-hl-15); + --hl-16: var(--light-hl-16); + --hl-17: var(--light-hl-17); + --code-background: var(--light-code-background); +} + +:root[data-theme='dark'] { + --hl-0: var(--dark-hl-0); + --hl-1: var(--dark-hl-1); + --hl-2: var(--dark-hl-2); + --hl-3: var(--dark-hl-3); + --hl-4: var(--dark-hl-4); + --hl-5: var(--dark-hl-5); + --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); + --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); + --hl-10: var(--dark-hl-10); + --hl-11: var(--dark-hl-11); + --hl-12: var(--dark-hl-12); + --hl-13: var(--dark-hl-13); + --hl-14: var(--dark-hl-14); + --hl-15: var(--dark-hl-15); + --hl-16: var(--dark-hl-16); + --hl-17: var(--dark-hl-17); + --code-background: var(--dark-code-background); +} + +.hl-0 { color: var(--hl-0); } +.hl-1 { color: var(--hl-1); } +.hl-2 { color: var(--hl-2); } +.hl-3 { color: var(--hl-3); } +.hl-4 { color: var(--hl-4); } +.hl-5 { color: var(--hl-5); } +.hl-6 { color: var(--hl-6); } +.hl-7 { color: var(--hl-7); } +.hl-8 { color: var(--hl-8); } +.hl-9 { color: var(--hl-9); } +.hl-10 { color: var(--hl-10); } +.hl-11 { color: var(--hl-11); } +.hl-12 { color: var(--hl-12); } +.hl-13 { color: var(--hl-13); } +.hl-14 { color: var(--hl-14); } +.hl-15 { color: var(--hl-15); } +.hl-16 { color: var(--hl-16); } +.hl-17 { color: var(--hl-17); } +pre, code { background: var(--code-background); } diff --git a/docs/v4.4.3/assets/main.js b/docs/v4.4.3/assets/main.js new file mode 100644 index 0000000..3092fea --- /dev/null +++ b/docs/v4.4.3/assets/main.js @@ -0,0 +1,59 @@ +"use strict"; +"use strict";(()=>{var Ie=Object.create;var ne=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Pe(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Ie(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` + ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var He={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>He[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",H="mouseup",J={x:0,y:0},fe=!1,ee=!1,Be=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(Be=!0,F="touchstart",pe="touchmove",H="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(H,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(H,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(F,n=>this.onDocumentPointerDown(n)),document.addEventListener(H,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } +`,this.updateIndexHeadingVisibility()}fromLocalStorage(){let e=Q.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){Q.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.updateIndexHeadingVisibility()}updateIndexHeadingVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}};var Z=class extends C{constructor(e){super(e),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let r=this.summary.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); +/*! Bundled license information: + +lunr/lunr.js: + (** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 + * Copyright (C) 2020 Oliver Nightingale + * @license MIT + *) + (*! + * lunr.utils + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Set + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.tokenizer + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Pipeline + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Vector + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.stemmer + * Copyright (C) 2020 Oliver Nightingale + * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt + *) + (*! + * lunr.stopWordFilter + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.trimmer + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.TokenSet + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Index + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Builder + * Copyright (C) 2020 Oliver Nightingale + *) +*/ diff --git a/docs/v4.4.3/assets/navigation.js b/docs/v4.4.3/assets/navigation.js new file mode 100644 index 0000000..34adb59 --- /dev/null +++ b/docs/v4.4.3/assets/navigation.js @@ -0,0 +1 @@ +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE5WWX2+bMBTFv4ufo2WJ1q7LW9doaqXlj0qmPUx7cM0NeDV2ZF+i0anffSKEArZj01efc37X+OILv/4RhL9IFuRhdiPJhBwo5mRBmKDGgJnWqx9yLASZkGcuU7KYzW9eJ2+p74pRAcYNnoVQdsWN4TLbaSqNoMiVp77rCRG3otRU8JcLsIEc4iw5wy7OJYLeUwZmWgvD4Pzquhf8pnRBcV0WT6A3h7qM8XI8vhC27kII19NDmM3TH2C4qw7gpXRyCJKg3iMvILQfyxPC7XgBt5l6kD+VTk0I6nUG0SoBiSBZcK+OK4g8v4dhomUKAW9l1Rx7R8LqAGb6Jljpj18+z67mfYLWtBr29ExohRhhSRHqw7UB7Xo8X61p0R8Cbb5Zj+WbUfEIRokjaJsyVGOsFX2G5prbnE6JMpqZ8xVyeuTK2ZAlj6RtBWWQK5GCvqcyFe6DXjSOrNCbkQlqipBVF0p4nNEaSmLu7XKnxBjrUoj4MfhdcXY9SnfqrtQaJKuc+9nCvbax9CUIXnCENIK3fWP592VB3UE/ZPc97+Im/MUdWx52z/cu/g/JMUw+OcYyt6AZSKRZbNOOcWyFR1XKNNrLoWsEGzRnHli9HEtv5F1OZQYXroYlx2jt744L6pQoQ9cvMj+C7wszEGOk0zlyma1U6oD6WoyTMOXu5LQYS5YGfJ+HfSnZqbfTgWFIu/70+vs/QuKzJCwLAAA=" \ No newline at end of file diff --git a/docs/v4.4.3/assets/search.js b/docs/v4.4.3/assets/search.js new file mode 100644 index 0000000..bb89472 --- /dev/null +++ b/docs/v4.4.3/assets/search.js @@ -0,0 +1 @@ +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE7VdbXPbNhL+L/RX1REIvvpbr51OM9e0mSbXzpwm02Ek2uZFIjUU5dTN5L/fACTIXXAXJCXnk21x37DP7gJYQvAXr64+n7y7zRfvU1HuvDvhJyuvzA65d+e9FknprbxzvffuvO0+O53y0yv14e1jc9h7K/OZd+d5X1dGQij8XsK2Kk9Nfd42Vc0LusFUQOjKO2Z1XjbGlkGJWPtBr6Uqf3jMyof856zc7fP65FBFkC7Xt8vvs/O+eZcfszpzD40gXa4vL7OP+/ynbL//mG0/ObSNCJfr2lfbbJ+7XDhQLJd+3J/rbF/8kzVF5QitG5tuuaZDcToV5cO/8sfsqXBCNKa8WNvbfbbNH6v9Lp+hEBNfrPN9nZWnvXbU2zq/L/6e1kyxLNdfnvf7eQMeU77EaBeN88JonTO645UjawYrXWlnkV2o576qD//On6f0DGSz9ERhKKNe0V9/Nc/HfKaK25b6O7F2KrtFZjEjLMomr4/VPmtc2jHVtxgf0GCG57tHB21iBpc9ZcVelfdfJis0QTprmP46GCb/U1PVrkGa5/MkR74I7Elmco65UHo35/4ypcSmW+4jk5OTwb4k2HDSuiR/q/Q0QZtMpCTnFjN7u5RAmgsqs0vyN3LL0bglcrvlyLlFB7XbK4DkgqWbS/A3csreOCVwO2XPplD1vjg4o9EQLE/P8nz4mNfvqx/OdZ2XW9esR5Beru9tXm/zsskeXOMiiS/X+fP5kJXv3NFF0V6pca62qzT9Xp3LXb6boWugvFzbj/m+OBTNLH2QdrnGz0XzODlLIaJLpvH6vnFnGCBZLv983Lnnv57ggum1epeXTV5u3fUBEF2gozjk3z9Ur8s/q3rnXH/bhBf0DYpTk5Xb/Ld7VdKmVXL036KQk7puezZHaaetZNxt+i8zWjTfaKBG/K355TvR70EmVukjVn4N+pTXJ/cedaBYHrRqH5Q1v+oi5FBhkS3X85C71p/t03lpALqK3P6l+/xFeotQ1qz2ojGKcUSdPxSnhnA2UgSoLtJCuRspcHl8LBs6/c10+2RM8iJQMGJnoUJYvRQgTv0kVvN1U7Bxal0IOjVCMN86u6jo6YtAOJY4Cz1s5lLgCKWTmM3SSMFFKHMhxemJhgngfMrfZJ/ylrLXd38ut7qD9wo9d6Lkr9NYhANShFg1e51ezZTnnC9JSTcTywBgETA7HJT8WGwHn+te1322zU+v1OeLxv5j1uRov9jaaz52ywIGvUeLud+OuPkKLCQJnWqsjuR2f97l7/JtVe4WKrgZMdPep8fCGHTaVgDteXYYnsvU2xD+ej7kdbG1EOw+XRQMerNXlA9vqp0dEPDR7KD4CSyXHCFBkM0PiHZJtkTsTc9C+5+ymntjkz9kTfGU/7TciBHr1cYc63xboDXyHDsg19Um1CpKUPTMMQFyXW3CqXgoi/tim5XL8MB815sxepU9y4jJt9oLTNh1rZRlJkCu673Q1MXxdQl8+9+8rhYVgRtexvXhmhWnhaHacVyt+lwWy+KzY7hEMTFh4K6lXZv7GYQkWzSlICH/KYvGqUUTXLvWYiROrbkIS2cOa4b7rnFd3xJ167HJXsqNpNy5zhzZPlWr3mZNk9flBbbcEjKWGWeac7Pr6SXGvbRV44lmgVXT8818q7jwHV7HuON3RHdRsnTvK9yqMNFFesxrLbcii2r+bqpvwbt2UjbR/EXzZ7Wz+KEqy3zLLFFo4TcjRmYLM7Kfexv/ufrzUlso3ivN2WenRsm8xByKd7k5dry9rVXaFU/5+3GFRs8WRfH3dZ09ExL7z5dJK59/+/i/HHQkOmnm89lx35Ijw4Djh6fL2jvMwcWuM4OfzjZV9eMdyQkez09L+pyNQ+qCEzcTkc8ehnJpX3QsanIFwBwBnjH8eYeBJwxgzgS71C84HTxVeOZDPuMk14Qy7iSvS+uSM73z1FMnXWdYMPfY61Tnhjlr67JgyanbeT7gjxrP8MSyQ8dTzaOFvph7Rndq/qeO0Lr0zj5MO1bs3PPM1TnnBb5hZk7Y2vPTO9RBbmcl/dmiWa4twb/np2r/NNqi4IfX7gwJaVP7Qcs6x3rHnGK0hzA8uNZ8S9KU6cCiyTUGSMl3TZ01+cMzvdwgCK9+xeSWPPnKiR8Bs0cxx3BdWxSLZvFS6I9sf6bfrlCSbywuZvltG86YsK3OdA+Z1m3Ir1PKv04ilU68SZqptHPbfAhvAMd1qmesRWgL5i5IHIYwSQym+O5LbXSmjeleKIUZwTMzmDDf1c5ASxp6vDTR9f1FVup0d5G02vWW+/nX7JDbbRrz8bLtZFU2j5S04cHsTeS77qCoo4RaJPMrqHr9uysy8m0gJfQGMNBut61dvrRy6p1aWtnMvb3clvZwqQm3mnWZFRNt2uPlxhxf3JidnQ5TJgGGpaGBIfn4sR7l4pRyi+kqAw7j5J2EA7JcPXqieswZ/5trjLAr2G/4K9tWGbOeXlvmKXFT9d028OuHlVeUu/xv7+5LfxD4zvNv5W3qrbz7It/v1FfuW0NW3rY6HJSkD92zP3Q/VlG0JK/W3mqzXgXhbSriDx9WG8OhH+gPNJnwVhuxksFtKgUiE4jM91Ybn5LmIzLprTZyFaxvk3WKyCQiC7zVJqDIAkQWeqtNSJGFiCzyVpuIIosQWeytNjE10hiRJd5qk1DSEkSWeqtNSpGl2L3K22JNEQoLCI2EICkxFurE+Ub4JCWGQyi3C0nhJjAiQnlekJgIDIpQzhfhyl/fxmmAKTEuQvlfRKR2DI2IeZkYHaFQEDFpJwZIKCBEQmrHGPkaIxJMH2PkKyB8Ek3fyhedMILMGIyRr4Dw6dzCGPkB6yUfY+QrIHwSdx9j5Csg/ICkxBj5PEY+xshXQPghKRNj5CsgfDJCfIyRXLPaJcZIaoxiSqbEGEmNERkh0iprGqOUpMQYSQWEJOuuxBhJBYQkI0RijKQCQpIRIjFGUgEhSdwlxkgqICSJu8QYSQWEJNGUGKNAASFJNAOMUaCAkCRGAcYoUEBIEqMAYxTouYfEKLBmHz6PAoxRoIAISDQDjFEQ8TIxRoECIiBxDzBGgQIiIHEPMEaBAiKQ1OQWYIzCNTunYohCdmEQYoRCBUMQrGR8GwR45CFGKJSslSFGKAzYuTC0lgghayYGKIx4MzFAYcybiQEKE27lEWJ8wpS1EsMTrVkrI4xPJFgrIwxQpAEiEzjCAEUaIDKBIwxQxKdQhAGKdAqRqR5ZyziNEJnqEUYo0giRqR5hhCKFQ0gmcIQhihQQoSA9jzGKdQqRaRljjGIFREiW4xhjFCsgQrIcxxijWAERkmjGGKNYARGSaMYYo1gvtEmMYoxRrIAISYxia7WtgAhJjGKMUayziFxUxRijWAERkWUhxhglCoiIxCjBGCUKiIjEKMEYJQqIiMQowRglCoiIxCjBGCUKiIjEKMEYJfyyO8EYJXo/RKKZYIwSBUREoplYm6KE144xSjRGJO4Jxihds2imGKNUsBGSYoxSBURM5nuKMUoVEDE5DacYo1QBEZOxlGKMUgVETMZSijFKFRAxGUspxijV21YyllKMUaqAiMlYSq29qwIiJiMktbevComY3kWtrQ3sWmERk9C3zyCtQiMhgWqfQVrJ7dzbR5BUAZKQqLbPIG3IbubaZ5A24reda2svu465Jkj7CJImXCOkfQRJU3aT2j4DtLqzQDts1HQQXLtD2F2Htu1A+8vuO+juAm2s3XhoOw90N8NuPbS9B9phdvNB8CtyYbcfdJOBnvyF3YDQbYaELAfCbkG0PQjGBgs03WpI6F6N1YYQutnAyPXtZpHONLLUCKsVIXTDgZNr4aZbDglZmITVjhC66ZDQnSCrISF02yEhi5OwWhLCd+BmNSWEbj0kdCWz2hJCNx/oBLL6EkJ3HxK66FmdCSEdsFm9CaE7ECldIKXd5XPAZvUnhO5CpHSb0epQCN2HSOnUtHoUQnciUqbVaMGmexEpHZJWn0JIfuUhrE6F0P2IlA5Jq1chdEcipUPS6lYI3ZNgfGb1K4TuSqR0+FodC6H7Eox/A7s/q3Gjw9fqWgjdm0jpmLT6FsLRuBBd50K/mXjK6ybfvW7fUGw2/YuQL95f3WsLEZq3JF88EXp3X76uPBG3P/2g+9n9Ldftz6D7PIjan1H3d9LxJ0knR0Tml7T7xRfmF9n9Is0nsv/EsLfyvw6vTdRfaqzqxdMuey7b107DYNIYDCbwHdz63dmYP4H8Acd/QDzQgTLleMrnqjuJPrDGKWBdC45VHX23YYuhpes1x2qOQfcX+QLgoa+Mx9ecx9ElEEAIkNGKCM3PLhZCziPdqaRBVgIN8jlD1A1T7Q1WA2cAnBHxjES8QPtlYMKOQ6I7W2TOOQ9y/PUgp4/wdegWgyxJIJ5+MsE5nCofJMhBgEmkdeyW89SeRgNWRNAK3v7+G2MDawRcGXfZnnJx2Us4mi/EAUEgKRIueHYFzqQAxE7E2t3dXlXpt9FF+bm9Ywu4EKgOJCOlPVp/3x+tB0YAboMAh6T5pv/AHYI6EnPKW7ayu+YJqPaBbrfOlrky53qAAcD+mKud+qoUoBdEXdChHnbhF3azRsSlU6HvnB+EgSTiAkexEKYnMI/XXN3uLtk4mUs2wNCB6ohzH7pMGJRAmDNc8dmjagE4fC7C1Ze2VIBuhy9tgeoPJKScveMyJUB8+2sToqwFmr/uz20Dd4NoE8KtH/t54DPTA4f0cD0qcBzgZ2vkIfuUH7s7c0CgAo9FXHYN58zAFBHAKYIrqN2Zz4/9mU+AFcgq43JToIUBgQ2DTjD6UgMAApRKI5LLtrGkR3PKBgiEKxLJYdOJauANYyDKYDKa1QCXk2NRx+4bIwACEOxmlCyEI3mn/rg7GCYE1edqHbNGhMEvzYqZnS7MbSpEwQchGXP+Ud/sYcAXa1j0jGO4wViCCOxTKE/yctT00VTb/vZckJ8gHmcLIMp5DFyc8p5p5eyGe1nBTA5XQ1zSjiQQpkQwxaYEPbbX3wIzQCpIblmCuCkTQAVJuAkGCTlZdVMCZOWUP3sJlCmgACdsxENB5/ZiDSACRH0yZcsRXJgMwgwUBDllxSCCCjTgmHQqYGtz4TBwLAhUOQVNx0+ZAcIkdQyovUwLVBCgPuaKdbvttPePCSoe3NCrctvdzwpmUsAZcDFtGKkyA6eYuQKQu8CoOcOPiB5Ue3ZfyRVZWO19U2S5uLX+lw2IerD66GZEbv0CbssHQwD1jN2XHcE31ADSEo6Ai5Ij7mnANW3A8gwXdIGYhOsd1lJzP8CorQG4U25N1F11BLwLhphw65/hRkkQyyAywg7d0DS1uGHX3YVzB30vGBg5sCJmrVDMI04wycRcgHZfqAJcoGpE/cLIrDF9brIimwcRSOq4W0qm3BjQhWTAHpDYMau9/VciIMFg44NDfLi2HNReMBexbTfDSBTdFOYFW7z1HV8FvOPrn/aOL+A7UCISLmiQp3xYwbh6r8zOHiqqTQFcxjY5MTsx/gDAFXFwNdWpv3EdGACylG2WDazUjAecn3JVoqlszH2gWLKKzZebP+VodSrgot80aASrfPhfLkA/SDl229BzUo0K2Cz2uWkE//8nMAIUshzz50pDTjcOgP6UA7290A0EOHBcwo3a3P0PogRMIuwccj7lzIYdWBpxSvuL1QEfgCjgRqj+0cK4PSLBOCU3PTt8C9hTsp58WHnH4pjvizL37jYfvn79P/l5TteTcQAA"; \ No newline at end of file diff --git a/docs/v4.4.3/assets/style.css b/docs/v4.4.3/assets/style.css new file mode 100644 index 0000000..a4b9921 --- /dev/null +++ b/docs/v4.4.3/assets/style.css @@ -0,0 +1,1436 @@ +:root { + /* Light */ + --light-color-background: #f2f4f8; + --light-color-background-secondary: #eff0f1; + --light-color-warning-text: #222; + --light-color-background-warning: #e6e600; + --light-color-icon-background: var(--light-color-background); + --light-color-accent: #c5c7c9; + --light-color-active-menu-item: var(--light-color-accent); + --light-color-text: #222; + --light-color-text-aside: #6e6e6e; + --light-color-link: #1f70c2; + + --light-color-ts-keyword: #056bd6; + --light-color-ts-project: #b111c9; + --light-color-ts-module: var(--light-color-ts-project); + --light-color-ts-namespace: var(--light-color-ts-project); + --light-color-ts-enum: #7e6f15; + --light-color-ts-enum-member: var(--light-color-ts-enum); + --light-color-ts-variable: #4760ec; + --light-color-ts-function: #572be7; + --light-color-ts-class: #1f70c2; + --light-color-ts-interface: #108024; + --light-color-ts-constructor: var(--light-color-ts-class); + --light-color-ts-property: var(--light-color-ts-variable); + --light-color-ts-method: var(--light-color-ts-function); + --light-color-ts-call-signature: var(--light-color-ts-method); + --light-color-ts-index-signature: var(--light-color-ts-property); + --light-color-ts-constructor-signature: var(--light-color-ts-constructor); + --light-color-ts-parameter: var(--light-color-ts-variable); + /* type literal not included as links will never be generated to it */ + --light-color-ts-type-parameter: #a55c0e; + --light-color-ts-accessor: var(--light-color-ts-property); + --light-color-ts-get-signature: var(--light-color-ts-accessor); + --light-color-ts-set-signature: var(--light-color-ts-accessor); + --light-color-ts-type-alias: #d51270; + /* reference not included as links will be colored with the kind that it points to */ + + --light-external-icon: url("data:image/svg+xml;utf8,"); + --light-color-scheme: light; + + /* Dark */ + --dark-color-background: #2b2e33; + --dark-color-background-secondary: #1e2024; + --dark-color-background-warning: #bebe00; + --dark-color-warning-text: #222; + --dark-color-icon-background: var(--dark-color-background-secondary); + --dark-color-accent: #9096a2; + --dark-color-active-menu-item: #5d5d6a; + --dark-color-text: #f5f5f5; + --dark-color-text-aside: #dddddd; + --dark-color-link: #00aff4; + + --dark-color-ts-keyword: #3399ff; + --dark-color-ts-project: #e358ff; + --dark-color-ts-module: var(--dark-color-ts-project); + --dark-color-ts-namespace: var(--dark-color-ts-project); + --dark-color-ts-enum: #f4d93e; + --dark-color-ts-enum-member: var(--dark-color-ts-enum); + --dark-color-ts-variable: #798dff; + --dark-color-ts-function: #a280ff; + --dark-color-ts-class: #8ac4ff; + --dark-color-ts-interface: #6cff87; + --dark-color-ts-constructor: var(--dark-color-ts-class); + --dark-color-ts-property: var(--dark-color-ts-variable); + --dark-color-ts-method: var(--dark-color-ts-function); + --dark-color-ts-call-signature: var(--dark-color-ts-method); + --dark-color-ts-index-signature: var(--dark-color-ts-property); + --dark-color-ts-constructor-signature: var(--dark-color-ts-constructor); + --dark-color-ts-parameter: var(--dark-color-ts-variable); + /* type literal not included as links will never be generated to it */ + --dark-color-ts-type-parameter: #e07d13; + --dark-color-ts-accessor: var(--dark-color-ts-property); + --dark-color-ts-get-signature: var(--dark-color-ts-accessor); + --dark-color-ts-set-signature: var(--dark-color-ts-accessor); + --dark-color-ts-type-alias: #ff6492; + /* reference not included as links will be colored with the kind that it points to */ + + --dark-external-icon: url("data:image/svg+xml;utf8,"); + --dark-color-scheme: dark; +} + +@media (prefers-color-scheme: light) { + :root { + --color-background: var(--light-color-background); + --color-background-secondary: var(--light-color-background-secondary); + --color-background-warning: var(--light-color-background-warning); + --color-warning-text: var(--light-color-warning-text); + --color-icon-background: var(--light-color-icon-background); + --color-accent: var(--light-color-accent); + --color-active-menu-item: var(--light-color-active-menu-item); + --color-text: var(--light-color-text); + --color-text-aside: var(--light-color-text-aside); + --color-link: var(--light-color-link); + + --color-ts-keyword: var(--light-color-ts-keyword); + --color-ts-module: var(--light-color-ts-module); + --color-ts-namespace: var(--light-color-ts-namespace); + --color-ts-enum: var(--light-color-ts-enum); + --color-ts-enum-member: var(--light-color-ts-enum-member); + --color-ts-variable: var(--light-color-ts-variable); + --color-ts-function: var(--light-color-ts-function); + --color-ts-class: var(--light-color-ts-class); + --color-ts-interface: var(--light-color-ts-interface); + --color-ts-constructor: var(--light-color-ts-constructor); + --color-ts-property: var(--light-color-ts-property); + --color-ts-method: var(--light-color-ts-method); + --color-ts-call-signature: var(--light-color-ts-call-signature); + --color-ts-index-signature: var(--light-color-ts-index-signature); + --color-ts-constructor-signature: var( + --light-color-ts-constructor-signature + ); + --color-ts-parameter: var(--light-color-ts-parameter); + --color-ts-type-parameter: var(--light-color-ts-type-parameter); + --color-ts-accessor: var(--light-color-ts-accessor); + --color-ts-get-signature: var(--light-color-ts-get-signature); + --color-ts-set-signature: var(--light-color-ts-set-signature); + --color-ts-type-alias: var(--light-color-ts-type-alias); + + --external-icon: var(--light-external-icon); + --color-scheme: var(--light-color-scheme); + } +} + +@media (prefers-color-scheme: dark) { + :root { + --color-background: var(--dark-color-background); + --color-background-secondary: var(--dark-color-background-secondary); + --color-background-warning: var(--dark-color-background-warning); + --color-warning-text: var(--dark-color-warning-text); + --color-icon-background: var(--dark-color-icon-background); + --color-accent: var(--dark-color-accent); + --color-active-menu-item: var(--dark-color-active-menu-item); + --color-text: var(--dark-color-text); + --color-text-aside: var(--dark-color-text-aside); + --color-link: var(--dark-color-link); + + --color-ts-keyword: var(--dark-color-ts-keyword); + --color-ts-module: var(--dark-color-ts-module); + --color-ts-namespace: var(--dark-color-ts-namespace); + --color-ts-enum: var(--dark-color-ts-enum); + --color-ts-enum-member: var(--dark-color-ts-enum-member); + --color-ts-variable: var(--dark-color-ts-variable); + --color-ts-function: var(--dark-color-ts-function); + --color-ts-class: var(--dark-color-ts-class); + --color-ts-interface: var(--dark-color-ts-interface); + --color-ts-constructor: var(--dark-color-ts-constructor); + --color-ts-property: var(--dark-color-ts-property); + --color-ts-method: var(--dark-color-ts-method); + --color-ts-call-signature: var(--dark-color-ts-call-signature); + --color-ts-index-signature: var(--dark-color-ts-index-signature); + --color-ts-constructor-signature: var( + --dark-color-ts-constructor-signature + ); + --color-ts-parameter: var(--dark-color-ts-parameter); + --color-ts-type-parameter: var(--dark-color-ts-type-parameter); + --color-ts-accessor: var(--dark-color-ts-accessor); + --color-ts-get-signature: var(--dark-color-ts-get-signature); + --color-ts-set-signature: var(--dark-color-ts-set-signature); + --color-ts-type-alias: var(--dark-color-ts-type-alias); + + --external-icon: var(--dark-external-icon); + --color-scheme: var(--dark-color-scheme); + } +} + +html { + color-scheme: var(--color-scheme); +} + +body { + margin: 0; +} + +:root[data-theme="light"] { + --color-background: var(--light-color-background); + --color-background-secondary: var(--light-color-background-secondary); + --color-background-warning: var(--light-color-background-warning); + --color-warning-text: var(--light-color-warning-text); + --color-icon-background: var(--light-color-icon-background); + --color-accent: var(--light-color-accent); + --color-active-menu-item: var(--light-color-active-menu-item); + --color-text: var(--light-color-text); + --color-text-aside: var(--light-color-text-aside); + --color-link: var(--light-color-link); + + --color-ts-keyword: var(--light-color-ts-keyword); + --color-ts-module: var(--light-color-ts-module); + --color-ts-namespace: var(--light-color-ts-namespace); + --color-ts-enum: var(--light-color-ts-enum); + --color-ts-enum-member: var(--light-color-ts-enum-member); + --color-ts-variable: var(--light-color-ts-variable); + --color-ts-function: var(--light-color-ts-function); + --color-ts-class: var(--light-color-ts-class); + --color-ts-interface: var(--light-color-ts-interface); + --color-ts-constructor: var(--light-color-ts-constructor); + --color-ts-property: var(--light-color-ts-property); + --color-ts-method: var(--light-color-ts-method); + --color-ts-call-signature: var(--light-color-ts-call-signature); + --color-ts-index-signature: var(--light-color-ts-index-signature); + --color-ts-constructor-signature: var( + --light-color-ts-constructor-signature + ); + --color-ts-parameter: var(--light-color-ts-parameter); + --color-ts-type-parameter: var(--light-color-ts-type-parameter); + --color-ts-accessor: var(--light-color-ts-accessor); + --color-ts-get-signature: var(--light-color-ts-get-signature); + --color-ts-set-signature: var(--light-color-ts-set-signature); + --color-ts-type-alias: var(--light-color-ts-type-alias); + + --external-icon: var(--light-external-icon); + --color-scheme: var(--light-color-scheme); +} + +:root[data-theme="dark"] { + --color-background: var(--dark-color-background); + --color-background-secondary: var(--dark-color-background-secondary); + --color-background-warning: var(--dark-color-background-warning); + --color-warning-text: var(--dark-color-warning-text); + --color-icon-background: var(--dark-color-icon-background); + --color-accent: var(--dark-color-accent); + --color-active-menu-item: var(--dark-color-active-menu-item); + --color-text: var(--dark-color-text); + --color-text-aside: var(--dark-color-text-aside); + --color-link: var(--dark-color-link); + + --color-ts-keyword: var(--dark-color-ts-keyword); + --color-ts-module: var(--dark-color-ts-module); + --color-ts-namespace: var(--dark-color-ts-namespace); + --color-ts-enum: var(--dark-color-ts-enum); + --color-ts-enum-member: var(--dark-color-ts-enum-member); + --color-ts-variable: var(--dark-color-ts-variable); + --color-ts-function: var(--dark-color-ts-function); + --color-ts-class: var(--dark-color-ts-class); + --color-ts-interface: var(--dark-color-ts-interface); + --color-ts-constructor: var(--dark-color-ts-constructor); + --color-ts-property: var(--dark-color-ts-property); + --color-ts-method: var(--dark-color-ts-method); + --color-ts-call-signature: var(--dark-color-ts-call-signature); + --color-ts-index-signature: var(--dark-color-ts-index-signature); + --color-ts-constructor-signature: var( + --dark-color-ts-constructor-signature + ); + --color-ts-parameter: var(--dark-color-ts-parameter); + --color-ts-type-parameter: var(--dark-color-ts-type-parameter); + --color-ts-accessor: var(--dark-color-ts-accessor); + --color-ts-get-signature: var(--dark-color-ts-get-signature); + --color-ts-set-signature: var(--dark-color-ts-set-signature); + --color-ts-type-alias: var(--dark-color-ts-type-alias); + + --external-icon: var(--dark-external-icon); + --color-scheme: var(--dark-color-scheme); +} + +.always-visible, +.always-visible .tsd-signatures { + display: inherit !important; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + line-height: 1.2; +} + +h1 > a:not(.link), +h2 > a:not(.link), +h3 > a:not(.link), +h4 > a:not(.link), +h5 > a:not(.link), +h6 > a:not(.link) { + text-decoration: none; + color: var(--color-text); +} + +h1 { + font-size: 1.875rem; + margin: 0.67rem 0; +} + +h2 { + font-size: 1.5rem; + margin: 0.83rem 0; +} + +h3 { + font-size: 1.25rem; + margin: 1rem 0; +} + +h4 { + font-size: 1.05rem; + margin: 1.33rem 0; +} + +h5 { + font-size: 1rem; + margin: 1.5rem 0; +} + +h6 { + font-size: 0.875rem; + margin: 2.33rem 0; +} + +.uppercase { + text-transform: uppercase; +} + +dl, +menu, +ol, +ul { + margin: 1em 0; +} + +dd { + margin: 0 0 0 40px; +} + +.container { + max-width: 1700px; + padding: 0 2rem; +} + +/* Footer */ +.tsd-generator { + border-top: 1px solid var(--color-accent); + padding-top: 1rem; + padding-bottom: 1rem; + max-height: 3.5rem; +} + +.tsd-generator > p { + margin-top: 0; + margin-bottom: 0; + padding: 0 1rem; +} + +.container-main { + margin: 0 auto; + /* toolbar, footer, margin */ + min-height: calc(100vh - 41px - 56px - 4rem); +} + +@keyframes fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } +} +@keyframes fade-out { + from { + opacity: 1; + visibility: visible; + } + to { + opacity: 0; + } +} +@keyframes fade-in-delayed { + 0% { + opacity: 0; + } + 33% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@keyframes fade-out-delayed { + 0% { + opacity: 1; + visibility: visible; + } + 66% { + opacity: 0; + } + 100% { + opacity: 0; + } +} +@keyframes pop-in-from-right { + from { + transform: translate(100%, 0); + } + to { + transform: translate(0, 0); + } +} +@keyframes pop-out-to-right { + from { + transform: translate(0, 0); + visibility: visible; + } + to { + transform: translate(100%, 0); + } +} +body { + background: var(--color-background); + font-family: "Segoe UI", sans-serif; + font-size: 16px; + color: var(--color-text); +} + +a { + color: var(--color-link); + text-decoration: none; +} +a:hover { + text-decoration: underline; +} +a.external[target="_blank"] { + background-image: var(--external-icon); + background-position: top 3px right; + background-repeat: no-repeat; + padding-right: 13px; +} + +code, +pre { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + padding: 0.2em; + margin: 0; + font-size: 0.875rem; + border-radius: 0.8em; +} + +pre { + position: relative; + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; + padding: 10px; + border: 1px solid var(--color-accent); +} +pre code { + padding: 0; + font-size: 100%; +} +pre > button { + position: absolute; + top: 10px; + right: 10px; + opacity: 0; + transition: opacity 0.1s; + box-sizing: border-box; +} +pre:hover > button, +pre > button.visible { + opacity: 1; +} + +blockquote { + margin: 1em 0; + padding-left: 1em; + border-left: 4px solid gray; +} + +.tsd-typography { + line-height: 1.333em; +} +.tsd-typography ul { + list-style: square; + padding: 0 0 0 20px; + margin: 0; +} +.tsd-typography .tsd-index-panel h3, +.tsd-index-panel .tsd-typography h3, +.tsd-typography h4, +.tsd-typography h5, +.tsd-typography h6 { + font-size: 1em; +} +.tsd-typography h5, +.tsd-typography h6 { + font-weight: normal; +} +.tsd-typography p, +.tsd-typography ul, +.tsd-typography ol { + margin: 1em 0; +} +.tsd-typography table { + border-collapse: collapse; + border: none; +} +.tsd-typography td, +.tsd-typography th { + padding: 6px 13px; + border: 1px solid var(--color-accent); +} +.tsd-typography thead, +.tsd-typography tr:nth-child(even) { + background-color: var(--color-background-secondary); +} + +.tsd-breadcrumb { + margin: 0; + padding: 0; + color: var(--color-text-aside); +} +.tsd-breadcrumb a { + color: var(--color-text-aside); + text-decoration: none; +} +.tsd-breadcrumb a:hover { + text-decoration: underline; +} +.tsd-breadcrumb li { + display: inline; +} +.tsd-breadcrumb li:after { + content: " / "; +} + +.tsd-comment-tags { + display: flex; + flex-direction: column; +} +dl.tsd-comment-tag-group { + display: flex; + align-items: center; + overflow: hidden; + margin: 0.5em 0; +} +dl.tsd-comment-tag-group dt { + display: flex; + margin-right: 0.5em; + font-size: 0.875em; + font-weight: normal; +} +dl.tsd-comment-tag-group dd { + margin: 0; +} +code.tsd-tag { + padding: 0.25em 0.4em; + border: 0.1em solid var(--color-accent); + margin-right: 0.25em; + font-size: 70%; +} +h1 code.tsd-tag:first-of-type { + margin-left: 0.25em; +} + +dl.tsd-comment-tag-group dd:before, +dl.tsd-comment-tag-group dd:after { + content: " "; +} +dl.tsd-comment-tag-group dd pre, +dl.tsd-comment-tag-group dd:after { + clear: both; +} +dl.tsd-comment-tag-group p { + margin: 0; +} + +.tsd-panel.tsd-comment .lead { + font-size: 1.1em; + line-height: 1.333em; + margin-bottom: 2em; +} +.tsd-panel.tsd-comment .lead:last-child { + margin-bottom: 0; +} + +.tsd-filter-visibility h4 { + font-size: 1rem; + padding-top: 0.75rem; + padding-bottom: 0.5rem; + margin: 0; +} +.tsd-filter-item:not(:last-child) { + margin-bottom: 0.5rem; +} +.tsd-filter-input { + display: flex; + width: fit-content; + width: -moz-fit-content; + align-items: center; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + cursor: pointer; +} +.tsd-filter-input input[type="checkbox"] { + cursor: pointer; + position: absolute; + width: 1.5em; + height: 1.5em; + opacity: 0; +} +.tsd-filter-input input[type="checkbox"]:disabled { + pointer-events: none; +} +.tsd-filter-input svg { + cursor: pointer; + width: 1.5em; + height: 1.5em; + margin-right: 0.5em; + border-radius: 0.33em; + /* Leaving this at full opacity breaks event listeners on Firefox. + Don't remove unless you know what you're doing. */ + opacity: 0.99; +} +.tsd-filter-input input[type="checkbox"]:focus + svg { + transform: scale(0.95); +} +.tsd-filter-input input[type="checkbox"]:focus:not(:focus-visible) + svg { + transform: scale(1); +} +.tsd-checkbox-background { + fill: var(--color-accent); +} +input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { + stroke: var(--color-text); +} +.tsd-filter-input input:disabled ~ svg > .tsd-checkbox-background { + fill: var(--color-background); + stroke: var(--color-accent); + stroke-width: 0.25rem; +} +.tsd-filter-input input:disabled ~ svg > .tsd-checkbox-checkmark { + stroke: var(--color-accent); +} + +.tsd-theme-toggle { + padding-top: 0.75rem; +} +.tsd-theme-toggle > h4 { + display: inline; + vertical-align: middle; + margin-right: 0.75rem; +} + +.tsd-hierarchy { + list-style: square; + margin: 0; +} +.tsd-hierarchy .target { + font-weight: bold; +} + +.tsd-full-hierarchy:not(:last-child) { + margin-bottom: 1em; + padding-bottom: 1em; + border-bottom: 1px solid var(--color-accent); +} +.tsd-full-hierarchy, +.tsd-full-hierarchy ul { + list-style: none; + margin: 0; + padding: 0; +} +.tsd-full-hierarchy ul { + padding-left: 1.5rem; +} +.tsd-full-hierarchy a { + padding: 0.25rem 0 !important; + font-size: 1rem; + display: inline-flex; + align-items: center; + color: var(--color-text); +} + +.tsd-panel-group.tsd-index-group { + margin-bottom: 0; +} +.tsd-index-panel .tsd-index-list { + list-style: none; + line-height: 1.333em; + margin: 0; + padding: 0.25rem 0 0 0; + overflow: hidden; + display: grid; + grid-template-columns: repeat(3, 1fr); + column-gap: 1rem; + grid-template-rows: auto; +} +@media (max-width: 1024px) { + .tsd-index-panel .tsd-index-list { + grid-template-columns: repeat(2, 1fr); + } +} +@media (max-width: 768px) { + .tsd-index-panel .tsd-index-list { + grid-template-columns: repeat(1, 1fr); + } +} +.tsd-index-panel .tsd-index-list li { + -webkit-page-break-inside: avoid; + -moz-page-break-inside: avoid; + -ms-page-break-inside: avoid; + -o-page-break-inside: avoid; + page-break-inside: avoid; +} + +.tsd-flag { + display: inline-block; + padding: 0.25em 0.4em; + border-radius: 4px; + color: var(--color-comment-tag-text); + background-color: var(--color-comment-tag); + text-indent: 0; + font-size: 75%; + line-height: 1; + font-weight: normal; +} + +.tsd-anchor { + position: relative; + top: -100px; +} + +.tsd-member { + position: relative; +} +.tsd-member .tsd-anchor + h3 { + display: flex; + align-items: center; + margin-top: 0; + margin-bottom: 0; + border-bottom: none; +} + +.tsd-navigation.settings { + margin: 1rem 0; +} +.tsd-navigation > a, +.tsd-navigation .tsd-accordion-summary { + width: calc(100% - 0.25rem); + display: flex; + align-items: center; +} +.tsd-navigation a, +.tsd-navigation summary > span, +.tsd-page-navigation a { + display: flex; + width: calc(100% - 0.25rem); + align-items: center; + padding: 0.25rem; + color: var(--color-text); + text-decoration: none; + box-sizing: border-box; +} +.tsd-navigation a.current, +.tsd-page-navigation a.current { + background: var(--color-active-menu-item); +} +.tsd-navigation a:hover, +.tsd-page-navigation a:hover { + text-decoration: underline; +} +.tsd-navigation ul, +.tsd-page-navigation ul { + margin-top: 0; + margin-bottom: 0; + padding: 0; + list-style: none; +} +.tsd-navigation li, +.tsd-page-navigation li { + padding: 0; + max-width: 100%; +} +.tsd-nested-navigation { + margin-left: 3rem; +} +.tsd-nested-navigation > li > details { + margin-left: -1.5rem; +} +.tsd-small-nested-navigation { + margin-left: 1.5rem; +} +.tsd-small-nested-navigation > li > details { + margin-left: -1.5rem; +} + +.tsd-page-navigation ul { + padding-left: 1.75rem; +} + +#tsd-sidebar-links a { + margin-top: 0; + margin-bottom: 0.5rem; + line-height: 1.25rem; +} +#tsd-sidebar-links a:last-of-type { + margin-bottom: 0; +} + +a.tsd-index-link { + padding: 0.25rem 0 !important; + font-size: 1rem; + line-height: 1.25rem; + display: inline-flex; + align-items: center; + color: var(--color-text); +} +.tsd-accordion-summary { + list-style-type: none; /* hide marker on non-safari */ + outline: none; /* broken on safari, so just hide it */ +} +.tsd-accordion-summary::-webkit-details-marker { + display: none; /* hide marker on safari */ +} +.tsd-accordion-summary, +.tsd-accordion-summary a { + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + + cursor: pointer; +} +.tsd-accordion-summary a { + width: calc(100% - 1.5rem); +} +.tsd-accordion-summary > * { + margin-top: 0; + margin-bottom: 0; + padding-top: 0; + padding-bottom: 0; +} +.tsd-index-accordion .tsd-accordion-summary > svg { + margin-left: 0.25rem; +} +.tsd-index-content > :not(:first-child) { + margin-top: 0.75rem; +} +.tsd-index-heading { + margin-top: 1.5rem; + margin-bottom: 0.75rem; +} + +.tsd-kind-icon { + margin-right: 0.5rem; + width: 1.25rem; + height: 1.25rem; + min-width: 1.25rem; + min-height: 1.25rem; +} +.tsd-kind-icon path { + transform-origin: center; + transform: scale(1.1); +} +.tsd-signature > .tsd-kind-icon { + margin-right: 0.8rem; +} + +.tsd-panel { + margin-bottom: 2.5rem; +} +.tsd-panel.tsd-member { + margin-bottom: 4rem; +} +.tsd-panel:empty { + display: none; +} +.tsd-panel > h1, +.tsd-panel > h2, +.tsd-panel > h3 { + margin: 1.5rem -1.5rem 0.75rem -1.5rem; + padding: 0 1.5rem 0.75rem 1.5rem; +} +.tsd-panel > h1.tsd-before-signature, +.tsd-panel > h2.tsd-before-signature, +.tsd-panel > h3.tsd-before-signature { + margin-bottom: 0; + border-bottom: none; +} + +.tsd-panel-group { + margin: 4rem 0; +} +.tsd-panel-group.tsd-index-group { + margin: 2rem 0; +} +.tsd-panel-group.tsd-index-group details { + margin: 2rem 0; +} + +#tsd-search { + transition: background-color 0.2s; +} +#tsd-search .title { + position: relative; + z-index: 2; +} +#tsd-search .field { + position: absolute; + left: 0; + top: 0; + right: 2.5rem; + height: 100%; +} +#tsd-search .field input { + box-sizing: border-box; + position: relative; + top: -50px; + z-index: 1; + width: 100%; + padding: 0 10px; + opacity: 0; + outline: 0; + border: 0; + background: transparent; + color: var(--color-text); +} +#tsd-search .field label { + position: absolute; + overflow: hidden; + right: -40px; +} +#tsd-search .field input, +#tsd-search .title, +#tsd-toolbar-links a { + transition: opacity 0.2s; +} +#tsd-search .results { + position: absolute; + visibility: hidden; + top: 40px; + width: 100%; + margin: 0; + padding: 0; + list-style: none; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); +} +#tsd-search .results li { + background-color: var(--color-background); + line-height: initial; + padding: 4px; +} +#tsd-search .results li:nth-child(even) { + background-color: var(--color-background-secondary); +} +#tsd-search .results li.state { + display: none; +} +#tsd-search .results li.current:not(.no-results), +#tsd-search .results li:hover:not(.no-results) { + background-color: var(--color-accent); +} +#tsd-search .results a { + display: flex; + align-items: center; + padding: 0.25rem; + box-sizing: border-box; +} +#tsd-search .results a:before { + top: 10px; +} +#tsd-search .results span.parent { + color: var(--color-text-aside); + font-weight: normal; +} +#tsd-search.has-focus { + background-color: var(--color-accent); +} +#tsd-search.has-focus .field input { + top: 0; + opacity: 1; +} +#tsd-search.has-focus .title, +#tsd-search.has-focus #tsd-toolbar-links a { + z-index: 0; + opacity: 0; +} +#tsd-search.has-focus .results { + visibility: visible; +} +#tsd-search.loading .results li.state.loading { + display: block; +} +#tsd-search.failure .results li.state.failure { + display: block; +} + +#tsd-toolbar-links { + position: absolute; + top: 0; + right: 2rem; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-end; +} +#tsd-toolbar-links a { + margin-left: 1.5rem; +} +#tsd-toolbar-links a:hover { + text-decoration: underline; +} + +.tsd-signature { + margin: 0 0 1rem 0; + padding: 1rem 0.5rem; + border: 1px solid var(--color-accent); + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 14px; + overflow-x: auto; +} + +.tsd-signature-keyword { + color: var(--color-ts-keyword); + font-weight: normal; +} + +.tsd-signature-symbol { + color: var(--color-text-aside); + font-weight: normal; +} + +.tsd-signature-type { + font-style: italic; + font-weight: normal; +} + +.tsd-signatures { + padding: 0; + margin: 0 0 1em 0; + list-style-type: none; +} +.tsd-signatures .tsd-signature { + margin: 0; + border-color: var(--color-accent); + border-width: 1px 0; + transition: background-color 0.1s; +} +.tsd-description .tsd-signatures .tsd-signature { + border-width: 1px; +} + +ul.tsd-parameter-list, +ul.tsd-type-parameter-list { + list-style: square; + margin: 0; + padding-left: 20px; +} +ul.tsd-parameter-list > li.tsd-parameter-signature, +ul.tsd-type-parameter-list > li.tsd-parameter-signature { + list-style: none; + margin-left: -20px; +} +ul.tsd-parameter-list h5, +ul.tsd-type-parameter-list h5 { + font-size: 16px; + margin: 1em 0 0.5em 0; +} +.tsd-sources { + margin-top: 1rem; + font-size: 0.875em; +} +.tsd-sources a { + color: var(--color-text-aside); + text-decoration: underline; +} +.tsd-sources ul { + list-style: none; + padding: 0; +} + +.tsd-page-toolbar { + position: sticky; + z-index: 1; + top: 0; + left: 0; + width: 100%; + color: var(--color-text); + background: var(--color-background-secondary); + border-bottom: 1px var(--color-accent) solid; + transition: transform 0.3s ease-in-out; +} +.tsd-page-toolbar a { + color: var(--color-text); + text-decoration: none; +} +.tsd-page-toolbar a.title { + font-weight: bold; +} +.tsd-page-toolbar a.title:hover { + text-decoration: underline; +} +.tsd-page-toolbar .tsd-toolbar-contents { + display: flex; + justify-content: space-between; + height: 2.5rem; + margin: 0 auto; +} +.tsd-page-toolbar .table-cell { + position: relative; + white-space: nowrap; + line-height: 40px; +} +.tsd-page-toolbar .table-cell:first-child { + width: 100%; +} +.tsd-page-toolbar .tsd-toolbar-icon { + box-sizing: border-box; + line-height: 0; + padding: 12px 0; +} + +.tsd-widget { + display: inline-block; + overflow: hidden; + opacity: 0.8; + height: 40px; + transition: + opacity 0.1s, + background-color 0.2s; + vertical-align: bottom; + cursor: pointer; +} +.tsd-widget:hover { + opacity: 0.9; +} +.tsd-widget.active { + opacity: 1; + background-color: var(--color-accent); +} +.tsd-widget.no-caption { + width: 40px; +} +.tsd-widget.no-caption:before { + margin: 0; +} + +.tsd-widget.options, +.tsd-widget.menu { + display: none; +} +input[type="checkbox"] + .tsd-widget:before { + background-position: -120px 0; +} +input[type="checkbox"]:checked + .tsd-widget:before { + background-position: -160px 0; +} + +img { + max-width: 100%; +} + +.tsd-anchor-icon { + display: inline-flex; + align-items: center; + margin-left: 0.5rem; + vertical-align: middle; + color: var(--color-text); +} + +.tsd-anchor-icon svg { + width: 1em; + height: 1em; + visibility: hidden; +} + +.tsd-anchor-link:hover > .tsd-anchor-icon svg { + visibility: visible; +} + +.deprecated { + text-decoration: line-through !important; +} + +.warning { + padding: 1rem; + color: var(--color-warning-text); + background: var(--color-background-warning); +} + +.tsd-kind-project { + color: var(--color-ts-project); +} +.tsd-kind-module { + color: var(--color-ts-module); +} +.tsd-kind-namespace { + color: var(--color-ts-namespace); +} +.tsd-kind-enum { + color: var(--color-ts-enum); +} +.tsd-kind-enum-member { + color: var(--color-ts-enum-member); +} +.tsd-kind-variable { + color: var(--color-ts-variable); +} +.tsd-kind-function { + color: var(--color-ts-function); +} +.tsd-kind-class { + color: var(--color-ts-class); +} +.tsd-kind-interface { + color: var(--color-ts-interface); +} +.tsd-kind-constructor { + color: var(--color-ts-constructor); +} +.tsd-kind-property { + color: var(--color-ts-property); +} +.tsd-kind-method { + color: var(--color-ts-method); +} +.tsd-kind-call-signature { + color: var(--color-ts-call-signature); +} +.tsd-kind-index-signature { + color: var(--color-ts-index-signature); +} +.tsd-kind-constructor-signature { + color: var(--color-ts-constructor-signature); +} +.tsd-kind-parameter { + color: var(--color-ts-parameter); +} +.tsd-kind-type-literal { + color: var(--color-ts-type-literal); +} +.tsd-kind-type-parameter { + color: var(--color-ts-type-parameter); +} +.tsd-kind-accessor { + color: var(--color-ts-accessor); +} +.tsd-kind-get-signature { + color: var(--color-ts-get-signature); +} +.tsd-kind-set-signature { + color: var(--color-ts-set-signature); +} +.tsd-kind-type-alias { + color: var(--color-ts-type-alias); +} + +/* if we have a kind icon, don't color the text by kind */ +.tsd-kind-icon ~ span { + color: var(--color-text); +} + +* { + scrollbar-width: thin; + scrollbar-color: var(--color-accent) var(--color-icon-background); +} + +*::-webkit-scrollbar { + width: 0.75rem; +} + +*::-webkit-scrollbar-track { + background: var(--color-icon-background); +} + +*::-webkit-scrollbar-thumb { + background-color: var(--color-accent); + border-radius: 999rem; + border: 0.25rem solid var(--color-icon-background); +} + +/* mobile */ +@media (max-width: 769px) { + .tsd-widget.options, + .tsd-widget.menu { + display: inline-block; + } + + .container-main { + display: flex; + } + html .col-content { + float: none; + max-width: 100%; + width: 100%; + } + html .col-sidebar { + position: fixed !important; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 1024; + top: 0 !important; + bottom: 0 !important; + left: auto !important; + right: 0 !important; + padding: 1.5rem 1.5rem 0 0; + width: 75vw; + visibility: hidden; + background-color: var(--color-background); + transform: translate(100%, 0); + } + html .col-sidebar > *:last-child { + padding-bottom: 20px; + } + html .overlay { + content: ""; + display: block; + position: fixed; + z-index: 1023; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.75); + visibility: hidden; + } + + .to-has-menu .overlay { + animation: fade-in 0.4s; + } + + .to-has-menu .col-sidebar { + animation: pop-in-from-right 0.4s; + } + + .from-has-menu .overlay { + animation: fade-out 0.4s; + } + + .from-has-menu .col-sidebar { + animation: pop-out-to-right 0.4s; + } + + .has-menu body { + overflow: hidden; + } + .has-menu .overlay { + visibility: visible; + } + .has-menu .col-sidebar { + visibility: visible; + transform: translate(0, 0); + display: flex; + flex-direction: column; + gap: 1.5rem; + max-height: 100vh; + padding: 1rem 2rem; + } + .has-menu .tsd-navigation { + max-height: 100%; + } +} + +/* one sidebar */ +@media (min-width: 770px) { + .container-main { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); + grid-template-areas: "sidebar content"; + margin: 2rem auto; + } + + .col-sidebar { + grid-area: sidebar; + } + .col-content { + grid-area: content; + padding: 0 1rem; + } +} +@media (min-width: 770px) and (max-width: 1399px) { + .col-sidebar { + max-height: calc(100vh - 2rem - 42px); + overflow: auto; + position: sticky; + top: 42px; + padding-top: 1rem; + } + .site-menu { + margin-top: 1rem; + } +} + +/* two sidebars */ +@media (min-width: 1200px) { + .container-main { + grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr) minmax(0, 20rem); + grid-template-areas: "sidebar content toc"; + } + + .col-sidebar { + display: contents; + } + + .page-menu { + grid-area: toc; + padding-left: 1rem; + } + .site-menu { + grid-area: sidebar; + } + + .site-menu { + margin-top: 1rem 0; + } + + .page-menu, + .site-menu { + max-height: calc(100vh - 2rem - 42px); + overflow: auto; + position: sticky; + top: 42px; + } +} +.col-content { + line-height: 1.4; +} + +dl.tsd-comment-tags * ~ p { + margin: 1em 0; +} + +.col-content a:has(> :is(h1, h2, h3, h4, h5, h6)):before { + content: ""; + display: block; + margin-top: 2em; +} + +.col-content p + pre, +.col-content :is(h1, h2, h3, h4, h5, h6) + pre { + margin-bottom: 2em; +} + +.col-content a { + color: #0083e6; +} diff --git a/docs/v4.4.3/classes/I18n.html b/docs/v4.4.3/classes/I18n.html new file mode 100644 index 0000000..28a6d6b --- /dev/null +++ b/docs/v4.4.3/classes/I18n.html @@ -0,0 +1,1638 @@ + + + + + + +I18n | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Class I18n

+
+

Constructors

+
+
    + +
  • +
    +

    Parameters

    + +
    +

    Returns I18n +

    + +
  • +

Properties

+
+
+availableLocales: string[] = [] +
+
+

Set the available locales.

+
+
+
+
+defaultSeparator: string +
+
+

Set the default string separator. Defaults to ., as in +scope.translation.

+
+
+
+
+distanceOfTimeInWords: ((fromTime, toTime, options?) => string) = ... +
+
+

Type declaration

+ +
+
+

Alias

+

timeAgoInWords

+
+
+
+enableFallback: boolean +
+
+

Set if engine should fallback to the default locale when a translation is +missing. Defaults to false.

+

When enabled, missing translations will first be looked for in less +specific versions of the requested locale and if that fails by taking them +from your I18n#defaultLocale.

+
+
+
+
+interpolate: ((i18n, message, options) => string) +
+
+

Override the interpolation function. For the default implementation, see +https://github.com/fnando/i18n/tree/main/src/helpers/interpolate.ts

+
+
+

Type declaration

+ +
+
+
+
+l: ((type, value, options?) => string) = ... +
+
+

Type declaration

+
    • +
    • +(type, value, options?): string +
    • +
    • +
      +

      Parameters

      +
        +
      • +type: string +
      • +
      • +value: undefined | null | string | number | Date +
      • +
      • +Optional options: Dict +
      • +
      +
      +

      Returns string +

      +
      +

      Alias

      +

      localize

      +
      +
    • +
+
+
+

Alias

+

localize

+
+
+
+locales: Locales +
+
+

The locale resolver registry.

+
+
+

See

+

Locales

+
+
+
+missingBehavior: string +
+
+

Set missing translation behavior.

+
    +
  • +message will display a message that the translation is missing.
  • +
  • +guess will try to guess the string.
  • +
  • +error will raise an exception whenever a translation is not defined.
  • +
+

See MissingTranslation.register for instructions on how to define +your own behavior.

+
+
+
+
+missingPlaceholder: MissingPlaceholderHandler +
+
+

Return a missing placeholder message for given parameters.

+
+
+
+
+missingTranslation: MissingTranslation +
+
+

The missing translation behavior registry.

+
+ +
+
+missingTranslationPrefix: string +
+
+

If you use missingBehavior with 'message', but want to know that the string +is actually missing for testing purposes, you can prefix the guessed string +by setting the value here. By default, no prefix is used.

+
+
+
+
+nullPlaceholder: NullPlaceholderHandler +
+
+

Return a placeholder message for null values. Defaults to the same behavior +as I18n.missingPlaceholder.

+
+
+
+
+onChangeHandlers: OnChangeHandler[] = [] +
+
+

List of all onChange handlers.

+
+
+
+
+p: ((count, scope, options?) => string) = ... +
+
+

Type declaration

+
    • +
    • +(count, scope, options?): string +
    • +
    • +
      +

      Parameters

      + +
      +

      Returns string +

      +
      +

      Alias

      +

      pluralize

      +
      +
    • +
+
+
+

Alias

+

pluralize

+
+
+
+placeholder: RegExp +
+
+

Set the placeholder format. Accepts {{placeholder}} and %{placeholder}.

+
+
+
+
+pluralization: Pluralization +
+
+

The pluralization behavior registry.

+
+
+

See

+

Pluralization

+
+
+
+t: (<T>(scope, options?) => string | T) = ... +
+
+

Type declaration

+
    • +
    • +<T>(scope, options?): string | T +
    • +
    • +

      Type Parameters

      +
      • +T = string +

      +

      Parameters

      + +
      +

      Returns string | T +

      +
      +

      Alias

      +

      translate

      +
      +
    • +
+
+
+

Alias

+

translate

+
+
+
+transformKey: ((key) => string) +
+
+

Transform keys. By default, it returns the key as it is, but allows for +overriding. For instance, you can set a function to receive the camelcase +key, and convert it to snake case.

+
+
+

Type declaration

+
    • +
    • +(key): string +
    • +
    • +
      +

      Transform keys. By default, it returns the key as it is, but allows for +overriding. For instance, you can set a function to receive the camelcase +key, and convert it to snake case.

      +
      +
      +

      Parameters

      +
      • +key: string +
      +
      +

      Returns string +

      +
      +
    • +
+
+
+
+
+translations: Dict = {} +
+
+

Set the registered translations. The root key must always be the locale +(and its variations with region).

+

Remember that no events will be triggered if you change this object +directly. To trigger onchange events, you must perform updates either +using I18n#store or I18n#update.

+
+
+

Accessors

+
+
    +
  • +get defaultLocale(): string +
  • +
  • +
    +

    Return the default locale, using a explicit locale set using +i18n.defaultLocale = locale, the default locale set using +i18n.defaultLocale or the fallback, which is en.

    +
    +

    Returns string +

    +

    The current locale.

    +
    + +
  • +
  • +set defaultLocale(newLocale): void +
  • +
  • +
    +

    Set the default locale explicitly.

    +
    +
    +

    Parameters

    +
    • +
      +newLocale: string +
      +
      +

      The new locale.

      +
      +
      +
    +
    +

    Returns void +

    +
    + +
  • +
+
    +
  • +get locale(): string +
  • +
  • +
    +

    Return the current locale, using a explicit locale set using +i18n.locale = newLocale, the default locale set using +i18n.defaultLocale or the fallback, which is en.

    +
    +

    Returns string +

    +

    The current locale.

    +
    + +
  • +
  • +set locale(newLocale): void +
  • +
  • +
    +

    Set the current locale explicitly.

    +
    +
    +

    Parameters

    +
    • +
      +newLocale: string +
      +
      +

      The new locale.

      +
      +
      +
    +
    +

    Returns void +

    +
    + +
  • +
+
    +
  • +get version(): number +
  • +
  • +
    +

    Return the change version. This value is incremented whenever I18n#store +or I18n#update is called, or when I18n#locale/I18n#defaultLocale is +set.

    +
    +

    Returns number +

    +
    + +
  • +

Methods

+
+
    + +
  • +
    +

    Formats a number.

    +
    +
    +

    Parameters

    +
      +
    • +
      +input: Numeric +
      +
      +

      The numeric value that will be + formatted.

      +
      +
      +
    • +
    • +
      +options: Partial<FormatNumberOptions> = {} +
      +
      +

      The formatting options. Defaults to: + { delimiter: ",", precision: 3, separator: ".", unit: "", format: "%u%n", significant: false, stripInsignificantZeros: false, }

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The formatted number.

    +
    + +
  • +
+
    + +
  • +
    +

    Parameters

    +
    • +
      +scope: Scope +
      +
      +

      The scope lookup path.

      +
      +
      +
    +
    +

    Returns any +

    +

    The found scope.

    +
    + +
  • +
+
    + +
  • +
    +

    Localize several values.

    +

    You can provide the following scopes: currency, number, or +percentage. If you provide a scope that matches the /^(date|time)/ +regular expression then the value will be converted by using the +I18n.toTime function. It will default to the value's toString function.

    +

    If value is either null or undefined then an empty string will be +returned, regardless of what localization type has been used.

    +
    +
    +

    Parameters

    +
      +
    • +
      +type: string +
      +
      +

      The localization type.

      +
      +
      +
    • +
    • +
      +value: undefined | null | string | number | Date +
      +
      +

      The value that must be localized.

      +
      +
      +
    • +
    • +
      +Optional options: Dict +
      +
      +

      The localization options.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The localized string.

    +
    + +
  • +
+
    + +
  • +
    +

    Formats a number into a currency string (e.g., $13.65). You can customize +the format in the using an options object.

    +

    The currency unit and number formatting of the current locale will be used +unless otherwise specified in the provided options. No currency conversion +is performed. If the user is given a way to change their locale, they will +also be able to change the relative value of the currency displayed with +this helper.

    +
    +
    +

    Parameters

    +
      +
    • +
      +input: Numeric +
      +
      +

      The number to be formatted.

      +
      +
      +
    • +
    • +
      +options: Partial<FormatNumberOptions> = {} +
      +
      +

      The formatting options. When +defined, supersedes the default options defined by number.format and +number.currency.*.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The formatted number.

    +
    +

    Example

    +
    i18n.numberToCurrency(1234567890.5);
    // => "$1,234,567,890.50"

    i18n.numberToCurrency(1234567890.506);
    // => "$1,234,567,890.51"

    i18n.numberToCurrency(1234567890.506, { precision: 3 });
    // => "$1,234,567,890.506"

    i18n.numberToCurrency("123a456");
    // => "$123a456"

    i18n.numberToCurrency("123a456", { raise: true });
    // => raises exception ("123a456" is not a valid numeric value)

    i18n.numberToCurrency(-0.456789, { precision: 0 });
    // => "$0"

    i18n.numberToCurrency(-1234567890.5, { negativeFormat: "(%u%n)" });
    // => "($1,234,567,890.50)"

    i18n.numberToCurrency(1234567890.5, {
    unit: "&pound;",
    separator: ",",
    delimiter: "",
    });
    // => "&pound;1234567890,50"

    i18n.numberToCurrency(1234567890.5, {
    unit: "&pound;",
    separator: ",",
    delimiter: "",
    format: "%n %u",
    });
    // => "1234567890,50 &pound;"

    i18n.numberToCurrency(1234567890.5, { stripInsignificantZeros: true });
    // => "$1,234,567,890.5"

    i18n.numberToCurrency(1234567890.5, { precision: 0, roundMode: "up" });
    // => "$1,234,567,891" +
    +
    + +
  • +
+
    + +
  • +
    +

    Formats a +number+ with grouped thousands using delimiter (e.g., 12,324). +You can customize the format in the options parameter.

    +
    +
    +

    Parameters

    +
      +
    • +
      +input: Numeric +
      +
      +

      The numeric value that will be formatted.

      +
      +
      +
    • +
    • +
      +options: Partial<NumberToDelimitedOptions> = {} +
      +
      +

      The formatting options.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The formatted number.

    +
    +

    Example

    +
    i18n.numberToDelimited(12345678);
    // => "12,345,678"

    i18n.numberToDelimited("123456");
    // => "123,456"

    i18n.numberToDelimited(12345678.05);
    // => "12,345,678.05"

    i18n.numberToDelimited(12345678, { delimiter: "." });
    // => "12.345.678"

    i18n.numberToDelimited(12345678, { delimiter: "," });
    // => "12,345,678"

    i18n.numberToDelimited(12345678.05, { separator: " " });
    // => "12,345,678 05"

    i18n.numberToDelimited("112a");
    // => "112a"

    i18n.numberToDelimited(98765432.98, { delimiter: " ", separator: "," });
    // => "98 765 432,98"

    i18n.numberToDelimited("123456.78", {
    delimiterPattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/g,
    });
    // => "1,23,456.78" +
    +
    + +
  • +
+
    + +
  • +
    +

    Convert a number into a readable representation.

    +
    +
    +

    Parameters

    +
      +
    • +
      +input: Numeric +
      +
      +

      The number that will be formatted.

      +
      +
      +
    • +
    • +
      +options: Partial<NumberToHumanOptions> = {} +
      +
      +

      The formatting options. When +defined, supersedes the default options stored at number.human.format.* +and number.human.storage_units.*.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The formatted number.

    +
    +

    Example

    +
    i18n.numberToHuman(123);
    // => "123"

    i18n.numberToHuman(1234);
    // => "1.23 Thousand"

    i18n.numberToHuman(12345);
    // => "12.3 Thousand"

    i18n.numberToHuman(1234567);
    // => "1.23 Million"

    i18n.numberToHuman(1234567890);
    // => "1.23 Billion"

    i18n.numberToHuman(1234567890123);
    // => "1.23 Trillion"

    i18n.numberToHuman(1234567890123456);
    // => "1.23 Quadrillion"

    i18n.numberToHuman(1234567890123456789);
    // => "1230 Quadrillion"

    i18n.numberToHuman(489939, { precision: 2 });
    // => "490 Thousand"

    i18n.numberToHuman(489939, { precision: 4 });
    // => "489.9 Thousand"

    i18n.numberToHuman(489939, { precision: 2, roundMode: "down" });
    // => "480 Thousand"

    i18n.numberToHuman(1234567, { precision: 4, significant: false });
    // => "1.2346 Million"

    i18n.numberToHuman(1234567, {
    precision: 1,
    separator: ",",
    significant: false,
    });
    // => "1,2 Million"

    i18n.numberToHuman(500000000, { precision: 5 });
    // => "500 Million"

    i18n.numberToHuman(12345012345, { significant: false });
    // => "12.345 Billion" +
    +

    Non-significant zeros after the decimal separator are stripped out by default +(set stripInsignificantZeros to false to change that):

    +
    i18n.numberToHuman(12.00001);
    // => "12"

    i18n.numberToHuman(12.00001, { stripInsignificantZeros: false });
    // => "12.0" +
    +

    You can also use your own custom unit quantifiers:

    +
    i18n.numberToHuman(500000, units: { unit: "ml", thousand: "lt" });
    // => "500 lt" +
    +

    If in your I18n locale you have:

    +
    ---
    en:
    distance:
    centi:
    one: "centimeter"
    other: "centimeters"
    unit:
    one: "meter"
    other: "meters"
    thousand:
    one: "kilometer"
    other: "kilometers"
    billion: "gazillion-distance" +
    +

    Then you could do:

    +
    i18n.numberToHuman(543934, { units: "distance" });
    // => "544 kilometers"

    i18n.numberToHuman(54393498, { units: "distance" });
    // => "54400 kilometers"

    i18n.numberToHuman(54393498000, { units: "distance" });
    // => "54.4 gazillion-distance"

    i18n.numberToHuman(343, { units: "distance", precision: 1 });
    // => "300 meters"

    i18n.numberToHuman(1, { units: "distance" });
    // => "1 meter"

    i18n.numberToHuman(0.34, { units: "distance" });
    // => "34 centimeters" +
    +
    + +
  • +
+
    + +
  • +
    +

    Convert a number into a readable size representation.

    +
    +
    +

    Parameters

    +
      +
    • +
      +input: Numeric +
      +
      +

      The number that will be formatted.

      +
      +
      +
    • +
    • +
      +options: Partial<NumberToHumanSizeOptions> = {} +
      +
      +

      The formatting options. When +defined, supersedes the default options stored at +number.human.storage_units.* and number.human.format.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The formatted number.

    +
    +

    Example

    +
    i18n.numberToHumanSize(123)
    // => "123 Bytes"

    i18n.numberToHumanSize(1234)
    // => "1.21 KB"

    i18n.numberToHumanSize(12345)
    // => "12.1 KB"

    i18n.numberToHumanSize(1234567)
    // => "1.18 MB"

    i18n.numberToHumanSize(1234567890)
    // => "1.15 GB"

    i18n.numberToHumanSize(1234567890123)
    // => "1.12 TB"

    i18n.numberToHumanSize(1234567890123456)
    // => "1.1 PB"

    i18n.numberToHumanSize(1234567890123456789)
    // => "1.07 EB"

    i18n.numberToHumanSize(1234567, {precision: 2})
    // => "1.2 MB"

    i18n.numberToHumanSize(483989, precision: 2)
    // => "470 KB"

    i18n.numberToHumanSize(483989, {precision: 2, roundMode: "up"})
    // => "480 KB"

    i18n.numberToHumanSize(1234567, {precision: 2, separator: ","})
    // => "1,2 MB"

    i18n.numberToHumanSize(1234567890123, {precision: 5})
    // => "1.1228 TB"

    i18n.numberToHumanSize(524288000, {precision: 5})
    // => "500 MB" +
    +
    + +
  • +
+
    + +
  • +
    +

    Convert a number into a formatted percentage value.

    +
    +
    +

    Parameters

    +
      +
    • +
      +input: Numeric +
      +
      +

      The number to be formatted.

      +
      +
      +
    • +
    • +
      +options: Partial<NumberToPercentageOptions> = {} +
      +
      +

      The formatting options. When +defined, supersedes the default options stored at number.format and +number.percentage.*.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The formatted number.

    +
    +

    Example

    +
    i18n.numberToPercentage(100);
    // => "100.000%"

    i18n.numberToPercentage("98");
    // => "98.000%"

    i18n.numberToPercentage(100, { precision: 0 });
    // => "100%"

    i18n.numberToPercentage(1000, { delimiter: ".", separator: "," });
    // => "1.000,000%"

    i18n.numberToPercentage(302.24398923423, { precision: 5 });
    // => "302.24399%"

    i18n.numberToPercentage(1000, { precision: null });
    // => "1000%"

    i18n.numberToPercentage("98a");
    // => "98a%"

    i18n.numberToPercentage(100, { format: "%n %" });
    // => "100.000 %"

    i18n.numberToPercentage(302.24398923423, { precision: 5, roundMode: "down" });
    // => "302.24398%" +
    +
    + +
  • +
+
    + +
  • +
    +

    Convert number to a formatted rounded value.

    +
    +
    +

    Parameters

    +
      +
    • +
      +input: Numeric +
      +
      +

      The number to be formatted.

      +
      +
      +
    • +
    • +
      +Optional options: Partial<NumberToRoundedOptions> +
      +
      +

      The formatting options.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The formatted number.

    +
    +

    Example

    +
    i18n.numberToRounded(111.2345);
    // => "111.235"

    i18n.numberToRounded(111.2345, { precision: 2 });
    // => "111.23"

    i18n.numberToRounded(13, { precision: 5 });
    // => "13.00000"

    i18n.numberToRounded(389.32314, { precision: 0 });
    // => "389"

    i18n.numberToRounded(111.2345, { significant: true });
    // => "111"

    i18n.numberToRounded(111.2345, { precision: 1, significant: true });
    // => "100"

    i18n.numberToRounded(13, { precision: 5, significant: true });
    // => "13.000"

    i18n.numberToRounded(13, { precision: null });
    // => "13"

    i18n.numberToRounded(389.32314, { precision: 0, roundMode: "up" });
    // => "390"

    i18n.numberToRounded(13, {
    precision: 5,
    significant: true,
    stripInsignificantZeros: true,
    });
    // => "13"

    i18n.numberToRounded(389.32314, { precision: 4, significant: true });
    // => "389.3"

    i18n.numberToRounded(1111.2345, {
    precision: 2,
    separator: ",",
    delimiter: ".",
    });
    // => "1.111,23" +
    +
    + +
  • +
+
    + +
  • +
    +

    Add a callback that will be executed whenever locale/defaultLocale changes, +or I18n#store / I18n#update is called.

    +
    +
    +

    Parameters

    +
    • +
      +callback: OnChangeHandler +
      +
      +

      The callback that will be executed.

      +
      +
      +
    +
    +

    Returns (() => void) +

    +

    Return a function that can be used to unsubscribe the + event handler.

    +
      • +
      • +(): void +
      • +
      • Returns void +

      • +
    +
    + +
  • +
+
    + +
  • +
    +

    Pluralize the given scope using the count value. The pluralized +translation may have other placeholders, which will be retrieved from +options.

    +
    +
    +

    Parameters

    +
      +
    • +
      +count: number +
      +
      +

      The counting number.

      +
      +
      +
    • +
    • +
      +scope: Scope +
      +
      +

      The translation scope.

      +
      +
      +
    • +
    • +
      +Optional options: TranslateOptions +
      +
      +

      The translation options.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The translated string.

    +
    + +
  • +
+
    + +
  • +
    +

    Update translations by merging them. Newest translations will override +existing ones.

    +
    +
    +

    Parameters

    +
    • +
      +translations: Dict +
      +
      +

      An object containing the translations that will +be merged into existing translations.

      +
      +
      +
    +
    +

    Returns void +

    +
    + +
  • +
+
    + +
  • +
    +

    Formats time according to the directives in the given format string. +The directives begins with a percent (%) character. Any text not listed +as a directive will be passed through to the output string.

    +
    +
    +

    Parameters

    +
      +
    • +
      +date: Date +
      +
      +

      The date that will be formatted.

      +
      +
      +
    • +
    • +
      +format: string +
      +
      +

      The formatting string.

      +
      +
      +
    • +
    • +
      +options: Partial<StrftimeOptions> = {} +
      +
      +

      The formatting options.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The formatted date.

    +
    +

    See

    +

    strftime

    +
    + +
  • +
+
    + +
  • +
    +

    Reports the approximate distance in time between two time representations.

    +
    +
    +

    Parameters

    +
      +
    • +
      +fromTime: DateTime +
      +
      +

      The initial time.

      +
      +
      +
    • +
    • +
      +toTime: DateTime +
      +
      +

      The ending time. Defaults to Date.now().

      +
      +
      +
    • +
    • +
      +options: TimeAgoInWordsOptions = {} +
      +
      +

      The options.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The distance in time representation.

    +
    + +
  • +
+
    + +
  • +
    +

    Converts the array to a comma-separated sentence where the last element is +joined by the connector word.

    +
    +
    +

    Parameters

    +
      +
    • +
      +items: any[] +
      +
      +

      The list of items that will be joined.

      +
      +
      +
    • +
    • +
      +options: Partial<ToSentenceOptions> = {} +
      +
      +

      The options.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The joined string.

    +
    +

    Example

    +
    i18n.toSentence(["apple", "banana", "pineapple"]);
    //=> apple, banana, and pineapple. +
    +
    + +
  • +
+
    + +
  • +
    +

    Convert the given dateString into a formatted date.

    +
    +
    +

    Parameters

    +
      +
    • +
      +scope: Scope +
      +
      +

      The formatting scope.

      +
      +
      +
    • +
    • +
      +input: DateTime +
      +
      +

      The string that must be parsed into a Date object.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The formatted date.

    +
    + +
  • +
+
    + +
  • +
    +

    Translate the given scope with the provided options.

    +
    +

    Type Parameters

    +
    • +T = string +

    +

    Parameters

    +
      +
    • +
      +scope: Scope +
      +
      +

      The scope that will be used.

      +
      +
      +
    • +
    • +
      +Optional options: TranslateOptions +
      +
      +

      The options that will be used on the +translation. Can include some special options like defaultValue, count, +and scope. Everything else will be treated as replacement values.

      +
      +
      +
    • +
    +
    +

    Returns string | T +

    +

    The translated string.

    +
    + +
  • +
+
    + +
  • +
    +

    You may want to update a part of your translations. This is a public +interface for doing it so.

    +

    If the provided path exists, it'll be replaced. Otherwise, a new node will +be created. When running in strict mode, paths that doesn't already exist +will raise an exception.

    +

    Strict mode will also raise an exception if the override type differs from +previous node type.

    +
    +
    +

    Parameters

    +
      +
    • +
      +path: string +
      +
      +

      The path that's going to be updated. It must +include the language, as in en.messages.

      +
      +
      +
    • +
    • +
      +override: any +
      +
      +

      The new translation node.

      +
      +
      +
    • +
    • +
      +options: {
          strict: boolean;
      } = ... +
      +
      +

      Set options.

      +
      +
      +
      • +
        +strict: boolean +
        +
        +

        Raise an exception if path doesn't already +exist, or if previous node's type differs from new node's type.

        +
        +
        +
      +
    • +
    +
    +

    Returns void +

    +
    +

    Example

    +
    i18n.update("en.number.format", {unit: "%n %u"});
    i18n.update("en.number.format", {unit: "%n %u"}, true); +
    +
    + +
  • +
+
    + +
  • +
    +

    Executes function with given locale set. The locale will be changed only +during the callback's execution, switching back to the previous value +once it finishes (with or without errors).

    +

    This is an asynchronous call, which means you must use await or you may +end up with a race condition.

    +
    +
    +

    Parameters

    +
      +
    • +
      +locale: string +
      +
      +

      The temporary locale that will be set during the +function's execution.

      +
      +
      +
    • +
    • +
      +callback: (() => void) +
      +
      +

      The function that will be executed with a +temporary locale set.

      +
      +
      +
        • +
        • +(): void +
        • +
        • Returns void +

        • +
      +
    • +
    +
    +

    Returns Promise<void> +

    +
    +

    Example

    +
    await i18n.withLocale("pt", () => {
    console.log(i18n.t("hello"));
    }); +
    +
    + +
  • +
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/classes/Locales.html b/docs/v4.4.3/classes/Locales.html new file mode 100644 index 0000000..a0760c9 --- /dev/null +++ b/docs/v4.4.3/classes/Locales.html @@ -0,0 +1,189 @@ + + + + + + +Locales | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Class Locales

+
+
+

Constructors

+

Methods

+
+

Constructors

+
+

Methods

+
+
    + +
  • +
    +

    Return a list of all locales that must be tried before returning the +missing translation message. By default, this will consider the inline +option, current locale and fallback locale.

    +
    i18n.locales.get("de-DE");
    // ["de-DE", "de", "en"] +
    +
    +
    +

    Parameters

    +
    • +
      +locale: string +
      +
      +

      The locale query.

      +
      +
      +
    +
    +

    Returns string[] +

    +

    The list of locales.

    +
    + +
  • +
+
    + +
  • +
    +

    You can define custom rules for any locale. Just make sure you return an +array containing all locales.

    +
    // Default the Wookie locale to English.
    i18n.locales.register("wk", (_i18n, locale) => {
    return ["en"];
    }); +
    +
    +
    +

    Parameters

    +
      +
    • +
      +locale: string +
      +
      +

      The locale's name.

      +
      +
      +
    • +
    • +
      +localeResolver: string | string[] | LocaleResolver +
      +
      +

      The locale resolver +strategy.

      +
      +
      +
    • +
    +
    +

    Returns void +

    +
    + +
  • +
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/classes/MissingTranslation.html b/docs/v4.4.3/classes/MissingTranslation.html new file mode 100644 index 0000000..81fcd79 --- /dev/null +++ b/docs/v4.4.3/classes/MissingTranslation.html @@ -0,0 +1,200 @@ + + + + + + +MissingTranslation | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Class MissingTranslation

+
+
+

Constructors

+

Methods

+
+

Constructors

+
+

Methods

+
+
    + +
  • +
    +

    Return a missing translation message for the given parameters.

    +
    +
    +

    Parameters

    +
      +
    • +
      +scope: Scope +
      +
      +

      The translations' scope.

      +
      +
      +
    • +
    • +
      +options: Dict +
      +
      +

      The translations' options.

      +
      +
      +
    • +
    +
    +

    Returns string +

    +

    The missing translation.

    +
    + +
  • +
+
    + +
  • +
    +

    Registers a new missing translation strategy. This is how messages are +defined when a translation cannot be found.

    +

    The follow example registers a strategy that always return the phrase +"Oops! Missing translation.".

    +
    +
    +

    Parameters

    +
      +
    • +
      +name: string +
      +
      +

      The strategy name.

      +
      +
      +
    • +
    • +
      +strategy: MissingTranslationStrategy +
      +
      +

      A function that returns a +string the result of a missing translation scope.

      +
      +
      +
    • +
    +
    +

    Returns void +

    +
    +

    Example

    +
    i18n.missingTranslation.register(
    "oops",
    (i18n, scope, options) => "Oops! Missing translation."
    );

    i18n.missingBehavior = "oops"; +
    +
    + +
  • +
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/classes/Pluralization.html b/docs/v4.4.3/classes/Pluralization.html new file mode 100644 index 0000000..90510a0 --- /dev/null +++ b/docs/v4.4.3/classes/Pluralization.html @@ -0,0 +1,227 @@ + + + + + + +Pluralization | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Class Pluralization

+
+
+

This class enables registering different strategies for pluralization, as +well as getting a pluralized translation.

+

The default pluralization strategy is based on three counters:

+
    +
  • +one: returned when count is equal to absolute 1.
  • +
  • +zero: returned when count is equal to 0. If this translation is not +set, then it defaults to other.
  • +
  • +other: returned when count is different than absolute 1.
  • +
+

When calling i18n.translate (or its alias), pluralization rules will be +triggered whenever the translation options contain count.

+
+
+

Example

+

A JSON describing the pluralization rules.

+
{
"en": {
"inbox": {
"zero": "You have no messages",
"one": "You have one message",
"other": "You have %{count} messages"
}
}
} +
+

Example

+

How to get pluralized translations.

+
i18n.t("inbox", {count: 0}); // returns "You have no messages"
i18n.t("inbox", {count: 1}); // returns "You have on message"
i18n.t("inbox", {count: 2}); // returns "You have 2 messages" +
+
+

Constructors

+

Methods

+
+

Constructors

+
+

Methods

+
+
    + +
  • +
    +

    Returns a list of possible pluralization keys. +This is defined by a chain of pluralizers, going from locale set +explicitly, then the locale set through i18n.locale, defaulting to +defaultPluralizer.

    +
    +
    +

    Parameters

    +
    • +
      +locale: string +
      +
      +

      The locale.

      +
      +
      +
    +
    +

    Returns Pluralizer +

    +

    The pluralizer function.

    +
    + +
  • +
+
    + +
  • +
    +

    Register a new pluralizer strategy.

    +

    You may want to support different pluralization rules based on the locales +you have to support. If you do, make sure you submit a pull request at +https://github.com/fnando/i18n so we can distribute it. For now only +Russian is distributed.

    +

    The pluralizer will receive the I18n instance, together with count. +Is up to the pluralizer to return a list of possible keys given that count. +The Russian pluralizer, for instance, returns one, few, many, other +as possible pluralization keys.

    +

    You can view a complete list of pluralization rules at +unicode.org.

    +

    You can also leverage +make-plural, rather than writing +all your pluralization functions. For this, you must wrap make-plural's +function by using useMakePlural({ pluralizer, includeZero, ordinal }):

    +
    +
    +

    Parameters

    +
      +
    • +
      +locale: string +
      +
      +

      The locale.

      +
      +
      +
    • +
    • +
      +pluralizer: Pluralizer +
      +
      +

      The pluralizer function.

      +
      +
      +
    • +
    +
    +

    Returns void +

    +
    +

    Example

    +
    import { ru } from "make-plural";
    import { useMakePlural } from "i18n-js";

    i18n.pluralization.register("ru", useMakePlural({ pluralizer: ru })); +
    +
    + +
  • +
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/functions/useMakePlural.html b/docs/v4.4.3/functions/useMakePlural.html new file mode 100644 index 0000000..af31e62 --- /dev/null +++ b/docs/v4.4.3/functions/useMakePlural.html @@ -0,0 +1,105 @@ + + + + + + +useMakePlural | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Function useMakePlural

+
+
    + +
  • +
    +

    Creates a new pluralizer function based on make-plural.

    +
    +
    +

    Parameters

    +
    • +
      +__namedParameters: {
          includeZero?: boolean;
          ordinal?: boolean;
          pluralizer: MakePlural;
      } +
      +
        +
      • +Optional includeZero?: boolean +
      • +
      • +Optional ordinal?: boolean +
      • +
      • +pluralizer: MakePlural +
      • +
      +
    +
    +

    Returns Pluralizer +

    +

    Returns a pluralizer that can be used by I18n.

    +
    + +
  • +
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/index.html b/docs/v4.4.3/index.html new file mode 100644 index 0000000..d9468ed --- /dev/null +++ b/docs/v4.4.3/index.html @@ -0,0 +1,636 @@ + + + + + + +i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+

i18n-js v4.4.3

+
+

+ i18n.js +

+ +

+ A small library to provide the i18n translations on the JavaScript. +

+ +

+ Tests + npm version + npm downloads + License: MIT +

+ +

Installation

+
    +
  • Yarn: yarn add i18n-js@latest +
  • +
  • NPM: npm install i18n-js@latest +
  • +
+

Usage

+

Setting up

+

First, you need to instantiate I18n with the translations' object, the main +class of this library.

+
import { I18n } from "i18n-js";
import translations from "./translations.json";

const i18n = new I18n(translations); +
+

The translations object is a direct export of translations defined by +Ruby on Rails. To export the +translations, you can use i18n-js, a Ruby +gem that's completely disconnected from Rails and that can be used for the +solely purpose of exporting the translations, even if your project is written in +a different language. If all you care about is some basic translation mechanism, +then you can set the object like this:

+
const i18n = new I18n({
en: {
hello: "Hi!",
},
"pt-BR": {
hello: "Olá!",
},
}); +
+

Each root key is a different locale that may or may not have the script code. +This library also supports locales with region code, like zh-Hant-TW.

+

Once everything is set up, you can then define the locale. en is both the +current and default locale. To override either values, you have to use +I18n#defaultLocale and I18n#locale.

+
i18n.defaultLocale = "pt-BR";
i18n.locale = "pt-BR"; +
+

Base translations

+

This library comes bundled with all base translations made available by +rails-i18n. +Base translations allow formatting date, numbers, and sentence connectors, among +other things.

+

To load the base translations, use something like the following:

+
import { I18n } from "i18n-js";
import ptBR from "i18n-js/json/pt-BR.json";
import en from "i18n-js/json/en.json";

const i18n = new I18n({
...ptBR,
...en,
}); +
+

Updating translation store

+

Updating the translation store is trivial. All you have to do is calling +I18n#store with the translations that need to be merged. Let's assume you've +exported all your app's translations using +i18n-js CLI, using a separate file for each +language, like this:

+
    +
  • translations/en.json
  • +
  • translations/pt-BR.json
  • +
+

This is how you could update the store:

+
import { I18n } from "i18n-js";
import ptBR from "translations/pt-BR.json";
import en from "translations/en.json";

const i18n = new I18n();

i18n.store(en);
i18n.store(ptBR); +
+

This method will allow you to lazy load translations and them updating the store +as needed.

+
import { I18n } from "i18n-js";

async function loadTranslations(i18n, locale) {
const response = await fetch(`/translations/${locale}.json`);
const translations = await response.json();

i18n.store(translations);
}

const i18n = new I18n();
loadTranslations(i18n, "es"); +
+

Events

+

A change event is triggered whenever I18n#store or I18n#update is called, or +when I18n#locale/I18n#defaultLocale is set. To subscribe to these changes, +use the method I18n#onChange(i18n: I18n).

+
const i18n = new I18n();
i18n.onChange(() => {
console.log("I18n has changed!");
}); +
+

Every change will increment the property I18n#version, so you can use it as a +cache key. Also, when you subscribe to change events, +I18n#onChange(i18n: I18n) will return another function that can be used to +remove the event handler.

+
useEffect(() => {
const unsubscribe = i18n.onChange(() => {
// do something
});

return unsubscribe;
}, []);

useEffect(() => {
console.log("I18n has been updated!");
}, [i18n.version]); +
+

Translating messages

+

To translate messages, you have to use the I18n#translate, or its I18n#t +alias.

+
i18n.locale = "en";
i18n.t("hello"); //=> Hi!

i18n.locale = "pt-BR";
i18n.t("hello"); //=> Olá! +
+

You can also provide an array as scope. Both calls below are equivalent.

+
i18n.t(["greetings", "hello"]);
i18n.t("greetings.hello"); +
+

Your translations may have dynamic values that should be interpolated. Here's a +greeting message that takes a name:

+
const i18n = new I18n({
en: { greetings: "Hi, %{name}!" },
"pt-BR": { greetings: "Olá, %{name}!" },
});

i18n.t("greetings", { name: "John" }); +
+

If the translation is an array and the entry is a string, values will be +interpolated in a shallow way.

+
const i18n = new I18n({
en: { messages: ["Hello there!", "Welcome back, %{name}!"] },
});

i18n.t("messages", { name: "John" });
//=> ["Hello there!", "Welcome back, John!"] +
+

You may want to override the default +interpolate +function with your own, if for instance you want these dynamic values to be +React elements:

+
const i18n = new I18n({
en: { greetings: "Hi, %{name}!" },
"pt-BR": { greetings: "Olá, %{name}!" },
});

i18n.interpolate = (i18n, message, options) => {
// ...
};

return <Text>{i18n.t("greetings", { name: <BoldText>John</BoldText> })}</Text>; +
+

Missing translations

+

A translation may be missing. In that case, you may set the default value that's +going to be returned.

+
i18n.t("missing.scope", { defaultValue: "This is a default message" });
+
+

Default messages can also have interpolation.

+
i18n.t("noun", { defaultValue: "I'm a {{noun}}", noun: "Mac" });
+
+

Alternatively, you can define a list of scopes that will be searched instead.

+
// As a scope
i18n.t("some.missing.scope", { defaults: [{ scope: "some.existing.scope" }] });

// As a simple translation
i18n.t("some.missing.scope", { defaults: [{ message: "Some message" }] }); +
+

Default values must be provided as an array of objects where the key is the type +of desired translation, a scope or a message. The returned translation will +be either the first scope recognized, or the first message defined.

+

The translation will fall back to the defaultValue translation if no scope in +defaults matches and if no message default is found.

+

You can enable translation fallback with I18n#enableFallback.

+
i18n.enableFallback = true;
+
+

By default missing translations will first be looked for in less specific +versions of the requested locale and if that fails by taking them from your +I18n#defaultLocale.

+
// if i18n.defaultLocale = "en" and translation doesn't exist
// for i18n.locale = "de-DE" this key will be taken from "de" locale scope
// or, if that also doesn't exist, from "en" locale scope
i18n.t("some.missing.scope"); +
+

Custom fallback rules can also be specified for a specific language. There are +three different ways of doing it so. In any case, the locale handler must be +registered using i18n.locales.register().

+
// Using an array
i18n.locales.register("no", ["nb", "en"]);

// Using a string
i18n.locales.no.register("nb");

// Using a function.
i18n.locales.no.register((locale) => ["nb"]); +
+

By default a missing translation will be displayed as +[missing "name of scope" translation]. You can override this behavior by +setting i18n.missingBehavior to "guess".

+
i18n.missingBehavior = "guess";
+
+

The "guess" behavior will take the last section of the scope and apply some +replace rules; camel case becomes lower case and underscores are replaced with +space. In practice, it means that a scope like +questionnaire.whatIsYourFavorite_ChristmasPresent becomes +what is your favorite Christmas present.

+

There's also a strategy called error, which will throw an exception every time +you fetch a missing translation. This is great for development. It'll even end +up on your error tracking!

+
i18n.missingBehavior = "error";
+
+

To detect missing translations, you can also set +i18n.missingTranslationPrefix.

+
i18n.missingTranslationPrefix = "EE: ";
+
+

The same questionnaire.whatIsYourFavorite_ChristmasPresent scope would +converted into EE: what is your favorite Christmas present. This is helpful if +you want to add a check to your automated tests.

+

If you need to specify a missing behavior just for one call, you can provide a +custom missingBehavior option.

+
i18n.t("missing.key", { missingBehavior: "error" });
+
+

You can completely override the missing translation strategy by setting it to a +function. The following example will return null for every missing +translation.

+
i18n.missingTranslation = () => null;
+
+

Finally, you can also create your own missing translation behavior. The example +below registers a new behavior that returns an empty string in case a +translation is missing.

+
i18n.missingTranslation.register("empty", (i18n, scope, options) => "");
+
+

Pluralization

+

This library has support for pluralization and by default works with English, +and similar pluralized languages like Portuguese.

+

First, you have to define your translations with special keywords defined by the +pluralization handler. The default keywords are zero, one, and other.

+
const i18n = new I18n({
en: {
inbox: {
zero: "You have no messages",
one: "You have one message",
other: "You have %{count} messages",
},
},

"pt-BR": {
inbox: {
zero: "Você não tem mensagens",
one: "Você tem uma mensagem",
other: "Você tem %{count} mensagens",
},
},
}); +
+

To retrieve the pluralized translation you must provide the count option with +a numeric value.

+
i18n.t("inbox", { count: 0 }); //=> You have no messages
i18n.t("inbox", { count: 1 }); //=> You have one message
i18n.t("inbox", { count: 2 }); //=> You have 2 messages +
+

You may need to define new rules for other languages like Russian. This can be +done by registering a handler with i18n.pluralization.register(). The +following example defines a Russian pluralizer.

+
i18n.pluralization.register("ru", (_i18n, count) => {
const mod10 = count % 10;
const mod100 = count % 100;
let key;

const one = mod10 === 1 && mod100 !== 11;
const few = [2, 3, 4].includes(mod10) && ![12, 13, 14].includes(mod100);
const many =
mod10 === 0 ||
[5, 6, 7, 8, 9].includes(mod10) ||
[11, 12, 13, 14].includes(mod100);

if (one) {
key = "one";
} else if (few) {
key = "few";
} else if (many) {
key = "many";
} else {
key = "other";
}

return [key];
}); +
+

You can find all rules on +http://www.unicode.org/.

+

You can also leverage make-plural, +rather than writing all your pluralization functions. For this, you must wrap +make-plural's function by using +useMakePlural({ pluralizer, includeZero, ordinal }):

+
import { ru } from "make-plural";
import { useMakePlural } from "i18n-js";

i18n.pluralization.register("ru", useMakePlural({ pluralizer: ru })); +
+

Other options

+

If you're providing the same scope again and again, you can reduce the +boilerplate by setting the scope option.

+
const options = { scope: "activerecord.attributes.user" };

i18n.t("name", options);
i18n.t("email", options);
i18n.t("username", options); +
+

Number Formatting

+

Similar to Rails helpers, you can have localized number and currency formatting.

+
i18n.l("currency", 1990.99);
// $1,990.99

i18n.l("number", 1990.99);
// 1,990.99

i18n.l("percentage", 123.45);
// 123.450% +
+

To have more control over number formatting, you can use the +I18n#numberToHuman, I18n#numberToPercentage, I18n#numberToCurrency, +I18n#numberToHumanSize, I18n#numberToDelimited and I18n#numberToRounded +functions.

+

I18n#numberToCurrency

+

Formats a number into a currency string (e.g., $13.65). You can customize the +format in the using an options object.

+

The currency unit and number formatting of the current locale will be used +unless otherwise specified in the provided options. No currency conversion is +performed. If the user is given a way to change their locale, they will also be +able to change the relative value of the currency displayed with this helper.

+
Options
+
    +
  • +precision - Sets the level of precision (defaults to 2).
  • +
  • +roundMode - Determine how rounding is performed (defaults to default.)
  • +
  • +unit - Sets the denomination of the currency (defaults to "$").
  • +
  • +separator - Sets the separator between the units (defaults to ".").
  • +
  • +delimiter - Sets the thousands delimiter (defaults to ",").
  • +
  • +format - Sets the format for non-negative numbers (defaults to "%u%n"). +Fields are %u for the currency, and %n for the number.
  • +
  • +negativeFormat - Sets the format for negative numbers (defaults to +prepending a hyphen to the formatted number given by format). Accepts the +same fields than format, except %n is here the absolute value of the +number.
  • +
  • +stripInsignificantZeros - If true removes insignificant zeros after the +decimal separator (defaults to false).
  • +
  • +raise - If true, raises exception for non-numeric values like NaN and +Infinite values.
  • +
+
Examples
+
i18n.numberToCurrency(1234567890.5);
// => "$1,234,567,890.50"

i18n.numberToCurrency(1234567890.506);
// => "$1,234,567,890.51"

i18n.numberToCurrency(1234567890.506, { precision: 3 });
// => "$1,234,567,890.506"

i18n.numberToCurrency("123a456");
// => "$123a456"

i18n.numberToCurrency("123a456", { raise: true });
// => raises exception ("123a456" is not a valid numeric value)

i18n.numberToCurrency(-0.456789, { precision: 0 });
// => "$0"

i18n.numberToCurrency(-1234567890.5, { negativeFormat: "(%u%n)" });
// => "($1,234,567,890.50)"

i18n.numberToCurrency(1234567890.5, {
unit: "&pound;",
separator: ",",
delimiter: "",
});
// => "&pound;1234567890,50"

i18n.numberToCurrency(1234567890.5, {
unit: "&pound;",
separator: ",",
delimiter: "",
format: "%n %u",
});
// => "1234567890,50 &pound;"

i18n.numberToCurrency(1234567890.5, { stripInsignificantZeros: true });
// => "$1,234,567,890.5"

i18n.numberToCurrency(1234567890.5, { precision: 0, roundMode: "up" });
// => "$1,234,567,891" +
+

I18n#numberToPercentage

+

Formats a number as a percentage string (e.g., 65%). You can customize the +format in the options hash.

+
Options
+
    +
  • +precision - Sets the level of precision (defaults to 3).
  • +
  • +roundMode - Determine how rounding is performed (defaults to default.)
  • +
  • +separator - Sets the separator between the units (defaults to ".").
  • +
  • +delimiter - Sets the thousands delimiter (defaults to "").
  • +
  • +format - Sets the format for non-negative numbers (defaults to "%n%"). The +number field is represented by %n.
  • +
  • +negativeFormat - Sets the format for negative numbers (defaults to +prepending a hyphen to the formatted number given by format). Accepts the +same fields than format, except %n is here the absolute value of the +number.
  • +
  • +stripInsignificantZeros - If true removes insignificant zeros after the +decimal separator (defaults to false).
  • +
+
Examples
+
i18n.numberToPercentage(100);
// => "100.000%"

i18n.numberToPercentage("98");
// => "98.000%"

i18n.numberToPercentage(100, { precision: 0 });
// => "100%"

i18n.numberToPercentage(1000, { delimiter: ".", separator: "," });
// => "1.000,000%"

i18n.numberToPercentage(302.24398923423, { precision: 5 });
// => "302.24399%"

i18n.numberToPercentage(1000, { precision: null });
// => "1000%"

i18n.numberToPercentage("98a");
// => "98a%"

i18n.numberToPercentage(100, { format: "%n %" });
// => "100.000 %"

i18n.numberToPercentage(302.24398923423, { precision: 5, roundMode: "down" });
// => "302.24398%" +
+

I18n#numberToDelimited

+

Formats a number with grouped thousands using delimiter (e.g., 12,324). You +can customize the format in the options object.

+
Options
+
    +
  • +delimiter - Sets the thousands delimiter (defaults to ",").
  • +
  • +separator - Sets the separator between the fractional and integer digits +(defaults to ".").
  • +
  • +delimiterPattern - Sets a custom regular expression used for deriving the +placement of delimiter. Helpful when using currency formats like INR. The +regular expression must be global (i.e. it has the g flag).
  • +
+
Examples
+
i18n.numberToDelimited(12345678);
// => "12,345,678"

i18n.numberToDelimited("123456");
// => "123,456"

i18n.numberToDelimited(12345678.05);
// => "12,345,678.05"

i18n.numberToDelimited(12345678, { delimiter: "." });
// => "12.345.678"

i18n.numberToDelimited(12345678, { delimiter: "," });
// => "12,345,678"

i18n.numberToDelimited(12345678.05, { separator: " " });
// => "12,345,678 05"

i18n.numberToDelimited("112a");
// => "112a"

i18n.numberToDelimited(98765432.98, { delimiter: " ", separator: "," });
// => "98 765 432,98"

i18n.numberToDelimited("123456.78", {
delimiterPattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/g,
});
// => "1,23,456.78" +
+

I18n#numberToRounded

+

Formats a number with the specified level of precision (e.g., 112.32 has a +precision of 2 if significant is false, and 5 if significant is true). +You can customize the format in the options object.

+
Options
+
    +
  • +locale - Sets the locale to be used for formatting (defaults to current +locale).
  • +
  • +precision - Sets the precision of the number (defaults to 3). Keeps the +number's precision if null.
  • +
  • +RoundMode - Determine how rounding is performed (defaults to :default).
  • +
  • +significant - If true, precision will be the number of significant_digits. +If false, the number of fractional digits (defaults to false).
  • +
  • +separator - Sets the separator between the fractional and integer digits +(defaults to ".").
  • +
  • +delimiter - Sets the thousands delimiter (defaults to "").
  • +
  • +stripInsignificantZeros - If true removes insignificant zeros after the +decimal separator (defaults to false).
  • +
+
Examples
+
i18n.numberToRounded(111.2345);
// => "111.235"

i18n.numberToRounded(111.2345, { precision: 2 });
// => "111.23"

i18n.numberToRounded(13, { precision: 5 });
// => "13.00000"

i18n.numberToRounded(389.32314, { precision: 0 });
// => "389"

i18n.numberToRounded(111.2345, { significant: true });
// => "111"

i18n.numberToRounded(111.2345, { precision: 1, significant: true });
// => "100"

i18n.numberToRounded(13, { precision: 5, significant: true });
// => "13.000"

i18n.numberToRounded(13, { precision: null });
// => "13"

i18n.numberToRounded(389.32314, { precision: 0, roundMode: "up" });
// => "390"

i18n.numberToRounded(13, {
precision: 5,
significant: true,
stripInsignificantZeros: true,
});
// => "13"

i18n.numberToRounded(389.32314, { precision: 4, significant: true });
// => "389.3"

i18n.numberToRounded(1111.2345, {
precision: 2,
separator: ",",
delimiter: ".",
});
// => "1.111,23" +
+

I18n#numberToHumanSize

+

Formats the bytes in number into a more understandable representation (e.g., +giving it 1500 yields 1.46 KB). This method is useful for reporting file sizes +to users. You can customize the format in the options object.

+

See I18n#numberToHuman if you want to pretty-print a generic number.

+
Options
+
    +
  • +precision - Sets the precision of the number (defaults to 3).
  • +
  • +roundMode - Determine how rounding is performed (defaults to default)
  • +
  • +significant - If true, precision will be the number of significant_digits. +If false, the number of fractional digits (defaults to true)
  • +
  • +separator - Sets the separator between the fractional and integer digits +(defaults to ".").
  • +
  • +delimiter - Sets the thousands delimiter (defaults to "").
  • +
  • +stripInsignificantZeros - If true removes insignificant zeros after the +decimal separator (defaults to true)
  • +
+
Examples
+
i18n.numberToHumanSize(123)
// => "123 Bytes"

i18n.numberToHumanSize(1234)
// => "1.21 KB"

i18n.numberToHumanSize(12345)
// => "12.1 KB"

i18n.numberToHumanSize(1234567)
// => "1.18 MB"

i18n.numberToHumanSize(1234567890)
// => "1.15 GB"

i18n.numberToHumanSize(1234567890123)
// => "1.12 TB"

i18n.numberToHumanSize(1234567890123456)
// => "1.1 PB"

i18n.numberToHumanSize(1234567890123456789)
// => "1.07 EB"

i18n.numberToHumanSize(1234567, {precision: 2})
// => "1.2 MB"

i18n.numberToHumanSize(483989, precision: 2)
// => "470 KB"

i18n.numberToHumanSize(483989, {precision: 2, roundMode: "up"})
// => "480 KB"

i18n.numberToHumanSize(1234567, {precision: 2, separator: ","})
// => "1,2 MB"

i18n.numberToHumanSize(1234567890123, {precision: 5})
// => "1.1228 TB"

i18n.numberToHumanSize(524288000, {precision: 5})
// => "500 MB" +
+

I18n#numberToHuman

+

Pretty prints (formats and approximates) a number in a way it is more readable +by humans (e.g.: 1200000000 becomes "1.2 Billion"). This is useful for numbers +that can get very large (and too hard to read).

+

See I18n#numberToHumanSize if you want to print a file size.

+

You can also define your own unit-quantifier names if you want to use other +decimal units (e.g.: 1500 becomes "1.5 kilometers", 0.150 becomes "150 +milliliters", etc). You may define a wide range of unit quantifiers, even +fractional ones (centi, deci, mili, etc).

+
Options
+
    +
  • +precision - Sets the precision of the number (defaults to 3).
  • +
  • +roundMode - Determine how rounding is performed (defaults to default).
  • +
  • +significant - If true, precision will be the number of significant_digits. +If false, the number of fractional digits (defaults to true)
  • +
  • +separator - Sets the separator between the fractional and integer digits +(defaults to ".").
  • +
  • +delimiter - Sets the thousands delimiter (defaults to "").
  • +
  • +stripInsignificantZeros - If true removes insignificant zeros after the +decimal separator (defaults to true)
  • +
  • +units - A Hash of unit quantifier names. Or a string containing an i18n +scope where to find this hash. It might have the following keys:
      +
    • +integers: unit, ten, hundred, thousand, million, billion, +trillion, quadrillion +
    • +
    • +fractionals: deci, centi, mili, micro, nano, pico, femto +
    • +
    +
  • +
  • +format - Sets the format of the output string (defaults to "%n %u"). The +field types are:
      +
    • %u - The quantifier (ex.: 'thousand')
    • +
    • %n - The number
    • +
    +
  • +
+
Examples
+
i18n.numberToHuman(123);
// => "123"

i18n.numberToHuman(1234);
// => "1.23 Thousand"

i18n.numberToHuman(12345);
// => "12.3 Thousand"

i18n.numberToHuman(1234567);
// => "1.23 Million"

i18n.numberToHuman(1234567890);
// => "1.23 Billion"

i18n.numberToHuman(1234567890123);
// => "1.23 Trillion"

i18n.numberToHuman(1234567890123456);
// => "1.23 Quadrillion"

i18n.numberToHuman(1234567890123456789);
// => "1230 Quadrillion"

i18n.numberToHuman(489939, { precision: 2 });
// => "490 Thousand"

i18n.numberToHuman(489939, { precision: 4 });
// => "489.9 Thousand"

i18n.numberToHuman(489939, { precision: 2, roundMode: "down" });
// => "480 Thousand"

i18n.numberToHuman(1234567, { precision: 4, significant: false });
// => "1.2346 Million"

i18n.numberToHuman(1234567, {
precision: 1,
separator: ",",
significant: false,
});
// => "1,2 Million"

i18n.numberToHuman(500000000, { precision: 5 });
// => "500 Million"

i18n.numberToHuman(12345012345, { significant: false });
// => "12.345 Billion" +
+

Non-significant zeros after the decimal separator are stripped out by default +(set stripInsignificantZeros to false to change that):

+
i18n.numberToHuman(12.00001);
// => "12"

i18n.numberToHuman(12.00001, { stripInsignificantZeros: false });
// => "12.0" +
+

You can also use your own custom unit quantifiers:

+
i18n.numberToHuman(500000, units: { unit: "ml", thousand: "lt" })
// => "500 lt" +
+

If in your I18n locale you have:

+
---
en:
distance:
centi:
one: "centimeter"
other: "centimeters"
unit:
one: "meter"
other: "meters"
thousand:
one: "kilometer"
other: "kilometers"
billion: "gazillion-distance" +
+

Then you could do:

+
i18n.numberToHuman(543934, { units: "distance" });
// => "544 kilometers"

i18n.numberToHuman(54393498, { units: "distance" });
// => "54400 kilometers"

i18n.numberToHuman(54393498000, { units: "distance" });
// => "54.4 gazillion-distance"

i18n.numberToHuman(343, { units: "distance", precision: 1 });
// => "300 meters"

i18n.numberToHuman(1, { units: "distance" });
// => "1 meter"

i18n.numberToHuman(0.34, { units: "distance" });
// => "34 centimeters" +
+

Date Formatting

+

The I18n#localize (or its alias I18n#l) can accept a string, epoch time +integer or a Date object. You can see below the accepted formats:

+
// yyyy-mm-dd
i18n.l("date.formats.short", "2009-09-18");

// yyyy-mm-dd hh:mm:ss
i18n.l("time.formats.short", "2009-09-18 23:12:43");

// JSON format with local Timezone (part of ISO-8601)
i18n.l("time.formats.short", "2009-11-09T18:10:34");

// JSON format in UTC (part of ISO-8601)
i18n.l("time.formats.short", "2009-11-09T18:10:34Z");

// Epoch time
i18n.l("date.formats.short", 1251862029000);

// mm/dd/yyyy
i18n.l("date.formats.short", "09/18/2009");

// Date object
i18n.l("date.formats.short", new Date()); +
+

You can also add placeholders to the date format:

+
const i18n = new I18n({
date: {
formats: {
ordinalDay: "%B %{day}",
},
},
});

i18n.l("date.formats.ordinalDay", "2009-09-18", { day: "18th" }); // Sep 18th +
+

If you prefer, you can use the I18n#toTime and I18n#strftime functions +directly to format dates.

+
var date = new Date();
i18n.toTime("date.formats.short", "2009-09-18");
i18n.toTime("date.formats.short", date);
i18n.strftime(date, "%d/%m/%Y"); +
+

The accepted formats for i18n.strftime are:

+
%a  - The abbreviated weekday name (Sun)
%A - The full weekday name (Sunday)
%b - The abbreviated month name (Jan)
%B - The full month name (January)
%c - The preferred local date and time representation
%d - Day of the month (01..31)
%-d - Day of the month (1..31)
%H - Hour of the day, 24-hour clock (00..23)
%-H - Hour of the day, 24-hour clock (0..23)
%k - Hour of the day, 24-hour clock (0..23)
%I - Hour of the day, 12-hour clock (01..12)
%-I - Hour of the day, 12-hour clock (1..12)
%l - Hour of the day, 12-hour clock (1..12)
%m - Month of the year (01..12)
%-m - Month of the year (1..12)
%M - Minute of the hour (00..59)
%-M - Minute of the hour (0..59)
%p - Meridian indicator (AM or PM)
%P - Meridian indicator (am or pm)
%S - Second of the minute (00..60)
%-S - Second of the minute (0..60)
%w - Day of the week (Sunday is 0, 0..6)
%y - Year without a century (00..99)
%-y - Year without a century (0..99)
%Y - Year with century
%z - Timezone offset (+0545)
%Z - Timezone offset (+0545) +
+

Check out +__tests__/strftime.test.ts +file for more examples!

+

Finally, you can also diplay relative time strings using I18n#timeAgoInWords.

+
const to = new Date();
const from = to.getTime() - 60 * 60 * 1000; // ~1h ago.

i18n.timeAgoInWords(from, to);
//=> about 1 hour +
+

Using pluralization and number formatting together

+

Sometimes you might want to display translation with formatted number, like +adding thousand delimiters to displayed number You can do this:

+
const i18n = new I18n({
en: {
points: {
one: "1 Point",
other: "{{points}} Points",
},
},
});

const points = 1234;

i18n.t("points", {
count: points,
points: i18n.formatNumber(points),
}); +
+

Output should be 1,234 points.

+

Other helpers

+

I18n#toSentence(list, options)

+
i18n.toSentence(["apple", "banana", "pineapple"]);
//=> apple, banana, and pineapple. +
+

Troubleshooting

+

I'm getting an error like Unable to resolve "make-plural" from "node modules/i18n-js/dist/import/Pluralization.js"

+

make-plural uses .mjs files. You +need to change your build pipeline to also consider these files.

+

If you're using react-native, you need to change your +metro config to consider .mjs. Try doing something like this (you may need to +adapt your code based on existing changes).

+
const { getDefaultConfig } = require("metro-config");

module.exports = (async () => {
const {
resolver: { assetExts, sourceExts },
} = await getDefaultConfig();

return {
resolver: {
sourceExts: [...sourceExts, "mjs"],
},
};
})(); +
+

I'm getting an error like SyntaxError: Unexpected end of JSON input or Uncaught SyntaxError: Unexpected token ;

+

You may get such error if you're trying to load empty JSON files with +import data from "file.json". This has nothing to do with I18n and is related +to how your JSON file is loaded. JSON files must contain valid JSON data.

+

Similarly, make sure you're writing valid JSON, and not JavaScript. For +instance, if you write something like {};, you'll get an error like +Uncaught SyntaxError: Unexpected token ;.

+

My JSON contains a flat structure. How can I load and use it with I18n.js?

+

I18n.js expects a nested object to represent the translation tree. For this +reason, you cannot use an object like the following by default:

+
{
"en.messages.hello": "hello",
"pt-BR.messages.hello": "olá"
} +
+

One solution is using something like the following to transform your flat into a +nested object:

+
const { set } = require("lodash");

const from = {
"en.messages.hello": "hello",
"pt-BR.messages.hello": "olá",
};

function flatToNestedObject(target) {
const nested = {};

Object.keys(target).forEach((path) => set(nested, path, target[path]));

return nested;
}

console.log(flatToNestedObject(from));
// {
// en: { messages: { hello: 'hello' } },
// 'pt-BR': { messages: { hello: 'olá' } }
// } +
+

You can also use something like flat to +perform the same transformation.

+

+I'm using esbuild and bundling doesn't work

+

When using esbuild, you may get the error +Import "I18n" will always be undefined because the file "node_modules/i18n-js/dist/browser/index.js" has no exports [import-is-undefined]. +That happens because esbuild is resolving i18n to the exports.browser entry. +To fix that, you can run esbuild with --platform=neutral and +--main-fields=import,require,module,main,browser, overriding the default +definition.

+

Here's a command example:

+
esbuild app/assets/scripts/*.* \
--bundle \
--sourcemap \
--main-fields=import,require,module,main,browser \
--platform=neutral \
--metafile=app/assets/builds/meta.json \
--format=esm \
--outdir=app/assets/builds \
--public-path=/assets +
+

+I'm using webpack and bundling doesn't work

+

When using webpack, you may need to set resolve.conditionNames. This is an +example:

+
/**
* @type {import('webpack').Configuration}
*/
module.exports = {
entry: "./index.js",
mode: "production",
target: "web",
resolve: {
conditionNames: ["import", "require", "module", "main"],
},
output: {
filename: "output.js",
path: __dirname,
},
}; +
+

Maintainer

+ +

Contributors

+ +

Contributing

+

For more details about how to contribute, please read +https://github.com/fnando/i18n/blob/main/CONTRIBUTING.md.

+

License

+

The gem is available as open source under the terms of the +MIT License. A copy of the license can be +found at https://github.com/fnando/i18n/blob/main/LICENSE.md.

+

Code of Conduct

+

Everyone interacting in the i18n project's codebases, issue trackers, chat rooms +and mailing lists is expected to follow the +code of conduct.

+
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/interfaces/Dict.html b/docs/v4.4.3/interfaces/Dict.html new file mode 100644 index 0000000..6874b4d --- /dev/null +++ b/docs/v4.4.3/interfaces/Dict.html @@ -0,0 +1,78 @@ + + + + + + +Dict | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/interfaces/FormatNumberOptions.html b/docs/v4.4.3/interfaces/FormatNumberOptions.html new file mode 100644 index 0000000..71486a0 --- /dev/null +++ b/docs/v4.4.3/interfaces/FormatNumberOptions.html @@ -0,0 +1,174 @@ + + + + + + +FormatNumberOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Interface FormatNumberOptions

+
+
+interface FormatNumberOptions {
    delimiter: string;
    format: string;
    negativeFormat: string;
    precision: null | number;
    raise: boolean;
    roundMode: RoundingMode;
    separator: string;
    significant: boolean;
    stripInsignificantZeros: boolean;
    unit: string;
} +
+

Properties

+
+
+delimiter: string +
+
+
+format: string +
+
+
+negativeFormat: string +
+
+
+precision: null | number +
+
+
+raise: boolean +
+
+
+roundMode: RoundingMode +
+
+
+separator: string +
+
+
+significant: boolean +
+
+
+stripInsignificantZeros: boolean +
+
+
+unit: string +
+
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/interfaces/I18nOptions.html b/docs/v4.4.3/interfaces/I18nOptions.html new file mode 100644 index 0000000..5da7ef6 --- /dev/null +++ b/docs/v4.4.3/interfaces/I18nOptions.html @@ -0,0 +1,272 @@ + + + + + + +I18nOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Interface I18nOptions

+
+
+interface I18nOptions {
    availableLocales: string[];
    defaultLocale: string;
    defaultSeparator: string;
    enableFallback: boolean;
    locale: string;
    missingBehavior: MissingBehavior;
    missingPlaceholder: MissingPlaceholderHandler;
    missingTranslationPrefix: string;
    nullPlaceholder: NullPlaceholderHandler;
    placeholder: RegExp;
    transformKey: ((key) => string);
} +
+

Properties

+
+
+availableLocales: string[] +
+
+

Set available locales. This will be used to load pluralizers automatically.

+
+
+
+
+defaultLocale: string +
+
+

Set default locale. This locale will be used when fallback is enabled and +the translation doesn't exist in a particular locale. Defaults to en.

+
+
+
+
+defaultSeparator: string +
+
+

Set the default string separator. Defaults to ., as in +scope.translation.

+
+
+
+
+enableFallback: boolean +
+
+

Set if engine should fallback to the default locale when a translation is +missing. Defaults to false.

+

When enabled, missing translations will first be looked for in less +specific versions of the requested locale and if that fails by taking them +from your I18n#defaultLocale.

+
+
+
+
+locale: string +
+
+

Set the current locale. Defaults to en.

+
+
+
+
+missingBehavior: MissingBehavior +
+
+

Set missing translation behavior.

+
    +
  • +message will display a message that the translation is missing.
  • +
  • +guess will try to guess the string.
  • +
  • +error will raise an exception whenever a translation is not defined.
  • +
+

See MissingTranslation.register for instructions on how to define +your own behavior.

+
+
+
+
+missingPlaceholder: MissingPlaceholderHandler +
+
+

Return a missing placeholder message for given parameters.

+
+
+
+
+missingTranslationPrefix: string +
+
+

If you use missingBehavior with 'message', but want to know that the string +is actually missing for testing purposes, you can prefix the guessed string +by setting the value here. By default, no prefix is used.

+
+
+
+
+nullPlaceholder: NullPlaceholderHandler +
+
+

Return a placeholder message for null values. Defaults to the same behavior +as I18n.missingPlaceholder.

+
+
+
+
+placeholder: RegExp +
+
+

Set the placeholder format. Accepts {{placeholder}} and %{placeholder}.

+
+
+
+
+transformKey: ((key) => string) +
+
+

Transform keys. By default, it returns the key as it is, but allows for +overriding. For instance, you can set a function to receive the camelcase +key, and convert it to snake case.

+
+
+

Type declaration

+
    • +
    • +(key): string +
    • +
    • +
      +

      Transform keys. By default, it returns the key as it is, but allows for +overriding. For instance, you can set a function to receive the camelcase +key, and convert it to snake case.

      +
      +
      +

      Parameters

      +
      • +key: string +
      +
      +

      Returns string +

      +
      +
    • +
+
+
+
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/interfaces/ObjectType.html b/docs/v4.4.3/interfaces/ObjectType.html new file mode 100644 index 0000000..a966cb4 --- /dev/null +++ b/docs/v4.4.3/interfaces/ObjectType.html @@ -0,0 +1,78 @@ + + + + + + +ObjectType | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/interfaces/StrftimeOptions.html b/docs/v4.4.3/interfaces/StrftimeOptions.html new file mode 100644 index 0000000..68fc816 --- /dev/null +++ b/docs/v4.4.3/interfaces/StrftimeOptions.html @@ -0,0 +1,140 @@ + + + + + + +StrftimeOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Interface StrftimeOptions

+
+
+interface StrftimeOptions {
    abbrDayNames: DayNames;
    abbrMonthNames: MonthNames;
    dayNames: DayNames;
    meridian: {
        am: string;
        pm: string;
    };
    monthNames: MonthNames;
} +
+

Properties

+
+
+abbrDayNames: DayNames +
+
+
+abbrMonthNames: MonthNames +
+
+
+dayNames: DayNames +
+
+
+meridian: {
    am: string;
    pm: string;
} +
+
+

Type declaration

+
    +
  • +am: string +
  • +
  • +pm: string +
  • +
+
+
+
+monthNames: MonthNames +
+
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/interfaces/TimeAgoInWordsOptions.html b/docs/v4.4.3/interfaces/TimeAgoInWordsOptions.html new file mode 100644 index 0000000..a64c7c9 --- /dev/null +++ b/docs/v4.4.3/interfaces/TimeAgoInWordsOptions.html @@ -0,0 +1,102 @@ + + + + + + +TimeAgoInWordsOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Interface TimeAgoInWordsOptions

+
+
+interface TimeAgoInWordsOptions {
    includeSeconds?: boolean;
    scope?: Scope;
} +
+

Properties

+

Properties

+
+
+includeSeconds?: boolean +
+
+
+scope?: Scope +
+
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/interfaces/ToSentenceOptions.html b/docs/v4.4.3/interfaces/ToSentenceOptions.html new file mode 100644 index 0000000..6f41d88 --- /dev/null +++ b/docs/v4.4.3/interfaces/ToSentenceOptions.html @@ -0,0 +1,111 @@ + + + + + + +ToSentenceOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Interface ToSentenceOptions

+
+
+interface ToSentenceOptions {
    lastWordConnector: string;
    twoWordsConnector: string;
    wordsConnector: string;
} +
+

Properties

+
+
+lastWordConnector: string +
+
+
+twoWordsConnector: string +
+
+
+wordsConnector: string +
+
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/interfaces/TranslateOptions.html b/docs/v4.4.3/interfaces/TranslateOptions.html new file mode 100644 index 0000000..bc05f40 --- /dev/null +++ b/docs/v4.4.3/interfaces/TranslateOptions.html @@ -0,0 +1,132 @@ + + + + + + +TranslateOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Interface TranslateOptions

+
+
+interface TranslateOptions {
    count?: number;
    defaultValue?: any;
    defaults?: Dict[];
    missingBehavior?: string;
    scope?: Scope;
    [key: string]: any;
} +
+

Indexable

+
+[key: string]: any +

Properties

+
+
+count?: number +
+
+
+defaultValue?: any +
+
+
+defaults?: Dict[] +
+
+
+missingBehavior?: string +
+
+
+scope?: Scope +
+
+
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/modules.html b/docs/v4.4.3/modules.html new file mode 100644 index 0000000..d70e862 --- /dev/null +++ b/docs/v4.4.3/modules.html @@ -0,0 +1,111 @@ + + + + + + +i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/AnyObject.html b/docs/v4.4.3/types/AnyObject.html new file mode 100644 index 0000000..f73ef0a --- /dev/null +++ b/docs/v4.4.3/types/AnyObject.html @@ -0,0 +1,75 @@ + + + + + + +AnyObject | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/ArrayType.html b/docs/v4.4.3/types/ArrayType.html new file mode 100644 index 0000000..6463aca --- /dev/null +++ b/docs/v4.4.3/types/ArrayType.html @@ -0,0 +1,75 @@ + + + + + + +ArrayType | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/DateTime.html b/docs/v4.4.3/types/DateTime.html new file mode 100644 index 0000000..70862a5 --- /dev/null +++ b/docs/v4.4.3/types/DateTime.html @@ -0,0 +1,75 @@ + + + + + + +DateTime | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/DayNames.html b/docs/v4.4.3/types/DayNames.html new file mode 100644 index 0000000..c4c670b --- /dev/null +++ b/docs/v4.4.3/types/DayNames.html @@ -0,0 +1,75 @@ + + + + + + +DayNames | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/LocaleResolver.html b/docs/v4.4.3/types/LocaleResolver.html new file mode 100644 index 0000000..0e01255 --- /dev/null +++ b/docs/v4.4.3/types/LocaleResolver.html @@ -0,0 +1,98 @@ + + + + + + +LocaleResolver | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias LocaleResolver

+
+
+LocaleResolver: ((i18n, locale) => string[]) +
+
+

Type declaration

+
    • +
    • +(i18n, locale): string[] +
    • +
    • +
      +

      Parameters

      +
        +
      • +i18n: I18n +
      • +
      • +locale: string +
      • +
      +
      +

      Returns string[] +

      +
    • +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/MakePlural.html b/docs/v4.4.3/types/MakePlural.html new file mode 100644 index 0000000..327375b --- /dev/null +++ b/docs/v4.4.3/types/MakePlural.html @@ -0,0 +1,98 @@ + + + + + + +MakePlural | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias MakePlural

+
+
+MakePlural: ((count, ordinal?) => string) +
+
+

Type declaration

+
    • +
    • +(count, ordinal?): string +
    • +
    • +
      +

      Parameters

      +
        +
      • +count: number +
      • +
      • +Optional ordinal: boolean +
      • +
      +
      +

      Returns string +

      +
    • +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/MissingBehavior.html b/docs/v4.4.3/types/MissingBehavior.html new file mode 100644 index 0000000..d966783 --- /dev/null +++ b/docs/v4.4.3/types/MissingBehavior.html @@ -0,0 +1,79 @@ + + + + + + +MissingBehavior | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/MissingPlaceholderHandler.html b/docs/v4.4.3/types/MissingPlaceholderHandler.html new file mode 100644 index 0000000..aaf4d63 --- /dev/null +++ b/docs/v4.4.3/types/MissingPlaceholderHandler.html @@ -0,0 +1,104 @@ + + + + + + +MissingPlaceholderHandler | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias MissingPlaceholderHandler

+
+
+MissingPlaceholderHandler: ((i18n, placeholder, message, options) => string) +
+
+

Type declaration

+
    • +
    • +(i18n, placeholder, message, options): string +
    • +
    • +
      +

      Parameters

      +
        +
      • +i18n: I18n +
      • +
      • +placeholder: string +
      • +
      • +message: string +
      • +
      • +options: Dict +
      • +
      +
      +

      Returns string +

      +
    • +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/MissingTranslationStrategy.html b/docs/v4.4.3/types/MissingTranslationStrategy.html new file mode 100644 index 0000000..946f72e --- /dev/null +++ b/docs/v4.4.3/types/MissingTranslationStrategy.html @@ -0,0 +1,101 @@ + + + + + + +MissingTranslationStrategy | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias MissingTranslationStrategy

+
+
+MissingTranslationStrategy: ((i18n, scope, options) => string) +
+
+

Type declaration

+
    • +
    • +(i18n, scope, options): string +
    • +
    • +
      +

      Parameters

      + +
      +

      Returns string +

      +
    • +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/MonthNames.html b/docs/v4.4.3/types/MonthNames.html new file mode 100644 index 0000000..0765690 --- /dev/null +++ b/docs/v4.4.3/types/MonthNames.html @@ -0,0 +1,75 @@ + + + + + + +MonthNames | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias MonthNames

+
+
+MonthNames: [null, string, string, string, string, string, string, string, string, string, string, string, string] +
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/NullPlaceholderHandler.html b/docs/v4.4.3/types/NullPlaceholderHandler.html new file mode 100644 index 0000000..dee5967 --- /dev/null +++ b/docs/v4.4.3/types/NullPlaceholderHandler.html @@ -0,0 +1,104 @@ + + + + + + +NullPlaceholderHandler | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias NullPlaceholderHandler

+
+
+NullPlaceholderHandler: ((i18n, placeholder, message, options) => string) +
+
+

Type declaration

+
    • +
    • +(i18n, placeholder, message, options): string +
    • +
    • +
      +

      Parameters

      +
        +
      • +i18n: I18n +
      • +
      • +placeholder: string +
      • +
      • +message: string +
      • +
      • +options: Dict +
      • +
      +
      +

      Returns string +

      +
    • +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/NumberToCurrencyOptions.html b/docs/v4.4.3/types/NumberToCurrencyOptions.html new file mode 100644 index 0000000..baf12f5 --- /dev/null +++ b/docs/v4.4.3/types/NumberToCurrencyOptions.html @@ -0,0 +1,75 @@ + + + + + + +NumberToCurrencyOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/NumberToDelimitedOptions.html b/docs/v4.4.3/types/NumberToDelimitedOptions.html new file mode 100644 index 0000000..992d13d --- /dev/null +++ b/docs/v4.4.3/types/NumberToDelimitedOptions.html @@ -0,0 +1,89 @@ + + + + + + +NumberToDelimitedOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias NumberToDelimitedOptions

+
+
+NumberToDelimitedOptions: {
    delimiter: string;
    delimiterPattern: RegExp;
    separator: string;
} +
+
+

Type declaration

+
    +
  • +delimiter: string +
  • +
  • +delimiterPattern: RegExp +
  • +
  • +separator: string +
  • +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/NumberToHumanOptions.html b/docs/v4.4.3/types/NumberToHumanOptions.html new file mode 100644 index 0000000..da9259f --- /dev/null +++ b/docs/v4.4.3/types/NumberToHumanOptions.html @@ -0,0 +1,81 @@ + + + + + + +NumberToHumanOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias NumberToHumanOptions

+
+
+NumberToHumanOptions: Omit<FormatNumberOptions, "negativeFormat" | "unit" | "raise"> & {
    units: NumberToHumanUnits | string;
} +
+
+

Type declaration

+ +
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/NumberToHumanSizeOptions.html b/docs/v4.4.3/types/NumberToHumanSizeOptions.html new file mode 100644 index 0000000..f8ca6cc --- /dev/null +++ b/docs/v4.4.3/types/NumberToHumanSizeOptions.html @@ -0,0 +1,75 @@ + + + + + + +NumberToHumanSizeOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/NumberToHumanUnits.html b/docs/v4.4.3/types/NumberToHumanUnits.html new file mode 100644 index 0000000..489d5c6 --- /dev/null +++ b/docs/v4.4.3/types/NumberToHumanUnits.html @@ -0,0 +1,81 @@ + + + + + + +NumberToHumanUnits | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias NumberToHumanUnits

+
+
+NumberToHumanUnits: {
    [key: string]: string;
} +
+
+

Type declaration

+
  • +[key: string]: string +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/NumberToPercentageOptions.html b/docs/v4.4.3/types/NumberToPercentageOptions.html new file mode 100644 index 0000000..ebe2853 --- /dev/null +++ b/docs/v4.4.3/types/NumberToPercentageOptions.html @@ -0,0 +1,75 @@ + + + + + + +NumberToPercentageOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/NumberToRoundedOptions.html b/docs/v4.4.3/types/NumberToRoundedOptions.html new file mode 100644 index 0000000..7f1ee3d --- /dev/null +++ b/docs/v4.4.3/types/NumberToRoundedOptions.html @@ -0,0 +1,81 @@ + + + + + + +NumberToRoundedOptions | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias NumberToRoundedOptions

+
+
+NumberToRoundedOptions: Omit<FormatNumberOptions, "format" | "negativeFormat" | "raise"> & {
    precision: number;
} +
+
+

Type declaration

+
  • +precision: number +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/Numeric.html b/docs/v4.4.3/types/Numeric.html new file mode 100644 index 0000000..d28949c --- /dev/null +++ b/docs/v4.4.3/types/Numeric.html @@ -0,0 +1,75 @@ + + + + + + +Numeric | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/OnChangeHandler.html b/docs/v4.4.3/types/OnChangeHandler.html new file mode 100644 index 0000000..26f7ff5 --- /dev/null +++ b/docs/v4.4.3/types/OnChangeHandler.html @@ -0,0 +1,93 @@ + + + + + + +OnChangeHandler | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias OnChangeHandler

+
+
+OnChangeHandler: ((i18n) => void) +
+
+

Type declaration

+
    • +
    • +(i18n): void +
    • +
    • +
      +

      Parameters

      + +
      +

      Returns void +

      +
    • +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/Pluralizer.html b/docs/v4.4.3/types/Pluralizer.html new file mode 100644 index 0000000..79f3017 --- /dev/null +++ b/docs/v4.4.3/types/Pluralizer.html @@ -0,0 +1,98 @@ + + + + + + +Pluralizer | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias Pluralizer

+
+
+Pluralizer: ((i18n, count) => string[]) +
+
+

Type declaration

+
    • +
    • +(i18n, count): string[] +
    • +
    • +
      +

      Parameters

      +
        +
      • +i18n: I18n +
      • +
      • +count: number +
      • +
      +
      +

      Returns string[] +

      +
    • +
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/PrimitiveType.html b/docs/v4.4.3/types/PrimitiveType.html new file mode 100644 index 0000000..73d1306 --- /dev/null +++ b/docs/v4.4.3/types/PrimitiveType.html @@ -0,0 +1,75 @@ + + + + + + +PrimitiveType | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/RoundingMode.html b/docs/v4.4.3/types/RoundingMode.html new file mode 100644 index 0000000..6ec0097 --- /dev/null +++ b/docs/v4.4.3/types/RoundingMode.html @@ -0,0 +1,92 @@ + + + + + + +RoundingMode | i18n-js v4.4.3 + + + + + + + +
+ +
+
+
+
+ +

Type alias RoundingMode

+
+
+RoundingMode: "up" | "down" | "truncate" | "halfUp" | "default" | "halfDown" | "halfEven" | "banker" | "ceiling" | "ceil" | "floor" +
+
+

Controls handling of arithmetic exceptions and rounding.

+
    +
  • "up": round away from zero
  • +
  • "down" or "truncate": round towards zero (truncate)
  • +
  • "halfUp" or "default": round towards the nearest neighbor, unless both +neighbors are equidistant, in which case round away from zero.
  • +
  • "halfDown": round towards the nearest neighbor, unless both neighbors are +equidistant, in which case round towards zero.
  • +
  • "halfEven" or "banker": round towards the nearest neighbor, unless both +neighbors are equidistant, in which case round towards the even neighbor +(Banker’s rounding)
  • +
  • "ceiling" or "ceil": round towards positive infinity
  • +
  • "floor": round towards negative infinity
  • +
+
+
+ +
+ +
+

Generated using TypeDoc

+
+ + + diff --git a/docs/v4.4.3/types/Scope.html b/docs/v4.4.3/types/Scope.html new file mode 100644 index 0000000..82089a0 --- /dev/null +++ b/docs/v4.4.3/types/Scope.html @@ -0,0 +1,75 @@ + + + + + + +Scope | i18n-js v4.4.3 + + + + + + + +
+ +
+
+

Generated using TypeDoc

+
+ + + diff --git a/package.json b/package.json index a92b556..ca25581 100644 --- a/package.json +++ b/package.json @@ -56,5 +56,5 @@ "test:ci": "jest --ci --coverage --verbose" }, "typings": "./typings", - "version": "4.4.2" + "version": "4.4.3" }