Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

message-format

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

message-format - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

40

CHANGELOG.md

@@ -12,13 +12,25 @@ # Changelog

## 1.1.0
* **Bug Fix**
* Fallback to toLocaleString methods when Intl is unavailable
* **Polish**
* Better test error conditions
* **Internal**
* Use [JS Standard Style](https://github.com/feross/standard)
* **Documentation**
* Document fallback behavior
* Include a plug for `format-message`
## 1.0.0
* **Polish**
* Provide `index.js` for platforms that don't read package.json for main.
* Provide `message-format/parser` for access to parser.
* Provide `message-format/printer` for access to printer.
* Provide `index.js` for platforms that don't read package.json for main.
* Provide `message-format/parser` for access to parser.
* Provide `message-format/printer` for access to printer.
* **Documentation**
* Document parser and printer high-level api.
* Document parser and printer high-level api.
* **Internal**
* Refactor error handling in parser.
* Use `lib` folder instead of `dist` for built files.
* Refactor error handling in parser.
* Use `lib` folder instead of `dist` for built files.

@@ -28,12 +40,12 @@ ## 0.1.0

* **New Feature**
* Added support for `selectordinal`.
* Added pretty printer module `message-format/dist/printer`.
* Added browser minified version with global `Intl.MessageFormat` at
`dist/browser.js`.
* Added support for `selectordinal`.
* Added pretty printer module `message-format/dist/printer`.
* Added browser minified version with global `Intl.MessageFormat` at
`dist/browser.js`.
* **Bug Fix**
* Fix bad caching in interpreter.
* Format unsupported rbnf types as `number`.
* Fix bad caching in interpreter.
* Format unsupported rbnf types as `number`.
* **Internal**
* Upgrade from `6to5` to `babel`.
* Use `eslint` and `jscs` for style checking.
* Upgrade from `6to5` to `babel`.
* Use `eslint` and `jscs` for style checking.

@@ -7,6 +7,2 @@ # Contributing

**NOTE:** Please do not send pull requests that fix linting issues. It's
unlikely such issues will stick around long anyway, and eslint currently does
not understand ES6 module syntax.
## Developing

@@ -27,22 +23,4 @@

* **General**
* ES6 syntax, except anything that requires the babel runtime.
* Max of five arguments for functions
* Max depth of four nested blocks
* real tabs
* **Naming**
* CamelCase all class names
* camelBack all variable names
* **Spacing**
* Spaces after all keywords
* Spaces before all left curly braces
* **Comments**
* Use JSDoc-style comments for methods
* Single-line comments for ambiguous code
* **Quotes**
* Always use single quotes
* Only use double quotes when the string contains a single quote
* **Declaration**
* No unused variables
* No pollution of global variables and prototypes
* Use ES 2015 syntax, except anything that requires the babel runtime.
* Follow [JavaScript Standard Style](https://github.com/feross/standard).

@@ -56,2 +34,1 @@ ## Testing

$ npm run lint
module.exports = require('./lib/message-format')

@@ -1,2 +0,7 @@

!function(r){function t(n){if(e[n])return e[n].exports;var a=e[n]={exports:{},id:n,loaded:!1};return r[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var e={};return t.m=r,t.c=e,t.p="/",t(0)}([function(r,t,e){r.exports=e(1)},function(r,t,e){"use strict";(window.Intl||(window.Intl={})).MessageFormat=e(6)},function(r,t,e){"use strict";var n=function(r){return r&&r.__esModule?r["default"]:r},a=n(e(4)),l={locales:{},formats:{cache:{},number:{currency:{style:"currency",currency:"USD"},percent:{style:"percent"}},date:{"short":{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},"long":{month:"long",day:"numeric",year:"numeric"},full:{month:"long",day:"numeric",year:"numeric",weekday:"long"}},time:{"short":{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},"long":{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}}};Object.keys(a).forEach(function(r){var t=a[r],e=t.plural,n=t.ordinal;l.locales[r]={locale:r,plural:e,ordinal:n}}),r.exports=l},function(r){"use strict";var t=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},e=function(){function r(){var e=void 0===arguments[0]?{}:arguments[0],n=e.locale,a=e.data,l=e.formats,i=e.cache;t(this,r),this.originalLocale=n,this.localeData=a,this.formats=l,this.enableCache="boolean"==typeof i?i:!0}return r.prototype.interpret=function(r){return this.interpretSubs(r)},r.prototype.interpretSubs=function(r,t){var e=this;return r=r.map(function(r){return e.interpretElement(r,t)}),1===r.length?r[0]:function(t){for(var e="",n=0,a=r.length;a>n;++n)e+=r[n](t);return e}},r.prototype.interpretElement=function(r,t){if("string"==typeof r)return function(){return r};var e=r[0],n=r[1],a=r[2],l=0,i=void 0;switch("#"===e&&(e=t[0],n="selectordinal"===t[1]?"ordinal":"number",l=t[2],a=null),n){case"number":case"ordinal":case"spellout":case"duration":return this.interpretNumber(e,l,a);case"date":case"time":return this.interpretDateTime(e,n,a);case"plural":case"selectordinal":return l=r[2],i=r[3],this.interpretPlural(e,n,l,i);case"select":return this.interpretSelect(e,a);default:return this.interpretSimple(e)}},r.prototype.interpretNumber=function(r,t){var e=void 0===arguments[2]?"medium":arguments[2];t=t||0;var n=this.originalLocale,a=this.formats,l=a.cache,i=n+":number:"+e,o=void 0;return this.enableCache&&i in l?o=l[i]:(o=new Intl.NumberFormat(n,a.number[e]).format,this.enableCache&&(l[i]=o)),function(e){return o(+e[r]-t)}},r.prototype.interpretDateTime=function(r,t){var e=void 0===arguments[2]?"medium":arguments[2],n=this.originalLocale,a=this.formats,l=a.cache,i=n+":"+t+":"+e,o=void 0;return this.enableCache&&i in l?o=l[i]:(o=new Intl.DateTimeFormat(n,a[t][e]).format,this.enableCache&&(l[i]=o)),function(t){return o(t[r])}},r.prototype.interpretPlural=function(r,t,e,n){var a=this,l="selectordinal"===t?this.localeData.ordinal:this.localeData.plural,i=[r,t,e],o={};return Object.keys(n).forEach(function(r){o[r]=a.interpretSubs(n[r],i)}),function(t){var n=+t[r],a="="+n,i=l?l(n-e):"other",u=o[a]||o[i]||o.other;return u(t)}},r.prototype.interpretSelect=function(r,t){var e=this,n={};return Object.keys(t).forEach(function(r){n[r]=e.interpretSubs(t[r],null)}),function(t){var e=t[r],a=n[e]||n.other;return a(t)}},r.prototype.interpretSimple=function(r){return function(t){return""+t[r]}},r.interpret=function(t,e){return new r(e).interpret(t)},r}();r.exports=e},function(r){"use strict";var t=[function(r){var t=+r;return 1===t?"one":"other"},function(r){var t=+r;return t>=0&&1>=t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===t||1===e?"one":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":2===t?"two":t%100>=3&&10>=t%100?"few":t%100>=11&&99>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":"other"},function(r){var t=+r;return t%10===1&&t%100!==11?"one":t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":t%10===0||t%10>=5&&9>=t%10||t%100>=11&&14>=t%100?"many":"other"},function(){return"other"},function(r){var t=+r;return t%10===1&&t%100!==11&&t%100!==71&&t%100!==91?"one":t%10===2&&t%100!==12&&t%100!==72&&t%100!==92?"two":(t%10>=3&&4>=t%10||t%10===9)&&(10>t%100||t%100>19)&&(70>t%100||t%100>79)&&(90>t%100||t%100>99)?"few":0!==t&&t%1e6===0?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%10===1&&t%100!==11||n%10===1&&n%100!==11?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)||n%10>=2&&4>=n%10&&(12>n%100||n%100>14)?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":t>=2&&4>=t&&0===e?"few":0!==e?"many":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":2===t?"two":3===t?"few":6===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(""+r).replace(/^[^.]*.?|0+$/g,""),n=+r;return 1===n||0!==e&&(0===t||1===t)?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%100===1||n%100===1?"one":0===e&&t%100===2||n%100===2?"two":0===e&&t%100>=3&&4>=t%100||n%100>=3&&4>=n%100?"few":"other"},function(r){var t=Math.floor(Math.abs(+r));return 0===t||1===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&(1===t||2===t||3===t)||0===e&&t%10!==4&&t%10!==6&&t%10!==9||0!==e&&n%10!==4&&n%10!==6&&n%10!==9?"one":"other"},function(r){var t=+r;return 1===t?"one":2===t?"two":t>=3&&6>=t?"few":t>=7&&10>=t?"many":"other"},function(r){var t=+r;return 1===t||11===t?"one":2===t||12===t?"two":t>=3&&10>=t||t>=13&&19>=t?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%10===1?"one":0===e&&t%10===2?"two":0!==e||t%100!==0&&t%100!==20&&t%100!==40&&t%100!==60&&t%100!==80?0!==e?"many":"other":"few"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+r;return 1===t&&0===e?"one":2===t&&0===e?"two":0===e&&(0>n||n>10)&&n%10===0?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(""+r).replace(/^[^.]*.?|0+$/g,"");return 0===e&&t%10===1&&t%100!==11||0!==e?"one":"other"},function(r){var t=+r;return 1===t?"one":2===t?"two":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===e?"zero":0!==t&&1!==t||0===e?"other":"one"},function(r){var t=+(r+".").split(".")[1],e=+r;return e%10===1&&(11>e%100||e%100>19)?"one":e%10>=2&&9>=e%10&&(11>e%100||e%100>19)?"few":0!==t?"many":"other"},function(r){var t=(r+".").split(".")[1].length,e=+(r+".").split(".")[1],n=+r;return n%10===0||n%100>=11&&19>=n%100||2===t&&e%100>=11&&19>=e%100?"zero":n%10===1&&n%100!==11||2===t&&e%10===1&&e%100!==11||2!==t&&e%10===1?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%10===1||n%10===1?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+r;return 1===t&&0===e?"one":0!==e||0===n||1!==n&&n%100>=1&&19>=n%100?"few":"other"},function(r){var t=+r;return 1===t?"one":0===t||t%100>=2&&10>=t%100?"few":t%100>=11&&19>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":0===e&&1!==t&&t%10>=0&&1>=t%10||0===e&&t%10>=5&&9>=t%10||0===e&&t%100>=12&&14>=t%100?"many":"other"},function(r){var t=+r;return t>=0&&2>=t&&2!==t?"one":"other"},function(r){var t=(r+".").split(".")[1].length,e=+r;return 1===e&&0===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%10===1&&t%100!==11?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":0===e&&t%10===0||0===e&&t%10>=5&&9>=t%10||0===e&&t%100>=11&&14>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===t||1===e?"one":e>=2&&10>=e?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(r+".").split(".")[1],n=+r;return 0===n||1===n||0===t&&1===e?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%100===1?"one":0===e&&t%100===2?"two":0===e&&t%100>=3&&4>=t%100||0!==e?"few":"other"},function(r){var t=+r;return t>=0&&1>=t||t>=11&&99>=t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r));return t%10===1||t%10===2||t%10===5||t%10===7||t%10===8||t%100===20||t%100===50||t%100===70||t%100===80?"one":t%10===3||t%10===4||t%1e3===100||t%1e3===200||t%1e3===300||t%1e3===400||t%1e3===500||t%1e3===600||t%1e3===700||t%1e3===800||t%1e3===900?"few":0===t||t%10===6||t%100===40||t%100===60||t%100===90?"many":"other"},function(r){var t=+r;return 1===t||5===t||7===t||8===t||9===t||10===t?"one":2===t||3===t?"two":4===t?"few":6===t?"many":"other"},function(r){var t=+r;return 1===t||3===t?"one":2===t?"two":4===t?"few":"other"},function(r){var t=+r;return 0===t||7===t||8===t||9===t?"zero":1===t?"one":2===t?"two":3===t||4===t?"few":5===t||6===t?"many":"other"},function(r){var t=+r;return t%10===1&&t%100!==11?"one":t%10===2&&t%100!==12?"two":t%10===3&&t%100!==13?"few":"other"},function(r){var t=+r;return 1===t?"one":2===t||3===t?"two":4===t?"few":6===t?"many":"other"},function(r){var t=+r;return 1===t||5===t?"one":"other"},function(r){var t=+r;return 11===t||8===t||80===t||800===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return 1===t?"one":0===t||t%100>=2&&20>=t%100||t%100===40||t%100===60||t%100===80?"many":"other"},function(r){var t=+r;return t%10===6||t%10===9||t%10===0&&0!==t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return t%10===1&&t%100!==11?"one":t%10===2&&t%100!==12?"two":t%10!==7&&t%10!==8||t%100===17||t%100===18?"other":"many"},function(r){var t=+r;return 1===t?"one":2===t||3===t?"two":4===t?"few":"other"},function(r){var t=+r;return t>=1&&4>=t?"one":"other"},function(r){var t=+r;return 1===t?"one":t%10===4&&t%100!==14?"many":"other"},function(r){var t=+r;return t%10!==1&&t%10!==2||t%100===11||t%100===12?"other":"one"},function(r){var t=+r;return t%10===3&&t%100!==13?"few":"other"}];r.exports={af:{plural:t[0],ordinal:t[6]},ak:{plural:t[1]},am:{plural:t[2],ordinal:t[6]},ar:{plural:t[3],ordinal:t[6]},asa:{plural:t[0]},ast:{plural:t[4]},az:{plural:t[0],ordinal:t[36]},be:{plural:t[5]},bem:{plural:t[0]},bez:{plural:t[0]},bg:{plural:t[0],ordinal:t[6]},bh:{plural:t[1]},bm:{plural:t[6]},bn:{plural:t[2],ordinal:t[37]},bo:{plural:t[6]},br:{plural:t[7]},brx:{plural:t[0]},bs:{plural:t[8],ordinal:t[6]},ca:{plural:t[4],ordinal:t[38]},cgg:{plural:t[0]},chr:{plural:t[0]},ckb:{plural:t[0]},cs:{plural:t[9],ordinal:t[6]},cy:{plural:t[10],ordinal:t[39]},da:{plural:t[11],ordinal:t[6]},de:{plural:t[4],ordinal:t[6]},dsb:{plural:t[12],ordinal:t[6]},dv:{plural:t[0]},dz:{plural:t[6]},ee:{plural:t[0]},el:{plural:t[0],ordinal:t[6]},en:{plural:t[4],ordinal:t[40]},eo:{plural:t[0]},es:{plural:t[0],ordinal:t[6]},et:{plural:t[4],ordinal:t[6]},eu:{plural:t[0],ordinal:t[6]},fa:{plural:t[2],ordinal:t[6]},ff:{plural:t[13]},fi:{plural:t[4],ordinal:t[6]},fil:{plural:t[14],ordinal:t[0]},fo:{plural:t[0]},fr:{plural:t[13],ordinal:t[0]},fur:{plural:t[0]},fy:{plural:t[4],ordinal:t[6]},ga:{plural:t[15]},gd:{plural:t[16]},gl:{plural:t[4],ordinal:t[6]},gsw:{plural:t[0]},gu:{plural:t[2],ordinal:t[41]},guw:{plural:t[1]},gv:{plural:t[17]},ha:{plural:t[0]},haw:{plural:t[0]},he:{plural:t[18],ordinal:t[6]},hi:{plural:t[2],ordinal:t[41]},hr:{plural:t[8],ordinal:t[6]},hsb:{plural:t[12],ordinal:t[6]},hu:{plural:t[0],ordinal:t[42]},hy:{plural:t[13],ordinal:t[0]},id:{plural:t[6],ordinal:t[6]},ig:{plural:t[6]},ii:{plural:t[6]},"in":{plural:t[6],ordinal:t[6]},is:{plural:t[19],ordinal:t[6]},it:{plural:t[4],ordinal:t[43]},iu:{plural:t[20]},iw:{plural:t[18],ordinal:t[6]},ja:{plural:t[6],ordinal:t[6]},jbo:{plural:t[6]},jgo:{plural:t[0]},ji:{plural:t[4]},jmc:{plural:t[0]},jv:{plural:t[6]},jw:{plural:t[6]},ka:{plural:t[0],ordinal:t[44]},kab:{plural:t[13]},kaj:{plural:t[0]},kcg:{plural:t[0]},kde:{plural:t[6]},kea:{plural:t[6]},kk:{plural:t[0],ordinal:t[45]},kkj:{plural:t[0]},kl:{plural:t[0]},km:{plural:t[6],ordinal:t[6]},kn:{plural:t[2],ordinal:t[6]},ko:{plural:t[6],ordinal:t[6]},ks:{plural:t[0]},ksb:{plural:t[0]},ksh:{plural:t[21]},ku:{plural:t[0]},kw:{plural:t[20]},ky:{plural:t[0],ordinal:t[6]},lag:{plural:t[22]},lb:{plural:t[0]},lg:{plural:t[0]},lkt:{plural:t[6]},ln:{plural:t[1]},lo:{plural:t[6],ordinal:t[0]},lt:{plural:t[23],ordinal:t[6]},lv:{plural:t[24],ordinal:t[6]},mas:{plural:t[0]},mg:{plural:t[1]},mgo:{plural:t[0]},mk:{plural:t[25],ordinal:t[46]},ml:{plural:t[0],ordinal:t[6]},mn:{plural:t[0],ordinal:t[6]},mo:{plural:t[26],ordinal:t[0]},mr:{plural:t[2],ordinal:t[47]},ms:{plural:t[6],ordinal:t[0]},mt:{plural:t[27]},my:{plural:t[6],ordinal:t[6]},nah:{plural:t[0]},naq:{plural:t[20]},nb:{plural:t[0],ordinal:t[6]},nd:{plural:t[0]},ne:{plural:t[0],ordinal:t[48]},nl:{plural:t[4],ordinal:t[6]},nn:{plural:t[0]},nnh:{plural:t[0]},no:{plural:t[0]},nqo:{plural:t[6]},nr:{plural:t[0]},nso:{plural:t[1]},ny:{plural:t[0]},nyn:{plural:t[0]},om:{plural:t[0]},or:{plural:t[0]},os:{plural:t[0]},pa:{plural:t[1],ordinal:t[6]},pap:{plural:t[0]},pl:{plural:t[28],ordinal:t[6]},prg:{plural:t[24],ordinal:t[6]},ps:{plural:t[0]},pt:{plural:t[29],ordinal:t[6]},"pt-PT":{plural:t[30]},rm:{plural:t[0]},ro:{plural:t[26],ordinal:t[0]},rof:{plural:t[0]},root:{plural:t[6],ordinal:t[6]},ru:{plural:t[31],ordinal:t[6]},rwk:{plural:t[0]},sah:{plural:t[6]},saq:{plural:t[0]},se:{plural:t[20]},seh:{plural:t[0]},ses:{plural:t[6]},sg:{plural:t[6]},sh:{plural:t[8],ordinal:t[6]},shi:{plural:t[32]},si:{plural:t[33],ordinal:t[6]},sk:{plural:t[9],ordinal:t[6]},sl:{plural:t[34],ordinal:t[6]},sma:{plural:t[20]},smi:{plural:t[20]},smj:{plural:t[20]},smn:{plural:t[20]},sms:{plural:t[20]},sn:{plural:t[0]},so:{plural:t[0]},sq:{plural:t[0],ordinal:t[49]},sr:{plural:t[8],ordinal:t[6]},ss:{plural:t[0]},ssy:{plural:t[0]},st:{plural:t[0]},sv:{plural:t[4],ordinal:t[50]},sw:{plural:t[4],ordinal:t[6]},syr:{plural:t[0]},ta:{plural:t[0],ordinal:t[6]},te:{plural:t[0],ordinal:t[6]},teo:{plural:t[0]},th:{plural:t[6],ordinal:t[6]},ti:{plural:t[1]},tig:{plural:t[0]},tk:{plural:t[0]},tl:{plural:t[14],ordinal:t[0]},tn:{plural:t[0]},to:{plural:t[6]},tr:{plural:t[0],ordinal:t[6]},ts:{plural:t[0]},tzm:{plural:t[35]},ug:{plural:t[0]},uk:{plural:t[31],ordinal:t[51]},ur:{plural:t[4],ordinal:t[6]},uz:{plural:t[0],ordinal:t[6]},ve:{plural:t[0]},vi:{plural:t[6],ordinal:t[0]},vo:{plural:t[0]},vun:{plural:t[0]},wa:{plural:t[1]},wae:{plural:t[0]},wo:{plural:t[6]},xh:{plural:t[0]},xog:{plural:t[0]},yi:{plural:t[4]},yo:{plural:t[6]},zh:{plural:t[6],ordinal:t[6]},zu:{plural:t[2],ordinal:t[6]}}},function(r){"use strict";function t(r,t){for(var e=[].concat(r||[]),n=0,a=e.length;a>n;++n)for(var l=e[n].split("-");l.length;){if(l.join("-")in t)return l.join("-");l.pop()}return"en"}r.exports=t},function(r,t,e){"use strict";function n(r,t){var e=void 0===arguments[2]?{}:arguments[2];if("object"!=typeof this||!(this instanceof n))return new n(r,t,e);if("string"!=typeof r)throw new TypeError("message pattern must be a string");var a=o(t,n.data.locales),u=n.data.locales[a],s="cache"in e?e.cache:!0,p=n.data.formats.cache,h=a+":message:"+r,c=n.data.formats,f=void 0;s&&h in p?f=p[h]:(f=i.interpret(l.parse(r,{escape:e.escape}),{locale:t,data:u,formats:c,cache:s}),s&&(p[h]=f)),this.resolvedOptions=function(){return u},this.format=f}var a=function(r){return r&&r.__esModule?r["default"]:r},l=a(e(7)),i=a(e(3)),o=a(e(5)),u=a(e(2));Object.defineProperties(n.prototype,{resolvedOptions:{configurable:!0,writable:!0,value:function(){}},format:{configurable:!0,writable:!0,value:function(){}}}),Object.defineProperties(n,{supportedLocalesOf:{configurable:!0,writable:!0,value:function(){return Object.keys(n.data.locales)}},data:{value:u}}),r.exports=n},function(r){"use strict";var t=function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t&&(r.__proto__=t)},e=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function r(){var t=void 0===arguments[0]?{}:arguments[0],n=t.escape;e(this,r),this.escape=n||"'",this.pattern=null,this.index=0}return r.prototype.parse=function(r){return this.pattern=r,this.index=0,this.parseMessage("message")},r.prototype.isDigit=function(r){return"0"===r||"1"===r||"2"===r||"3"===r||"4"===r||"5"===r||"6"===r||"7"===r||"8"===r||"9"===r},r.prototype.isWhitespace=function(r){return" "===r||" "===r||"\n"===r||"\r"===r||"\f"===r||" "===r||" "===r||"\u2028"===r||"\u2029"===r},r.prototype.skipWhitespace=function(){for(var r=this.pattern,t=r.length;this.index<t&&this.isWhitespace(r.charAt(this.index));)++this.index},r.prototype.parseText=function(r){for(var t="",e=void 0,n=this.pattern,a=n.length,l="plural"===r||"selectordinal"===r,i="style"===r,o=this.escape;this.index<a&&(e=n.charAt(this.index),!("{"===e||"}"===e||l&&"#"===e||i&&this.isWhitespace(e)));)if("'"===o&&"'"===e)if(e=n.charAt(++this.index),"'"===e)t+=e,++this.index;else if("{"===e||"}"===e||l&&"#"===e||i&&this.isWhitespace(e))for(t+=e;++this.index<a;)if(e=n.charAt(this.index),"''"===n.slice(this.index,this.index+2))t+=e,++this.index;else{if("'"===e){++this.index;break}t+=e}else t+="'";else o&&o===e?(e=n.charAt(++this.index),t+=e,++this.index):(t+=e,++this.index);return t},r.prototype.parseArgument=function(){var r=this.pattern;if("#"===r.charAt(this.index))return++this.index,["#"];++this.index;var t=this.parseArgId(),e=r.charAt(this.index);if("}"===e)return++this.index,[t];","!==e&&this.throwExpected(","),++this.index;var n=this.parseArgType();if(e=r.charAt(this.index),"}"===e)return("plural"===n||"selectordinal"===n||"select"===n)&&this.throwExpected(n+" message options"),++this.index,[t,n];","!==e&&this.throwExpected(","),++this.index;var a=void 0,l=void 0;return"plural"===n||"selectordinal"===n?(l=this.parsePluralOffset(),a=this.parseSubMessages(n)):a="select"===n?this.parseSubMessages(n):this.parseSimpleFormat(),e=r.charAt(this.index),"}"!==e&&this.throwExpected("}"),++this.index,"plural"===n||"selectordinal"===n?[t,n,l,a]:[t,n,a]},r.prototype.parseArgId=function(){this.skipWhitespace();for(var r=this.pattern,t=r.length,e="";this.index<t;){var n=r.charAt(this.index);if(("{"===n||"#"===n)&&this.throwExpected("argument id"),"}"===n||","===n||this.isWhitespace(n))break;e+=n,++this.index}return e||this.throwExpected("argument id"),this.skipWhitespace(),e},r.prototype.parseArgType=function(){this.skipWhitespace();for(var r=this.pattern,t=void 0,e=["number","date","time","ordinal","duration","spellout","plural","selectordinal","select"],n=0,a=e.length;a>n;++n){var l=e[n];if(r.slice(this.index,this.index+l.length)===l){t=l,this.index+=l.length;break}}return t||this.throwExpected(e.join(", ")),this.skipWhitespace(),t},r.prototype.parseSimpleFormat=function(){this.skipWhitespace();var r=this.parseText("style");return r||this.throwExpected("argument style name"),this.skipWhitespace(),r},r.prototype.parsePluralOffset=function(){this.skipWhitespace();var r=0,t=this.pattern,e=t.length;if("offset:"===t.slice(this.index,this.index+7)){this.index+=7,this.skipWhitespace();for(var n=this.index;this.index<e&&this.isDigit(t.charAt(this.index));)++this.index;n===this.index&&this.throwExpected("offset number"),r=+t.slice(n,this.index),this.skipWhitespace()}return r},r.prototype.parseSubMessages=function(r){this.skipWhitespace();for(var t=this.pattern,e=t.length,n={},a=!1;this.index<e&&"}"!==t.charAt(this.index);){var l=this.parseSelector();this.skipWhitespace(),n[l]=this.parseSubMessage(r),a=!0,this.skipWhitespace()}return a||this.throwExpected(r+" message options"),"other"in n||this.throwExpected(null,null,'"other" option must be specified in '+r),n},r.prototype.parseSelector=function(){for(var r="",t=this.pattern,e=t.length;this.index<e;){var n=t.charAt(this.index);if(("}"===n||","===n)&&this.throwExpected("{"),"{"===n||this.isWhitespace(n))break;r+=n,++this.index}return r||this.throwExpected("selector"),this.skipWhitespace(),r},r.prototype.parseSubMessage=function(r){var t=this.pattern.charAt(this.index);"{"!==t&&this.throwExpected("{"),++this.index;var e=this.parseMessage(r);return t=this.pattern.charAt(this.index),"}"!==t&&this.throwExpected("}"),++this.index,e},r.prototype.parseMessage=function(r){var t=this.pattern,e=t.length,n=void 0,a=[];for((n=this.parseText(r))&&a.push(n);this.index<e;){if("}"===t.charAt(this.index)){"message"===r&&this.throwExpected();break}a.push(this.parseArgument(r)),(n=this.parseText(r))&&a.push(n)}return a},r.prototype.throwExpected=function(r,t,e){var n=this.pattern,l=n.slice(0,this.index).split(/\r?\n/),i=this.index,o=l.length,u=l.slice(-1)[0].length;throw t||(t=this.pattern.charAt(this.index)||"end of input"),e||(e=this.errorMessage(r,t)),e+=" in "+n.replace(/\r?\n/g,"\n"),new a(e,r,t,i,o,u)},r.prototype.errorMessage=function(r,t){return r?"Expected "+r+" but "+t+" found":"Unexpected "+t+" found"},r.parse=function(t,e){return new r(e).parse(t)},r}(),a=function(r){function n(r,t,a,l,i,o){e(this,n),this.name="SyntaxError",this.message=r,this.expected=t,this.found=a,this.offset=l,this.line=i,this.column=o}return t(n,r),n}(Error);r.exports=n,n.SyntaxError=a}]);
!function(r){function t(n){if(e[n])return e[n].exports;var a=e[n]={exports:{},id:n,loaded:!1};return r[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var e={};return t.m=r,t.c=e,t.p="/",t(0)}([function(r,t,e){r.exports=e(1)},function(r,t,e){"use strict";(window.Intl||(window.Intl={})).MessageFormat=e(6)},function(r,t,e){"use strict";var n=function(r){return r&&r.__esModule?r["default"]:r},a=n(e(4)),l={locales:{},formats:{cache:{},number:{currency:{style:"currency",currency:"USD"},percent:{style:"percent"}},date:{"short":{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},"long":{month:"long",day:"numeric",year:"numeric"},full:{month:"long",day:"numeric",year:"numeric",weekday:"long"}},time:{"short":{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},"long":{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}}};Object.keys(a).forEach(function(r){var t=a[r],e=t.plural,n=t.ordinal;l.locales[r]={locale:r,plural:e,ordinal:n}}),r.exports=l},function(r){"use strict";var t=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},e=function(){function r(){var e=void 0===arguments[0]?{}:arguments[0],n=e.locale,a=e.data,l=e.formats,i=e.cache;t(this,r),this.originalLocale=n,this.localeData=a,this.formats=l,this.enableCache="boolean"==typeof i?i:!0}return r.prototype.interpret=function(r){return this.interpretSubs(r)},r.prototype.interpretSubs=function(r,t){var e=this;return r=r.map(function(r){return e.interpretElement(r,t)}),1===r.length?r[0]:function(t){for(var e="",n=0,a=r.length;a>n;++n)e+=r[n](t);return e}},r.prototype.interpretElement=function(r,t){if("string"==typeof r)return function(){return r};var e=r[0],n=r[1],a=r[2],l=0,i=void 0;switch("#"===e&&(e=t[0],n="selectordinal"===t[1]?"ordinal":"number",l=t[2],a=null),n){case"number":case"ordinal":case"spellout":case"duration":return this.interpretNumber(e,l,a);case"date":case"time":return this.interpretDateTime(e,n,a);case"plural":case"selectordinal":return l=r[2],i=r[3],this.interpretPlural(e,n,l,i);case"select":return this.interpretSelect(e,a);default:return this.interpretSimple(e)}},r.prototype.interpretNumber=function(r,t){var e=this,n=void 0===arguments[2]?"medium":arguments[2];t=t||0;var a=this.originalLocale,l=this.formats,i=l.cache,o=a+":number:"+n,u=void 0;return this.enableCache&&o in i?u=i[o]:!function(){var r=l.number[n];u="undefined"!=typeof Intl&&Intl.NumberFormat?new Intl.NumberFormat(a,r).format:function(t){return Number(t).toLocaleString(a,r)},e.enableCache&&(i[o]=u)}(),function(e){return u(+e[r]-t)}},r.prototype.interpretDateTime=function(r,t){var e=this,n=void 0===arguments[2]?"medium":arguments[2],a=this.originalLocale,l=this.formats,i=l.cache,o=a+":"+t+":"+n,u=void 0;return this.enableCache&&o in i?u=i[o]:!function(){var r=l[t][n],s="time"===t?"toLocaleTimeString":"toLocaleDateString";u="undefined"!=typeof Intl&&Intl.DateTimeFormat?new Intl.DateTimeFormat(a,r).format:function(t){return new Date(t)[s](a,r)},e.enableCache&&(i[o]=u)}(),function(t){return u(t[r])}},r.prototype.interpretPlural=function(r,t,e,n){var a=this,l="selectordinal"===t?this.localeData.ordinal:this.localeData.plural,i=[r,t,e],o={};return Object.keys(n).forEach(function(r){o[r]=a.interpretSubs(n[r],i)}),function(t){var n=+t[r],a="="+n,i=l?l(n-e):"other",u=o[a]||o[i]||o.other;return u(t)}},r.prototype.interpretSelect=function(r,t){var e=this,n={};return Object.keys(t).forEach(function(r){n[r]=e.interpretSubs(t[r],null)}),function(t){var e=t[r],a=n[e]||n.other;return a(t)}},r.prototype.interpretSimple=function(r){return function(t){return""+t[r]}},r.interpret=function(t,e){return new r(e).interpret(t)},r}();r.exports=e},function(r){"use strict";var t=[function(r){var t=+r;return 1===t?"one":"other"},function(r){var t=+r;return t>=0&&1>=t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===t||1===e?"one":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":2===t?"two":t%100>=3&&10>=t%100?"few":t%100>=11&&99>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":"other"},function(r){var t=+r;return t%10===1&&t%100!==11?"one":t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":t%10===0||t%10>=5&&9>=t%10||t%100>=11&&14>=t%100?"many":"other"},function(){return"other"},function(r){var t=+r;return t%10===1&&t%100!==11&&t%100!==71&&t%100!==91?"one":t%10===2&&t%100!==12&&t%100!==72&&t%100!==92?"two":(t%10>=3&&4>=t%10||t%10===9)&&(10>t%100||t%100>19)&&(70>t%100||t%100>79)&&(90>t%100||t%100>99)?"few":0!==t&&t%1e6===0?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%10===1&&t%100!==11||n%10===1&&n%100!==11?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)||n%10>=2&&4>=n%10&&(12>n%100||n%100>14)?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":t>=2&&4>=t&&0===e?"few":0!==e?"many":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":2===t?"two":3===t?"few":6===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(""+r).replace(/^[^.]*.?|0+$/g,""),n=+r;return 1===n||0!==e&&(0===t||1===t)?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%100===1||n%100===1?"one":0===e&&t%100===2||n%100===2?"two":0===e&&t%100>=3&&4>=t%100||n%100>=3&&4>=n%100?"few":"other"},function(r){var t=Math.floor(Math.abs(+r));return 0===t||1===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&(1===t||2===t||3===t)||0===e&&t%10!==4&&t%10!==6&&t%10!==9||0!==e&&n%10!==4&&n%10!==6&&n%10!==9?"one":"other"},function(r){var t=+r;return 1===t?"one":2===t?"two":t>=3&&6>=t?"few":t>=7&&10>=t?"many":"other"},function(r){var t=+r;return 1===t||11===t?"one":2===t||12===t?"two":t>=3&&10>=t||t>=13&&19>=t?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%10===1?"one":0===e&&t%10===2?"two":0!==e||t%100!==0&&t%100!==20&&t%100!==40&&t%100!==60&&t%100!==80?0!==e?"many":"other":"few"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+r;return 1===t&&0===e?"one":2===t&&0===e?"two":0===e&&(0>n||n>10)&&n%10===0?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(""+r).replace(/^[^.]*.?|0+$/g,"");return 0===e&&t%10===1&&t%100!==11||0!==e?"one":"other"},function(r){var t=+r;return 1===t?"one":2===t?"two":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===e?"zero":0!==t&&1!==t||0===e?"other":"one"},function(r){var t=+(r+".").split(".")[1],e=+r;return e%10===1&&(11>e%100||e%100>19)?"one":e%10>=2&&9>=e%10&&(11>e%100||e%100>19)?"few":0!==t?"many":"other"},function(r){var t=(r+".").split(".")[1].length,e=+(r+".").split(".")[1],n=+r;return n%10===0||n%100>=11&&19>=n%100||2===t&&e%100>=11&&19>=e%100?"zero":n%10===1&&n%100!==11||2===t&&e%10===1&&e%100!==11||2!==t&&e%10===1?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%10===1||n%10===1?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+r;return 1===t&&0===e?"one":0!==e||0===n||1!==n&&n%100>=1&&19>=n%100?"few":"other"},function(r){var t=+r;return 1===t?"one":0===t||t%100>=2&&10>=t%100?"few":t%100>=11&&19>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":0===e&&1!==t&&t%10>=0&&1>=t%10||0===e&&t%10>=5&&9>=t%10||0===e&&t%100>=12&&14>=t%100?"many":"other"},function(r){var t=+r;return t>=0&&2>=t&&2!==t?"one":"other"},function(r){var t=(r+".").split(".")[1].length,e=+r;return 1===e&&0===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%10===1&&t%100!==11?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":0===e&&t%10===0||0===e&&t%10>=5&&9>=t%10||0===e&&t%100>=11&&14>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===t||1===e?"one":e>=2&&10>=e?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(r+".").split(".")[1],n=+r;return 0===n||1===n||0===t&&1===e?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%100===1?"one":0===e&&t%100===2?"two":0===e&&t%100>=3&&4>=t%100||0!==e?"few":"other"},function(r){var t=+r;return t>=0&&1>=t||t>=11&&99>=t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r));return t%10===1||t%10===2||t%10===5||t%10===7||t%10===8||t%100===20||t%100===50||t%100===70||t%100===80?"one":t%10===3||t%10===4||t%1e3===100||t%1e3===200||t%1e3===300||t%1e3===400||t%1e3===500||t%1e3===600||t%1e3===700||t%1e3===800||t%1e3===900?"few":0===t||t%10===6||t%100===40||t%100===60||t%100===90?"many":"other"},function(r){var t=+r;return 1===t||5===t||7===t||8===t||9===t||10===t?"one":2===t||3===t?"two":4===t?"few":6===t?"many":"other"},function(r){var t=+r;return 1===t||3===t?"one":2===t?"two":4===t?"few":"other"},function(r){var t=+r;return 0===t||7===t||8===t||9===t?"zero":1===t?"one":2===t?"two":3===t||4===t?"few":5===t||6===t?"many":"other"},function(r){var t=+r;return t%10===1&&t%100!==11?"one":t%10===2&&t%100!==12?"two":t%10===3&&t%100!==13?"few":"other"},function(r){var t=+r;return 1===t?"one":2===t||3===t?"two":4===t?"few":6===t?"many":"other"},function(r){var t=+r;return 1===t||5===t?"one":"other"},function(r){var t=+r;return 11===t||8===t||80===t||800===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return 1===t?"one":0===t||t%100>=2&&20>=t%100||t%100===40||t%100===60||t%100===80?"many":"other"},function(r){var t=+r;return t%10===6||t%10===9||t%10===0&&0!==t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return t%10===1&&t%100!==11?"one":t%10===2&&t%100!==12?"two":t%10!==7&&t%10!==8||t%100===17||t%100===18?"other":"many"},function(r){var t=+r;return 1===t?"one":2===t||3===t?"two":4===t?"few":"other"},function(r){var t=+r;return t>=1&&4>=t?"one":"other"},function(r){var t=+r;return 1===t?"one":t%10===4&&t%100!==14?"many":"other"},function(r){var t=+r;return t%10!==1&&t%10!==2||t%100===11||t%100===12?"other":"one"},function(r){var t=+r;return t%10===3&&t%100!==13?"few":"other"}];r.exports={af:{plural:t[0],ordinal:t[6]},ak:{plural:t[1]},am:{plural:t[2],ordinal:t[6]},ar:{plural:t[3],ordinal:t[6]},asa:{plural:t[0]},ast:{plural:t[4]},az:{plural:t[0],ordinal:t[36]},be:{plural:t[5]},bem:{plural:t[0]},bez:{plural:t[0]},bg:{plural:t[0],ordinal:t[6]},bh:{plural:t[1]},bm:{plural:t[6]},bn:{plural:t[2],ordinal:t[37]},bo:{plural:t[6]},br:{plural:t[7]},brx:{plural:t[0]},bs:{plural:t[8],ordinal:t[6]},ca:{plural:t[4],ordinal:t[38]},cgg:{plural:t[0]},chr:{plural:t[0]},ckb:{plural:t[0]},cs:{plural:t[9],ordinal:t[6]},cy:{plural:t[10],ordinal:t[39]},da:{plural:t[11],ordinal:t[6]},de:{plural:t[4],ordinal:t[6]},dsb:{plural:t[12],ordinal:t[6]},dv:{plural:t[0]},dz:{plural:t[6]},ee:{plural:t[0]},el:{plural:t[0],ordinal:t[6]},en:{plural:t[4],ordinal:t[40]},eo:{plural:t[0]},es:{plural:t[0],ordinal:t[6]},et:{plural:t[4],ordinal:t[6]},eu:{plural:t[0],ordinal:t[6]},fa:{plural:t[2],ordinal:t[6]},ff:{plural:t[13]},fi:{plural:t[4],ordinal:t[6]},fil:{plural:t[14],ordinal:t[0]},fo:{plural:t[0]},fr:{plural:t[13],ordinal:t[0]},fur:{plural:t[0]},fy:{plural:t[4],ordinal:t[6]},ga:{plural:t[15]},gd:{plural:t[16]},gl:{plural:t[4],ordinal:t[6]},gsw:{plural:t[0]},gu:{plural:t[2],ordinal:t[41]},guw:{plural:t[1]},gv:{plural:t[17]},ha:{plural:t[0]},haw:{plural:t[0]},he:{plural:t[18],ordinal:t[6]},hi:{plural:t[2],ordinal:t[41]},hr:{plural:t[8],ordinal:t[6]},hsb:{plural:t[12],ordinal:t[6]},hu:{plural:t[0],ordinal:t[42]},hy:{plural:t[13],ordinal:t[0]},id:{plural:t[6],ordinal:t[6]},ig:{plural:t[6]},ii:{plural:t[6]},"in":{plural:t[6],ordinal:t[6]},is:{plural:t[19],ordinal:t[6]},it:{plural:t[4],ordinal:t[43]},iu:{plural:t[20]},iw:{plural:t[18],ordinal:t[6]},ja:{plural:t[6],ordinal:t[6]},jbo:{plural:t[6]},jgo:{plural:t[0]},ji:{plural:t[4]},jmc:{plural:t[0]},jv:{plural:t[6]},jw:{plural:t[6]},ka:{plural:t[0],ordinal:t[44]},kab:{plural:t[13]},kaj:{plural:t[0]},kcg:{plural:t[0]},kde:{plural:t[6]},kea:{plural:t[6]},kk:{plural:t[0],ordinal:t[45]},kkj:{plural:t[0]},kl:{plural:t[0]},km:{plural:t[6],ordinal:t[6]},kn:{plural:t[2],ordinal:t[6]},ko:{plural:t[6],ordinal:t[6]},ks:{plural:t[0]},ksb:{plural:t[0]},ksh:{plural:t[21]},ku:{plural:t[0]},kw:{plural:t[20]},ky:{plural:t[0],ordinal:t[6]},lag:{plural:t[22]},lb:{plural:t[0]},lg:{plural:t[0]},lkt:{plural:t[6]},ln:{plural:t[1]},lo:{plural:t[6],ordinal:t[0]},lt:{plural:t[23],ordinal:t[6]},lv:{plural:t[24],ordinal:t[6]},mas:{plural:t[0]},mg:{plural:t[1]},mgo:{plural:t[0]},mk:{plural:t[25],ordinal:t[46]},ml:{plural:t[0],ordinal:t[6]},mn:{plural:t[0],ordinal:t[6]},mo:{plural:t[26],ordinal:t[0]},mr:{plural:t[2],ordinal:t[47]},ms:{plural:t[6],ordinal:t[0]},mt:{plural:t[27]},my:{plural:t[6],ordinal:t[6]},nah:{plural:t[0]},naq:{plural:t[20]},nb:{plural:t[0],ordinal:t[6]},nd:{plural:t[0]},ne:{plural:t[0],ordinal:t[48]},nl:{plural:t[4],ordinal:t[6]},nn:{plural:t[0]},nnh:{plural:t[0]},no:{plural:t[0]},nqo:{plural:t[6]},nr:{plural:t[0]},nso:{plural:t[1]},ny:{plural:t[0]},nyn:{plural:t[0]},om:{plural:t[0]},or:{plural:t[0]},os:{plural:t[0]},pa:{plural:t[1],ordinal:t[6]},pap:{plural:t[0]},pl:{plural:t[28],ordinal:t[6]},prg:{plural:t[24],ordinal:t[6]},ps:{plural:t[0]},pt:{plural:t[29],ordinal:t[6]},"pt-PT":{plural:t[30]},rm:{plural:t[0]},ro:{plural:t[26],ordinal:t[0]},rof:{plural:t[0]},root:{plural:t[6],ordinal:t[6]},ru:{plural:t[31],ordinal:t[6]},rwk:{plural:t[0]},sah:{plural:t[6]},saq:{plural:t[0]},se:{plural:t[20]},seh:{plural:t[0]},ses:{plural:t[6]},sg:{plural:t[6]},sh:{plural:t[8],ordinal:t[6]},shi:{plural:t[32]},si:{plural:t[33],ordinal:t[6]},sk:{plural:t[9],ordinal:t[6]},sl:{plural:t[34],ordinal:t[6]},sma:{plural:t[20]},smi:{plural:t[20]},smj:{plural:t[20]},smn:{plural:t[20]},sms:{plural:t[20]},sn:{plural:t[0]},so:{plural:t[0]},sq:{plural:t[0],ordinal:t[49]},sr:{plural:t[8],ordinal:t[6]},ss:{plural:t[0]},ssy:{plural:t[0]},st:{plural:t[0]},sv:{plural:t[4],ordinal:t[50]},sw:{plural:t[4],ordinal:t[6]},syr:{plural:t[0]},ta:{plural:t[0],ordinal:t[6]},te:{plural:t[0],ordinal:t[6]},teo:{plural:t[0]},th:{plural:t[6],ordinal:t[6]},ti:{plural:t[1]},tig:{plural:t[0]},tk:{plural:t[0]},tl:{plural:t[14],ordinal:t[0]},tn:{plural:t[0]},to:{plural:t[6]},tr:{plural:t[0],ordinal:t[6]},ts:{plural:t[0]},tzm:{plural:t[35]},ug:{plural:t[0]},uk:{plural:t[31],ordinal:t[51]},ur:{plural:t[4],ordinal:t[6]},uz:{plural:t[0],ordinal:t[6]},ve:{plural:t[0]},vi:{plural:t[6],ordinal:t[0]},vo:{plural:t[0]},vun:{plural:t[0]},wa:{plural:t[1]},wae:{plural:t[0]},wo:{plural:t[6]},xh:{plural:t[0]},xog:{plural:t[0]},yi:{plural:t[4]},yo:{plural:t[6]},zh:{plural:t[6],ordinal:t[6]},zu:{plural:t[2],ordinal:t[6]}}},function(r){"use strict";function t(r,t){for(var e=[].concat(r||[]),n=0,a=e.length;a>n;++n)for(var l=e[n].split("-");l.length;){if(l.join("-")in t)return l.join("-");l.pop()}return"en"}r.exports=t},function(r,t,e){"use strict";function n(r,t){var e=void 0===arguments[2]?{}:arguments[2];if("object"!=typeof this||!(this instanceof n))return new n(r,t,e);if("string"!=typeof r)throw new TypeError("message pattern must be a string");var a=o(t,n.data.locales),u=n.data.locales[a],s="cache"in e?e.cache:!0,p=n.data.formats.cache,h=a+":message:"+r,c=n.data.formats,f=void 0;s&&h in p?f=p[h]:(f=i.interpret(l.parse(r,{escape:e.escape}),{locale:t,data:u,formats:c,cache:s}),s&&(p[h]=f)),this.resolvedOptions=function(){return u},this.format=f}var a=function(r){return r&&r.__esModule?r["default"]:r};r.exports=n;/*!
* Intl.MessageFormat polyfill
* Copyright(c) 2015 Andy VanWagoner
* MIT licensed
**/
var l=a(e(7)),i=a(e(3)),o=a(e(5)),u=a(e(2));Object.defineProperties(n.prototype,{resolvedOptions:{configurable:!0,writable:!0,value:function(){}},format:{configurable:!0,writable:!0,value:function(){}}}),Object.defineProperties(n,{supportedLocalesOf:{configurable:!0,writable:!0,value:function(){return Object.keys(n.data.locales)}},data:{value:u}})},function(r){"use strict";var t=function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t&&(r.__proto__=t)},e=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function r(){var t=void 0===arguments[0]?{}:arguments[0],n=t.escape;e(this,r),this.escape=n||"'",this.pattern=null,this.index=0}return r.prototype.parse=function(r){return this.pattern=r,this.index=0,this.parseMessage("message")},r.prototype.isDigit=function(r){return"0"===r||"1"===r||"2"===r||"3"===r||"4"===r||"5"===r||"6"===r||"7"===r||"8"===r||"9"===r},r.prototype.isWhitespace=function(r){return" "===r||" "===r||"\n"===r||"\r"===r||"\f"===r||" "===r||" "===r||"\u2028"===r||"\u2029"===r},r.prototype.skipWhitespace=function(){for(var r=this.pattern,t=r.length;this.index<t&&this.isWhitespace(r.charAt(this.index));)++this.index},r.prototype.parseText=function(r){for(var t=this.pattern,e=t.length,n="plural"===r||"selectordinal"===r,a="style"===r,l=this.escape,i="",o=void 0;this.index<e&&(o=t.charAt(this.index),!("{"===o||"}"===o||n&&"#"===o||a&&this.isWhitespace(o)));)if("'"===l&&"'"===o)if(o=t.charAt(++this.index),"'"===o)i+=o,++this.index;else if("{"===o||"}"===o||n&&"#"===o||a&&this.isWhitespace(o))for(i+=o;++this.index<e;)if(o=t.charAt(this.index),"''"===t.slice(this.index,this.index+2))i+=o,++this.index;else{if("'"===o){++this.index;break}i+=o}else i+="'";else l&&l===o?(o=t.charAt(++this.index),i+=o,++this.index):(i+=o,++this.index);return i},r.prototype.parseArgument=function(){var r=this.pattern;if("#"===r.charAt(this.index))return++this.index,["#"];++this.index;var t=this.parseArgId(),e=r.charAt(this.index);if("}"===e)return++this.index,[t];","!==e&&this.throwExpected(","),++this.index;var n=this.parseArgType();if(e=r.charAt(this.index),"}"===e)return("plural"===n||"selectordinal"===n||"select"===n)&&this.throwExpected(n+" message options"),++this.index,[t,n];","!==e&&this.throwExpected(","),++this.index;var a=void 0,l=void 0;return"plural"===n||"selectordinal"===n?(l=this.parsePluralOffset(),a=this.parseSubMessages(n)):a="select"===n?this.parseSubMessages(n):this.parseSimpleFormat(),e=r.charAt(this.index),"}"!==e&&this.throwExpected("}"),++this.index,"plural"===n||"selectordinal"===n?[t,n,l,a]:[t,n,a]},r.prototype.parseArgId=function(){this.skipWhitespace();for(var r=this.pattern,t=r.length,e="";this.index<t;){var n=r.charAt(this.index);if(("{"===n||"#"===n)&&this.throwExpected("argument id"),"}"===n||","===n||this.isWhitespace(n))break;e+=n,++this.index}return e||this.throwExpected("argument id"),this.skipWhitespace(),e},r.prototype.parseArgType=function(){this.skipWhitespace();for(var r=this.pattern,t=void 0,e=["number","date","time","ordinal","duration","spellout","plural","selectordinal","select"],n=0,a=e.length;a>n;++n){var l=e[n];if(r.slice(this.index,this.index+l.length)===l){t=l,this.index+=l.length;break}}return t||this.throwExpected(e.join(", ")),this.skipWhitespace(),t},r.prototype.parseSimpleFormat=function(){this.skipWhitespace();var r=this.parseText("style");return r||this.throwExpected("argument style name"),this.skipWhitespace(),r},r.prototype.parsePluralOffset=function(){this.skipWhitespace();var r=0,t=this.pattern,e=t.length;if("offset:"===t.slice(this.index,this.index+7)){this.index+=7,this.skipWhitespace();for(var n=this.index;this.index<e&&this.isDigit(t.charAt(this.index));)++this.index;n===this.index&&this.throwExpected("offset number"),r=+t.slice(n,this.index),this.skipWhitespace()}return r},r.prototype.parseSubMessages=function(r){this.skipWhitespace();for(var t=this.pattern,e=t.length,n={},a=!1;this.index<e&&"}"!==t.charAt(this.index);){var l=this.parseSelector();this.skipWhitespace(),n[l]=this.parseSubMessage(r),a=!0,this.skipWhitespace()}return a||this.throwExpected(r+" message options"),"other"in n||this.throwExpected(null,null,'"other" option must be specified in '+r),n},r.prototype.parseSelector=function(){for(var r=this.pattern,t=r.length,e="";this.index<t;){var n=r.charAt(this.index);if(("}"===n||","===n)&&this.throwExpected("{"),"{"===n||this.isWhitespace(n))break;e+=n,++this.index}return e||this.throwExpected("selector"),this.skipWhitespace(),e},r.prototype.parseSubMessage=function(r){var t=this.pattern.charAt(this.index);"{"!==t&&this.throwExpected("{"),++this.index;var e=this.parseMessage(r);return t=this.pattern.charAt(this.index),"}"!==t&&this.throwExpected("}"),++this.index,e},r.prototype.parseMessage=function(r){var t=this.pattern,e=t.length,n=void 0,a=[];for((n=this.parseText(r))&&a.push(n);this.index<e;){if("}"===t.charAt(this.index)){"message"===r&&this.throwExpected();break}a.push(this.parseArgument(r)),(n=this.parseText(r))&&a.push(n)}return a},r.prototype.throwExpected=function(r,t,e){var n=this.pattern,l=n.slice(0,this.index).split(/\r?\n/),i=this.index,o=l.length,u=l.slice(-1)[0].length;throw t||(t=this.pattern.charAt(this.index)||"end of input"),e||(e=this.errorMessage(r,t)),e+=" in "+n.replace(/\r?\n/g,"\n"),new a(e,r,t,i,o,u)},r.prototype.errorMessage=function(r,t){return r?"Expected "+r+" but "+t+" found":"Unexpected "+t+" found"},r.parse=function(t,e){return new r(e).parse(t)},r}();r.exports=n;var a=function(r){function n(r,t,a,l,i,o){e(this,n),this.name="SyntaxError",this.message=r,this.expected=t,this.found=a,this.offset=l,this.line=i,this.column=o}return t(n,r),n}(Error);n.SyntaxError=a}]);
//# sourceMappingURL=browser.js.map

@@ -11,34 +11,73 @@ "use strict";

var data = {
locales: {},
formats: {
cache: {},
number: {
currency: { style: "currency", currency: "USD" },
percent: { style: "percent" }
},
date: {
short: { month: "numeric", day: "numeric", year: "2-digit" },
medium: { month: "short", day: "numeric", year: "numeric" },
long: { month: "long", day: "numeric", year: "numeric" },
full: { month: "long", day: "numeric", year: "numeric", weekday: "long" }
},
time: {
short: { hour: "numeric", minute: "numeric" },
medium: { hour: "numeric", minute: "numeric", second: "numeric" },
long: { hour: "numeric", minute: "numeric", second: "numeric", timeZoneName: "short" },
full: { hour: "numeric", minute: "numeric", second: "numeric", timeZoneName: "short" }
}
}
locales: {},
formats: {
cache: {},
number: {
currency: {
style: "currency",
currency: "USD"
},
percent: {
style: "percent"
}
},
date: {
short: {
month: "numeric",
day: "numeric",
year: "2-digit"
},
medium: {
month: "short",
day: "numeric",
year: "numeric"
},
long: {
month: "long",
day: "numeric",
year: "numeric"
},
full: {
month: "long",
day: "numeric",
year: "numeric",
weekday: "long"
}
},
time: {
short: {
hour: "numeric",
minute: "numeric"
},
medium: {
hour: "numeric",
minute: "numeric",
second: "numeric"
},
long: {
hour: "numeric",
minute: "numeric",
second: "numeric",
timeZoneName: "short"
},
full: {
hour: "numeric",
minute: "numeric",
second: "numeric",
timeZoneName: "short"
}
}
}
};
Object.keys(locales).forEach(function (locale) {
var _locales$locale = locales[locale];
var plural = _locales$locale.plural;
var ordinal = _locales$locale.ordinal;
var _locales$locale = locales[locale];
var plural = _locales$locale.plural;
var ordinal = _locales$locale.ordinal;
data.locales[locale] = {
locale: locale, plural: plural, ordinal: ordinal
};
data.locales[locale] = {
locale: locale, plural: plural, ordinal: ordinal
};
});
module.exports = data;

@@ -21,173 +21,188 @@ "use strict";

var Interpreter = (function () {
function Interpreter() {
var _ref = arguments[0] === undefined ? {} : arguments[0];
function Interpreter() {
var _ref = arguments[0] === undefined ? {} : arguments[0];
var locale = _ref.locale;
var data = _ref.data;
var formats = _ref.formats;
var cache = _ref.cache;
var locale = _ref.locale;
var data = _ref.data;
var formats = _ref.formats;
var cache = _ref.cache;
_classCallCheck(this, Interpreter);
_classCallCheck(this, Interpreter);
this.originalLocale = locale;
this.localeData = data;
this.formats = formats;
this.enableCache = "boolean" === typeof cache ? cache : true;
}
this.originalLocale = locale;
this.localeData = data;
this.formats = formats;
this.enableCache = typeof cache === "boolean" ? cache : true;
}
Interpreter.prototype.interpret = function interpret(elements) {
return this.interpretSubs(elements);
};
Interpreter.prototype.interpret = function interpret(elements) {
return this.interpretSubs(elements);
};
Interpreter.prototype.interpretSubs = function interpretSubs(elements, parent) {
var _this = this;
Interpreter.prototype.interpretSubs = function interpretSubs(elements, parent) {
var _this = this;
elements = elements.map(function (element) {
return _this.interpretElement(element, parent);
});
elements = elements.map(function (element) {
return _this.interpretElement(element, parent);
});
// optimize common case
if (1 === elements.length) {
return elements[0];
}
// optimize common case
if (elements.length === 1) {
return elements[0];
}
return function format(args) {
var message = "";
for (var e = 0, ee = elements.length; e < ee; ++e) {
message += elements[e](args);
}
return message;
};
};
return function format(args) {
var message = "";
for (var e = 0, ee = elements.length; e < ee; ++e) {
message += elements[e](args);
}
return message;
};
};
Interpreter.prototype.interpretElement = function interpretElement(element, parent) {
if ("string" === typeof element) {
return function format() {
return element;
};
}
Interpreter.prototype.interpretElement = function interpretElement(element, parent) {
if (typeof element === "string") {
return function format() {
return element;
};
}
var id = element[0],
type = element[1],
style = element[2],
offset = 0,
options = undefined;
var id = element[0];
var type = element[1];
var style = element[2];
var offset = 0;
var options = undefined;
if ("#" === id) {
id = parent[0];
type = "selectordinal" === parent[1] ? "ordinal" : "number";
offset = parent[2];
style = null;
}
if (id === "#") {
id = parent[0];
type = parent[1] === "selectordinal" ? "ordinal" : "number";
offset = parent[2];
style = null;
}
switch (type) {
case "number":
case "ordinal": // TODO: rbnf
case "spellout": // TODO: rbnf
case "duration":
// TODO: duration
return this.interpretNumber(id, offset, style);
case "date":
case "time":
return this.interpretDateTime(id, type, style);
case "plural":
case "selectordinal":
offset = element[2];
options = element[3];
return this.interpretPlural(id, type, offset, options);
case "select":
return this.interpretSelect(id, style);
default:
return this.interpretSimple(id);
}
};
switch (type) {
case "number":
case "ordinal": // TODO: rbnf
case "spellout": // TODO: rbnf
case "duration":
// TODO: duration
return this.interpretNumber(id, offset, style);
case "date":
case "time":
return this.interpretDateTime(id, type, style);
case "plural":
case "selectordinal":
offset = element[2];
options = element[3];
return this.interpretPlural(id, type, offset, options);
case "select":
return this.interpretSelect(id, style);
default:
return this.interpretSimple(id);
}
};
Interpreter.prototype.interpretNumber = function interpretNumber(id, offset) {
var style = arguments[2] === undefined ? "medium" : arguments[2];
Interpreter.prototype.interpretNumber = function interpretNumber(id, offset) {
var _this = this;
offset = offset || 0;
var locale = this.originalLocale,
formats = this.formats,
cache = formats.cache,
key = locale + ":number:" + style,
func = undefined;
if (this.enableCache && key in cache) {
func = cache[key];
} else {
func = new Intl.NumberFormat(locale, formats.number[style]).format;
if (this.enableCache) {
cache[key] = func;
}
}
return function format(args) {
return func(+args[id] - offset);
};
};
var style = arguments[2] === undefined ? "medium" : arguments[2];
Interpreter.prototype.interpretDateTime = function interpretDateTime(id, type) {
var style = arguments[2] === undefined ? "medium" : arguments[2];
offset = offset || 0;
var locale = this.originalLocale;
var formats = this.formats;
var cache = formats.cache;
var key = locale + ":number:" + style;
var func = undefined;
if (this.enableCache && key in cache) {
func = cache[key];
} else {
(function () {
var options = formats.number[style];
func = typeof Intl !== "undefined" && Intl.NumberFormat ? new Intl.NumberFormat(locale, options).format : function (arg) {
return Number(arg).toLocaleString(locale, options);
};
if (_this.enableCache) {
cache[key] = func;
}
})();
}
return function format(args) {
return func(+args[id] - offset);
};
};
var locale = this.originalLocale,
formats = this.formats,
cache = formats.cache,
key = locale + ":" + type + ":" + style,
func = undefined;
if (this.enableCache && key in cache) {
func = cache[key];
} else {
func = new Intl.DateTimeFormat(locale, formats[type][style]).format;
if (this.enableCache) {
cache[key] = func;
}
}
return function format(args) {
return func(args[id]);
};
};
Interpreter.prototype.interpretDateTime = function interpretDateTime(id, type) {
var _this = this;
Interpreter.prototype.interpretPlural = function interpretPlural(id, type, offset, children) {
var _this = this;
var style = arguments[2] === undefined ? "medium" : arguments[2];
var plural = "selectordinal" === type ? this.localeData.ordinal : this.localeData.plural,
parent = [id, type, offset /*, children*/],
options = {};
Object.keys(children).forEach(function (key) {
options[key] = _this.interpretSubs(children[key], parent);
});
return function format(args) {
var arg = +args[id],
exactSelector = "=" + arg,
keywordSelector = plural ? plural(arg - offset) : "other",
func = options[exactSelector] || options[keywordSelector] || options.other;
return func(args);
};
};
var locale = this.originalLocale;
var formats = this.formats;
var cache = formats.cache;
var key = locale + ":" + type + ":" + style;
var func = undefined;
if (this.enableCache && key in cache) {
func = cache[key];
} else {
(function () {
var options = formats[type][style];
var toLocaleString = type === "time" ? "toLocaleTimeString" : "toLocaleDateString";
func = typeof Intl !== "undefined" && Intl.DateTimeFormat ? new Intl.DateTimeFormat(locale, options).format : function (arg) {
return new Date(arg)[toLocaleString](locale, options);
};
if (_this.enableCache) {
cache[key] = func;
}
})();
}
return function format(args) {
return func(args[id]);
};
};
Interpreter.prototype.interpretSelect = function interpretSelect(id, children) {
var _this = this;
Interpreter.prototype.interpretPlural = function interpretPlural(id, type, offset, children) {
var _this = this;
var options = {};
Object.keys(children).forEach(function (key) {
options[key] = _this.interpretSubs(children[key], null);
});
return function format(args) {
var selector = args[id],
func = options[selector] || options.other;
return func(args);
};
};
var plural = type === "selectordinal" ? this.localeData.ordinal : this.localeData.plural;
var parent = [id, type, offset /*, children*/];
var options = {};
Object.keys(children).forEach(function (key) {
options[key] = _this.interpretSubs(children[key], parent);
});
return function format(args) {
var arg = +args[id];
var exactSelector = "=" + arg;
var keywordSelector = plural ? plural(arg - offset) : "other";
var func = options[exactSelector] || options[keywordSelector] || options.other;
return func(args);
};
};
Interpreter.prototype.interpretSimple = function interpretSimple(id) {
return function format(args) {
return "" + args[id];
};
};
Interpreter.prototype.interpretSelect = function interpretSelect(id, children) {
var _this = this;
Interpreter.interpret = function interpret(elements, options) {
return new Interpreter(options).interpret(elements);
};
var options = {};
Object.keys(children).forEach(function (key) {
options[key] = _this.interpretSubs(children[key], null);
});
return function format(args) {
var selector = args[id];
var func = options[selector] || options.other;
return func(args);
};
};
return Interpreter;
Interpreter.prototype.interpretSimple = function interpretSimple(id) {
return function format(args) {
return "" + args[id];
};
};
Interpreter.interpret = function interpret(elements, options) {
return new Interpreter(options).interpret(elements);
};
return Interpreter;
})();
module.exports = Interpreter;
"use strict";
var p = [function (s) {
var n = +s;
// n = 1
if (n === 1) return "one";
return "other";
var n = +s;
// n = 1
if (n === 1) return "one";
return "other";
}, function (s) {
var n = +s;
// n = 0..1
if (0 <= n && n <= 1) return "one";
return "other";
var n = +s;
// n = 0..1
if (n >= 0 && n <= 1) return "one";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
n = +s;
// i = 0 or n = 1
if (i === 0 || n === 1) return "one";
return "other";
var i = Math.floor(Math.abs(+s));
var n = +s;
// i = 0 or n = 1
if (i === 0 || n === 1) return "one";
return "other";
}, function (s) {
var n = +s;
// n = 0
if (n === 0) return "zero";
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
// n % 100 = 3..10
if (3 <= n % 100 && n % 100 <= 10) return "few";
// n % 100 = 11..99
if (11 <= n % 100 && n % 100 <= 99) return "many";
return "other";
var n = +s;
// n = 0
if (n === 0) return "zero";
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
// n % 100 = 3..10
if (n % 100 >= 3 && n % 100 <= 10) return "few";
// n % 100 = 11..99
if (n % 100 >= 11 && n % 100 <= 99) return "many";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
return "other";
}, function (s) {
var n = +s;
// n % 10 = 1 and n % 100 != 11
if (n % 10 === 1 && n % 100 !== 11) return "one";
// n % 10 = 2..4 and n % 100 != 12..14
if (2 <= n % 10 && n % 10 <= 4 && (n % 100 < 12 || 14 < n % 100)) return "few";
// n % 10 = 0 or n % 10 = 5..9 or n % 100 = 11..14
if (n % 10 === 0 || 5 <= n % 10 && n % 10 <= 9 || 11 <= n % 100 && n % 100 <= 14) return "many";
return "other";
var n = +s;
// n % 10 = 1 and n % 100 != 11
if (n % 10 === 1 && n % 100 !== 11) return "one";
// n % 10 = 2..4 and n % 100 != 12..14
if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) return "few";
// n % 10 = 0 or n % 10 = 5..9 or n % 100 = 11..14
if (n % 10 === 0 || n % 10 >= 5 && n % 10 <= 9 || n % 100 >= 11 && n % 100 <= 14) return "many";
return "other";
}, function () {
return "other";
return "other";
}, function (s) {
var n = +s;
// n % 10 = 1 and n % 100 != 11,71,91
if (n % 10 === 1 && (n % 100 !== 11 && n % 100 !== 71 && n % 100 !== 91)) return "one";
// n % 10 = 2 and n % 100 != 12,72,92
if (n % 10 === 2 && (n % 100 !== 12 && n % 100 !== 72 && n % 100 !== 92)) return "two";
// n % 10 = 3..4,9 and n % 100 != 10..19,70..79,90..99
if ((3 <= n % 10 && n % 10 <= 4 || n % 10 === 9) && ((n % 100 < 10 || 19 < n % 100) && (n % 100 < 70 || 79 < n % 100) && (n % 100 < 90 || 99 < n % 100))) return "few";
// n != 0 and n % 1000000 = 0
if (n !== 0 && n % 1000000 === 0) return "many";
return "other";
var n = +s;
// n % 10 = 1 and n % 100 != 11,71,91
if (n % 10 === 1 && (n % 100 !== 11 && n % 100 !== 71 && n % 100 !== 91)) return "one";
// n % 10 = 2 and n % 100 != 12,72,92
if (n % 10 === 2 && (n % 100 !== 12 && n % 100 !== 72 && n % 100 !== 92)) return "two";
// n % 10 = 3..4,9 and n % 100 != 10..19,70..79,90..99
if ((n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) && ((n % 100 < 10 || n % 100 > 19) && (n % 100 < 70 || n % 100 > 79) && (n % 100 < 90 || n % 100 > 99))) return "few";
// n != 0 and n % 1000000 = 0
if (n !== 0 && n % 1000000 === 0) return "many";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length,
f = +(s + ".").split(".")[1];
// v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11
if (v === 0 && i % 10 === 1 && i % 100 !== 11 || f % 10 === 1 && f % 100 !== 11) return "one";
// v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14
if (v === 0 && (2 <= i % 10 && i % 10 <= 4) && (i % 100 < 12 || 14 < i % 100) || 2 <= f % 10 && f % 10 <= 4 && (f % 100 < 12 || 14 < f % 100)) return "few";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
var f = +(s + ".").split(".")[1];
// v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11
if (v === 0 && i % 10 === 1 && i % 100 !== 11 || f % 10 === 1 && f % 100 !== 11) return "one";
// v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14
if (v === 0 && (i % 10 >= 2 && i % 10 <= 4) && (i % 100 < 12 || i % 100 > 14) || f % 10 >= 2 && f % 10 <= 4 && (f % 100 < 12 || f % 100 > 14)) return "few";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
// i = 2..4 and v = 0
if (2 <= i && i <= 4 && v === 0) return "few";
// v != 0
if (v !== 0) return "many";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
// i = 2..4 and v = 0
if (i >= 2 && i <= 4 && v === 0) return "few";
// v != 0
if (v !== 0) return "many";
return "other";
}, function (s) {
var n = +s;
// n = 0
if (n === 0) return "zero";
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
// n = 3
if (n === 3) return "few";
// n = 6
if (n === 6) return "many";
return "other";
var n = +s;
// n = 0
if (n === 0) return "zero";
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
// n = 3
if (n === 3) return "few";
// n = 6
if (n === 6) return "many";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
t = +("" + s).replace(/^[^.]*.?|0+$/g, ""),
n = +s;
// n = 1 or t != 0 and i = 0,1
if (n === 1 || t !== 0 && (i === 0 || i === 1)) return "one";
return "other";
var i = Math.floor(Math.abs(+s));
var t = +("" + s).replace(/^[^.]*.?|0+$/g, "");
var n = +s;
// n = 1 or t != 0 and i = 0,1
if (n === 1 || t !== 0 && (i === 0 || i === 1)) return "one";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length,
f = +(s + ".").split(".")[1];
// v = 0 and i % 100 = 1 or f % 100 = 1
if (v === 0 && i % 100 === 1 || f % 100 === 1) return "one";
// v = 0 and i % 100 = 2 or f % 100 = 2
if (v === 0 && i % 100 === 2 || f % 100 === 2) return "two";
// v = 0 and i % 100 = 3..4 or f % 100 = 3..4
if (v === 0 && (3 <= i % 100 && i % 100 <= 4) || 3 <= f % 100 && f % 100 <= 4) return "few";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
var f = +(s + ".").split(".")[1];
// v = 0 and i % 100 = 1 or f % 100 = 1
if (v === 0 && i % 100 === 1 || f % 100 === 1) return "one";
// v = 0 and i % 100 = 2 or f % 100 = 2
if (v === 0 && i % 100 === 2 || f % 100 === 2) return "two";
// v = 0 and i % 100 = 3..4 or f % 100 = 3..4
if (v === 0 && (i % 100 >= 3 && i % 100 <= 4) || f % 100 >= 3 && f % 100 <= 4) return "few";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s));
// i = 0,1
if (i === 0 || i === 1) return "one";
return "other";
var i = Math.floor(Math.abs(+s));
// i = 0,1
if (i === 0 || i === 1) return "one";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length,
f = +(s + ".").split(".")[1];
// v = 0 and i = 1,2,3 or v = 0 and i % 10 != 4,6,9 or v != 0 and f % 10 != 4,6,9
if (v === 0 && (i === 1 || i === 2 || i === 3) || v === 0 && (i % 10 !== 4 && i % 10 !== 6 && i % 10 !== 9) || v !== 0 && (f % 10 !== 4 && f % 10 !== 6 && f % 10 !== 9)) return "one";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
var f = +(s + ".").split(".")[1];
// v = 0 and i = 1,2,3 or v = 0 and i % 10 != 4,6,9 or v != 0 and f % 10 != 4,6,9
if (v === 0 && (i === 1 || i === 2 || i === 3) || v === 0 && (i % 10 !== 4 && i % 10 !== 6 && i % 10 !== 9) || v !== 0 && (f % 10 !== 4 && f % 10 !== 6 && f % 10 !== 9)) return "one";
return "other";
}, function (s) {
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
// n = 3..6
if (3 <= n && n <= 6) return "few";
// n = 7..10
if (7 <= n && n <= 10) return "many";
return "other";
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
// n = 3..6
if (n >= 3 && n <= 6) return "few";
// n = 7..10
if (n >= 7 && n <= 10) return "many";
return "other";
}, function (s) {
var n = +s;
// n = 1,11
if (n === 1 || n === 11) return "one";
// n = 2,12
if (n === 2 || n === 12) return "two";
// n = 3..10,13..19
if (3 <= n && n <= 10 || 13 <= n && n <= 19) return "few";
return "other";
var n = +s;
// n = 1,11
if (n === 1 || n === 11) return "one";
// n = 2,12
if (n === 2 || n === 12) return "two";
// n = 3..10,13..19
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) return "few";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length;
// v = 0 and i % 10 = 1
if (v === 0 && i % 10 === 1) return "one";
// v = 0 and i % 10 = 2
if (v === 0 && i % 10 === 2) return "two";
// v = 0 and i % 100 = 0,20,40,60,80
if (v === 0 && (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return "few";
// v != 0
if (v !== 0) return "many";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
// v = 0 and i % 10 = 1
if (v === 0 && i % 10 === 1) return "one";
// v = 0 and i % 10 = 2
if (v === 0 && i % 10 === 2) return "two";
// v = 0 and i % 100 = 0,20,40,60,80
if (v === 0 && (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return "few";
// v != 0
if (v !== 0) return "many";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length,
n = +s;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
// i = 2 and v = 0
if (i === 2 && v === 0) return "two";
// v = 0 and n != 0..10 and n % 10 = 0
if (v === 0 && (n < 0 || 10 < n) && n % 10 === 0) return "many";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
var n = +s;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
// i = 2 and v = 0
if (i === 2 && v === 0) return "two";
// v = 0 and n != 0..10 and n % 10 = 0
if (v === 0 && (n < 0 || n > 10) && n % 10 === 0) return "many";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
t = +("" + s).replace(/^[^.]*.?|0+$/g, "");
// t = 0 and i % 10 = 1 and i % 100 != 11 or t != 0
if (t === 0 && i % 10 === 1 && i % 100 !== 11 || t !== 0) return "one";
return "other";
var i = Math.floor(Math.abs(+s));
var t = +("" + s).replace(/^[^.]*.?|0+$/g, "");
// t = 0 and i % 10 = 1 and i % 100 != 11 or t != 0
if (t === 0 && i % 10 === 1 && i % 100 !== 11 || t !== 0) return "one";
return "other";
}, function (s) {
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
return "other";
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
return "other";
}, function (s) {
var n = +s;
// n = 0
if (n === 0) return "zero";
// n = 1
if (n === 1) return "one";
return "other";
var n = +s;
// n = 0
if (n === 0) return "zero";
// n = 1
if (n === 1) return "one";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
n = +s;
// n = 0
if (n === 0) return "zero";
// i = 0,1 and n != 0
if ((i === 0 || i === 1) && n !== 0) return "one";
return "other";
var i = Math.floor(Math.abs(+s));
var n = +s;
// n = 0
if (n === 0) return "zero";
// i = 0,1 and n != 0
if ((i === 0 || i === 1) && n !== 0) return "one";
return "other";
}, function (s) {
var f = +(s + ".").split(".")[1],
n = +s;
// n % 10 = 1 and n % 100 != 11..19
if (n % 10 === 1 && (n % 100 < 11 || 19 < n % 100)) return "one";
// n % 10 = 2..9 and n % 100 != 11..19
if (2 <= n % 10 && n % 10 <= 9 && (n % 100 < 11 || 19 < n % 100)) return "few";
// f != 0
if (f !== 0) return "many";
return "other";
var f = +(s + ".").split(".")[1];
var n = +s;
// n % 10 = 1 and n % 100 != 11..19
if (n % 10 === 1 && (n % 100 < 11 || n % 100 > 19)) return "one";
// n % 10 = 2..9 and n % 100 != 11..19
if (n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) return "few";
// f != 0
if (f !== 0) return "many";
return "other";
}, function (s) {
var v = (s + ".").split(".")[1].length,
f = +(s + ".").split(".")[1],
n = +s;
// n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19
if (n % 10 === 0 || 11 <= n % 100 && n % 100 <= 19 || v === 2 && (11 <= f % 100 && f % 100 <= 19)) return "zero";
// n % 10 = 1 and n % 100 != 11 or v = 2 and f % 10 = 1 and f % 100 != 11 or v != 2 and f % 10 = 1
if (n % 10 === 1 && n % 100 !== 11 || v === 2 && f % 10 === 1 && f % 100 !== 11 || v !== 2 && f % 10 === 1) return "one";
return "other";
var v = (s + ".").split(".")[1].length;
var f = +(s + ".").split(".")[1];
var n = +s;
// n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19
if (n % 10 === 0 || n % 100 >= 11 && n % 100 <= 19 || v === 2 && (f % 100 >= 11 && f % 100 <= 19)) return "zero";
// n % 10 = 1 and n % 100 != 11 or v = 2 and f % 10 = 1 and f % 100 != 11 or v != 2 and f % 10 = 1
if (n % 10 === 1 && n % 100 !== 11 || v === 2 && f % 10 === 1 && f % 100 !== 11 || v !== 2 && f % 10 === 1) return "one";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length,
f = +(s + ".").split(".")[1];
// v = 0 and i % 10 = 1 or f % 10 = 1
if (v === 0 && i % 10 === 1 || f % 10 === 1) return "one";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
var f = +(s + ".").split(".")[1];
// v = 0 and i % 10 = 1 or f % 10 = 1
if (v === 0 && i % 10 === 1 || f % 10 === 1) return "one";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length,
n = +s;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
// v != 0 or n = 0 or n != 1 and n % 100 = 1..19
if (v !== 0 || n === 0 || n !== 1 && (1 <= n % 100 && n % 100 <= 19)) return "few";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
var n = +s;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
// v != 0 or n = 0 or n != 1 and n % 100 = 1..19
if (v !== 0 || n === 0 || n !== 1 && (n % 100 >= 1 && n % 100 <= 19)) return "few";
return "other";
}, function (s) {
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 0 or n % 100 = 2..10
if (n === 0 || 2 <= n % 100 && n % 100 <= 10) return "few";
// n % 100 = 11..19
if (11 <= n % 100 && n % 100 <= 19) return "many";
return "other";
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 0 or n % 100 = 2..10
if (n === 0 || n % 100 >= 2 && n % 100 <= 10) return "few";
// n % 100 = 11..19
if (n % 100 >= 11 && n % 100 <= 19) return "many";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
// v = 0 and i % 10 = 2..4 and i % 100 != 12..14
if (v === 0 && (2 <= i % 10 && i % 10 <= 4) && (i % 100 < 12 || 14 < i % 100)) return "few";
// v = 0 and i != 1 and i % 10 = 0..1 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 12..14
if (v === 0 && i !== 1 && (0 <= i % 10 && i % 10 <= 1) || v === 0 && (5 <= i % 10 && i % 10 <= 9) || v === 0 && (12 <= i % 100 && i % 100 <= 14)) return "many";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
// i = 1 and v = 0
if (i === 1 && v === 0) return "one";
// v = 0 and i % 10 = 2..4 and i % 100 != 12..14
if (v === 0 && (i % 10 >= 2 && i % 10 <= 4) && (i % 100 < 12 || i % 100 > 14)) return "few";
// v = 0 and i != 1 and i % 10 = 0..1 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 12..14
if (v === 0 && i !== 1 && (i % 10 >= 0 && i % 10 <= 1) || v === 0 && (i % 10 >= 5 && i % 10 <= 9) || v === 0 && (i % 100 >= 12 && i % 100 <= 14)) return "many";
return "other";
}, function (s) {
var n = +s;
// n = 0..2 and n != 2
if (0 <= n && n <= 2 && n !== 2) return "one";
return "other";
var n = +s;
// n = 0..2 and n != 2
if (n >= 0 && n <= 2 && n !== 2) return "one";
return "other";
}, function (s) {
var v = (s + ".").split(".")[1].length,
n = +s;
// n = 1 and v = 0
if (n === 1 && v === 0) return "one";
return "other";
var v = (s + ".").split(".")[1].length;
var n = +s;
// n = 1 and v = 0
if (n === 1 && v === 0) return "one";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length;
// v = 0 and i % 10 = 1 and i % 100 != 11
if (v === 0 && i % 10 === 1 && i % 100 !== 11) return "one";
// v = 0 and i % 10 = 2..4 and i % 100 != 12..14
if (v === 0 && (2 <= i % 10 && i % 10 <= 4) && (i % 100 < 12 || 14 < i % 100)) return "few";
// v = 0 and i % 10 = 0 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 11..14
if (v === 0 && i % 10 === 0 || v === 0 && (5 <= i % 10 && i % 10 <= 9) || v === 0 && (11 <= i % 100 && i % 100 <= 14)) return "many";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
// v = 0 and i % 10 = 1 and i % 100 != 11
if (v === 0 && i % 10 === 1 && i % 100 !== 11) return "one";
// v = 0 and i % 10 = 2..4 and i % 100 != 12..14
if (v === 0 && (i % 10 >= 2 && i % 10 <= 4) && (i % 100 < 12 || i % 100 > 14)) return "few";
// v = 0 and i % 10 = 0 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 11..14
if (v === 0 && i % 10 === 0 || v === 0 && (i % 10 >= 5 && i % 10 <= 9) || v === 0 && (i % 100 >= 11 && i % 100 <= 14)) return "many";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
n = +s;
// i = 0 or n = 1
if (i === 0 || n === 1) return "one";
// n = 2..10
if (2 <= n && n <= 10) return "few";
return "other";
var i = Math.floor(Math.abs(+s));
var n = +s;
// i = 0 or n = 1
if (i === 0 || n === 1) return "one";
// n = 2..10
if (n >= 2 && n <= 10) return "few";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
f = +(s + ".").split(".")[1],
n = +s;
// n = 0,1 or i = 0 and f = 1
if (n === 0 || n === 1 || i === 0 && f === 1) return "one";
return "other";
var i = Math.floor(Math.abs(+s));
var f = +(s + ".").split(".")[1];
var n = +s;
// n = 0,1 or i = 0 and f = 1
if (n === 0 || n === 1 || i === 0 && f === 1) return "one";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s)),
v = (s + ".").split(".")[1].length;
// v = 0 and i % 100 = 1
if (v === 0 && i % 100 === 1) return "one";
// v = 0 and i % 100 = 2
if (v === 0 && i % 100 === 2) return "two";
// v = 0 and i % 100 = 3..4 or v != 0
if (v === 0 && (3 <= i % 100 && i % 100 <= 4) || v !== 0) return "few";
return "other";
var i = Math.floor(Math.abs(+s));
var v = (s + ".").split(".")[1].length;
// v = 0 and i % 100 = 1
if (v === 0 && i % 100 === 1) return "one";
// v = 0 and i % 100 = 2
if (v === 0 && i % 100 === 2) return "two";
// v = 0 and i % 100 = 3..4 or v != 0
if (v === 0 && (i % 100 >= 3 && i % 100 <= 4) || v !== 0) return "few";
return "other";
}, function (s) {
var n = +s;
// n = 0..1 or n = 11..99
if (0 <= n && n <= 1 || 11 <= n && n <= 99) return "one";
return "other";
var n = +s;
// n = 0..1 or n = 11..99
if (n >= 0 && n <= 1 || n >= 11 && n <= 99) return "one";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s));
// i % 10 = 1,2,5,7,8 or i % 100 = 20,50,70,80
if (i % 10 === 1 || i % 10 === 2 || i % 10 === 5 || i % 10 === 7 || i % 10 === 8 || (i % 100 === 20 || i % 100 === 50 || i % 100 === 70 || i % 100 === 80)) return "one";
// i % 10 = 3,4 or i % 1000 = 100,200,300,400,500,600,700,800,900
if (i % 10 === 3 || i % 10 === 4 || (i % 1000 === 100 || i % 1000 === 200 || i % 1000 === 300 || i % 1000 === 400 || i % 1000 === 500 || i % 1000 === 600 || i % 1000 === 700 || i % 1000 === 800 || i % 1000 === 900)) return "few";
// i = 0 or i % 10 = 6 or i % 100 = 40,60,90
if (i === 0 || i % 10 === 6 || (i % 100 === 40 || i % 100 === 60 || i % 100 === 90)) return "many";
return "other";
var i = Math.floor(Math.abs(+s));
// i % 10 = 1,2,5,7,8 or i % 100 = 20,50,70,80
if (i % 10 === 1 || i % 10 === 2 || i % 10 === 5 || i % 10 === 7 || i % 10 === 8 || (i % 100 === 20 || i % 100 === 50 || i % 100 === 70 || i % 100 === 80)) return "one";
// i % 10 = 3,4 or i % 1000 = 100,200,300,400,500,600,700,800,900
if (i % 10 === 3 || i % 10 === 4 || (i % 1000 === 100 || i % 1000 === 200 || i % 1000 === 300 || i % 1000 === 400 || i % 1000 === 500 || i % 1000 === 600 || i % 1000 === 700 || i % 1000 === 800 || i % 1000 === 900)) return "few";
// i = 0 or i % 10 = 6 or i % 100 = 40,60,90
if (i === 0 || i % 10 === 6 || (i % 100 === 40 || i % 100 === 60 || i % 100 === 90)) return "many";
return "other";
}, function (s) {
var n = +s;
// n = 1,5,7,8,9,10
if (n === 1 || n === 5 || n === 7 || n === 8 || n === 9 || n === 10) return "one";
// n = 2,3
if (n === 2 || n === 3) return "two";
// n = 4
if (n === 4) return "few";
// n = 6
if (n === 6) return "many";
return "other";
var n = +s;
// n = 1,5,7,8,9,10
if (n === 1 || n === 5 || n === 7 || n === 8 || n === 9 || n === 10) return "one";
// n = 2,3
if (n === 2 || n === 3) return "two";
// n = 4
if (n === 4) return "few";
// n = 6
if (n === 6) return "many";
return "other";
}, function (s) {
var n = +s;
// n = 1,3
if (n === 1 || n === 3) return "one";
// n = 2
if (n === 2) return "two";
// n = 4
if (n === 4) return "few";
return "other";
var n = +s;
// n = 1,3
if (n === 1 || n === 3) return "one";
// n = 2
if (n === 2) return "two";
// n = 4
if (n === 4) return "few";
return "other";
}, function (s) {
var n = +s;
// n = 0,7,8,9
if (n === 0 || n === 7 || n === 8 || n === 9) return "zero";
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
// n = 3,4
if (n === 3 || n === 4) return "few";
// n = 5,6
if (n === 5 || n === 6) return "many";
return "other";
var n = +s;
// n = 0,7,8,9
if (n === 0 || n === 7 || n === 8 || n === 9) return "zero";
// n = 1
if (n === 1) return "one";
// n = 2
if (n === 2) return "two";
// n = 3,4
if (n === 3 || n === 4) return "few";
// n = 5,6
if (n === 5 || n === 6) return "many";
return "other";
}, function (s) {
var n = +s;
// n % 10 = 1 and n % 100 != 11
if (n % 10 === 1 && n % 100 !== 11) return "one";
// n % 10 = 2 and n % 100 != 12
if (n % 10 === 2 && n % 100 !== 12) return "two";
// n % 10 = 3 and n % 100 != 13
if (n % 10 === 3 && n % 100 !== 13) return "few";
return "other";
var n = +s;
// n % 10 = 1 and n % 100 != 11
if (n % 10 === 1 && n % 100 !== 11) return "one";
// n % 10 = 2 and n % 100 != 12
if (n % 10 === 2 && n % 100 !== 12) return "two";
// n % 10 = 3 and n % 100 != 13
if (n % 10 === 3 && n % 100 !== 13) return "few";
return "other";
}, function (s) {
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 2,3
if (n === 2 || n === 3) return "two";
// n = 4
if (n === 4) return "few";
// n = 6
if (n === 6) return "many";
return "other";
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 2,3
if (n === 2 || n === 3) return "two";
// n = 4
if (n === 4) return "few";
// n = 6
if (n === 6) return "many";
return "other";
}, function (s) {
var n = +s;
// n = 1,5
if (n === 1 || n === 5) return "one";
return "other";
var n = +s;
// n = 1,5
if (n === 1 || n === 5) return "one";
return "other";
}, function (s) {
var n = +s;
// n = 11,8,80,800
if (n === 11 || n === 8 || n === 80 || n === 800) return "many";
return "other";
var n = +s;
// n = 11,8,80,800
if (n === 11 || n === 8 || n === 80 || n === 800) return "many";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s));
// i = 1
if (i === 1) return "one";
// i = 0 or i % 100 = 2..20,40,60,80
if (i === 0 || (2 <= i % 100 && i % 100 <= 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return "many";
return "other";
var i = Math.floor(Math.abs(+s));
// i = 1
if (i === 1) return "one";
// i = 0 or i % 100 = 2..20,40,60,80
if (i === 0 || (i % 100 >= 2 && i % 100 <= 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return "many";
return "other";
}, function (s) {
var n = +s;
// n % 10 = 6 or n % 10 = 9 or n % 10 = 0 and n != 0
if (n % 10 === 6 || n % 10 === 9 || n % 10 === 0 && n !== 0) return "many";
return "other";
var n = +s;
// n % 10 = 6 or n % 10 = 9 or n % 10 = 0 and n != 0
if (n % 10 === 6 || n % 10 === 9 || n % 10 === 0 && n !== 0) return "many";
return "other";
}, function (s) {
var i = Math.floor(Math.abs(+s));
// i % 10 = 1 and i % 100 != 11
if (i % 10 === 1 && i % 100 !== 11) return "one";
// i % 10 = 2 and i % 100 != 12
if (i % 10 === 2 && i % 100 !== 12) return "two";
// i % 10 = 7,8 and i % 100 != 17,18
if ((i % 10 === 7 || i % 10 === 8) && (i % 100 !== 17 && i % 100 !== 18)) return "many";
return "other";
var i = Math.floor(Math.abs(+s));
// i % 10 = 1 and i % 100 != 11
if (i % 10 === 1 && i % 100 !== 11) return "one";
// i % 10 = 2 and i % 100 != 12
if (i % 10 === 2 && i % 100 !== 12) return "two";
// i % 10 = 7,8 and i % 100 != 17,18
if ((i % 10 === 7 || i % 10 === 8) && (i % 100 !== 17 && i % 100 !== 18)) return "many";
return "other";
}, function (s) {
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 2,3
if (n === 2 || n === 3) return "two";
// n = 4
if (n === 4) return "few";
return "other";
var n = +s;
// n = 1
if (n === 1) return "one";
// n = 2,3
if (n === 2 || n === 3) return "two";
// n = 4
if (n === 4) return "few";
return "other";
}, function (s) {
var n = +s;
// n = 1..4
if (1 <= n && n <= 4) return "one";
return "other";
var n = +s;
// n = 1..4
if (n >= 1 && n <= 4) return "one";
return "other";
}, function (s) {
var n = +s;
// n = 1
if (n === 1) return "one";
// n % 10 = 4 and n % 100 != 14
if (n % 10 === 4 && n % 100 !== 14) return "many";
return "other";
var n = +s;
// n = 1
if (n === 1) return "one";
// n % 10 = 4 and n % 100 != 14
if (n % 10 === 4 && n % 100 !== 14) return "many";
return "other";
}, function (s) {
var n = +s;
// n % 10 = 1,2 and n % 100 != 11,12
if ((n % 10 === 1 || n % 10 === 2) && (n % 100 !== 11 && n % 100 !== 12)) return "one";
return "other";
var n = +s;
// n % 10 = 1,2 and n % 100 != 11,12
if ((n % 10 === 1 || n % 10 === 2) && (n % 100 !== 11 && n % 100 !== 12)) return "one";
return "other";
}, function (s) {
var n = +s;
// n % 10 = 3 and n % 100 != 13
if (n % 10 === 3 && n % 100 !== 13) return "few";
return "other";
var n = +s;
// n % 10 = 3 and n % 100 != 13
if (n % 10 === 3 && n % 100 !== 13) return "few";
return "other";
}];
module.exports = {
af: { plural: p[0], ordinal: p[6] },
ak: { plural: p[1] },
am: { plural: p[2], ordinal: p[6] },
ar: { plural: p[3], ordinal: p[6] },
asa: { plural: p[0] },
ast: { plural: p[4] },
az: { plural: p[0], ordinal: p[36] },
be: { plural: p[5] },
bem: { plural: p[0] },
bez: { plural: p[0] },
bg: { plural: p[0], ordinal: p[6] },
bh: { plural: p[1] },
bm: { plural: p[6] },
bn: { plural: p[2], ordinal: p[37] },
bo: { plural: p[6] },
br: { plural: p[7] },
brx: { plural: p[0] },
bs: { plural: p[8], ordinal: p[6] },
ca: { plural: p[4], ordinal: p[38] },
cgg: { plural: p[0] },
chr: { plural: p[0] },
ckb: { plural: p[0] },
cs: { plural: p[9], ordinal: p[6] },
cy: { plural: p[10], ordinal: p[39] },
da: { plural: p[11], ordinal: p[6] },
de: { plural: p[4], ordinal: p[6] },
dsb: { plural: p[12], ordinal: p[6] },
dv: { plural: p[0] },
dz: { plural: p[6] },
ee: { plural: p[0] },
el: { plural: p[0], ordinal: p[6] },
en: { plural: p[4], ordinal: p[40] },
eo: { plural: p[0] },
es: { plural: p[0], ordinal: p[6] },
et: { plural: p[4], ordinal: p[6] },
eu: { plural: p[0], ordinal: p[6] },
fa: { plural: p[2], ordinal: p[6] },
ff: { plural: p[13] },
fi: { plural: p[4], ordinal: p[6] },
fil: { plural: p[14], ordinal: p[0] },
fo: { plural: p[0] },
fr: { plural: p[13], ordinal: p[0] },
fur: { plural: p[0] },
fy: { plural: p[4], ordinal: p[6] },
ga: { plural: p[15] },
gd: { plural: p[16] },
gl: { plural: p[4], ordinal: p[6] },
gsw: { plural: p[0] },
gu: { plural: p[2], ordinal: p[41] },
guw: { plural: p[1] },
gv: { plural: p[17] },
ha: { plural: p[0] },
haw: { plural: p[0] },
he: { plural: p[18], ordinal: p[6] },
hi: { plural: p[2], ordinal: p[41] },
hr: { plural: p[8], ordinal: p[6] },
hsb: { plural: p[12], ordinal: p[6] },
hu: { plural: p[0], ordinal: p[42] },
hy: { plural: p[13], ordinal: p[0] },
id: { plural: p[6], ordinal: p[6] },
ig: { plural: p[6] },
ii: { plural: p[6] },
"in": { plural: p[6], ordinal: p[6] },
is: { plural: p[19], ordinal: p[6] },
it: { plural: p[4], ordinal: p[43] },
iu: { plural: p[20] },
iw: { plural: p[18], ordinal: p[6] },
ja: { plural: p[6], ordinal: p[6] },
jbo: { plural: p[6] },
jgo: { plural: p[0] },
ji: { plural: p[4] },
jmc: { plural: p[0] },
jv: { plural: p[6] },
jw: { plural: p[6] },
ka: { plural: p[0], ordinal: p[44] },
kab: { plural: p[13] },
kaj: { plural: p[0] },
kcg: { plural: p[0] },
kde: { plural: p[6] },
kea: { plural: p[6] },
kk: { plural: p[0], ordinal: p[45] },
kkj: { plural: p[0] },
kl: { plural: p[0] },
km: { plural: p[6], ordinal: p[6] },
kn: { plural: p[2], ordinal: p[6] },
ko: { plural: p[6], ordinal: p[6] },
ks: { plural: p[0] },
ksb: { plural: p[0] },
ksh: { plural: p[21] },
ku: { plural: p[0] },
kw: { plural: p[20] },
ky: { plural: p[0], ordinal: p[6] },
lag: { plural: p[22] },
lb: { plural: p[0] },
lg: { plural: p[0] },
lkt: { plural: p[6] },
ln: { plural: p[1] },
lo: { plural: p[6], ordinal: p[0] },
lt: { plural: p[23], ordinal: p[6] },
lv: { plural: p[24], ordinal: p[6] },
mas: { plural: p[0] },
mg: { plural: p[1] },
mgo: { plural: p[0] },
mk: { plural: p[25], ordinal: p[46] },
ml: { plural: p[0], ordinal: p[6] },
mn: { plural: p[0], ordinal: p[6] },
mo: { plural: p[26], ordinal: p[0] },
mr: { plural: p[2], ordinal: p[47] },
ms: { plural: p[6], ordinal: p[0] },
mt: { plural: p[27] },
my: { plural: p[6], ordinal: p[6] },
nah: { plural: p[0] },
naq: { plural: p[20] },
nb: { plural: p[0], ordinal: p[6] },
nd: { plural: p[0] },
ne: { plural: p[0], ordinal: p[48] },
nl: { plural: p[4], ordinal: p[6] },
nn: { plural: p[0] },
nnh: { plural: p[0] },
no: { plural: p[0] },
nqo: { plural: p[6] },
nr: { plural: p[0] },
nso: { plural: p[1] },
ny: { plural: p[0] },
nyn: { plural: p[0] },
om: { plural: p[0] },
or: { plural: p[0] },
os: { plural: p[0] },
pa: { plural: p[1], ordinal: p[6] },
pap: { plural: p[0] },
pl: { plural: p[28], ordinal: p[6] },
prg: { plural: p[24], ordinal: p[6] },
ps: { plural: p[0] },
pt: { plural: p[29], ordinal: p[6] },
"pt-PT": { plural: p[30] },
rm: { plural: p[0] },
ro: { plural: p[26], ordinal: p[0] },
rof: { plural: p[0] },
root: { plural: p[6], ordinal: p[6] },
ru: { plural: p[31], ordinal: p[6] },
rwk: { plural: p[0] },
sah: { plural: p[6] },
saq: { plural: p[0] },
se: { plural: p[20] },
seh: { plural: p[0] },
ses: { plural: p[6] },
sg: { plural: p[6] },
sh: { plural: p[8], ordinal: p[6] },
shi: { plural: p[32] },
si: { plural: p[33], ordinal: p[6] },
sk: { plural: p[9], ordinal: p[6] },
sl: { plural: p[34], ordinal: p[6] },
sma: { plural: p[20] },
smi: { plural: p[20] },
smj: { plural: p[20] },
smn: { plural: p[20] },
sms: { plural: p[20] },
sn: { plural: p[0] },
so: { plural: p[0] },
sq: { plural: p[0], ordinal: p[49] },
sr: { plural: p[8], ordinal: p[6] },
ss: { plural: p[0] },
ssy: { plural: p[0] },
st: { plural: p[0] },
sv: { plural: p[4], ordinal: p[50] },
sw: { plural: p[4], ordinal: p[6] },
syr: { plural: p[0] },
ta: { plural: p[0], ordinal: p[6] },
te: { plural: p[0], ordinal: p[6] },
teo: { plural: p[0] },
th: { plural: p[6], ordinal: p[6] },
ti: { plural: p[1] },
tig: { plural: p[0] },
tk: { plural: p[0] },
tl: { plural: p[14], ordinal: p[0] },
tn: { plural: p[0] },
to: { plural: p[6] },
tr: { plural: p[0], ordinal: p[6] },
ts: { plural: p[0] },
tzm: { plural: p[35] },
ug: { plural: p[0] },
uk: { plural: p[31], ordinal: p[51] },
ur: { plural: p[4], ordinal: p[6] },
uz: { plural: p[0], ordinal: p[6] },
ve: { plural: p[0] },
vi: { plural: p[6], ordinal: p[0] },
vo: { plural: p[0] },
vun: { plural: p[0] },
wa: { plural: p[1] },
wae: { plural: p[0] },
wo: { plural: p[6] },
xh: { plural: p[0] },
xog: { plural: p[0] },
yi: { plural: p[4] },
yo: { plural: p[6] },
zh: { plural: p[6], ordinal: p[6] },
zu: { plural: p[2], ordinal: p[6] }
af: { plural: p[0], ordinal: p[6] },
ak: { plural: p[1] },
am: { plural: p[2], ordinal: p[6] },
ar: { plural: p[3], ordinal: p[6] },
asa: { plural: p[0] },
ast: { plural: p[4] },
az: { plural: p[0], ordinal: p[36] },
be: { plural: p[5] },
bem: { plural: p[0] },
bez: { plural: p[0] },
bg: { plural: p[0], ordinal: p[6] },
bh: { plural: p[1] },
bm: { plural: p[6] },
bn: { plural: p[2], ordinal: p[37] },
bo: { plural: p[6] },
br: { plural: p[7] },
brx: { plural: p[0] },
bs: { plural: p[8], ordinal: p[6] },
ca: { plural: p[4], ordinal: p[38] },
cgg: { plural: p[0] },
chr: { plural: p[0] },
ckb: { plural: p[0] },
cs: { plural: p[9], ordinal: p[6] },
cy: { plural: p[10], ordinal: p[39] },
da: { plural: p[11], ordinal: p[6] },
de: { plural: p[4], ordinal: p[6] },
dsb: { plural: p[12], ordinal: p[6] },
dv: { plural: p[0] },
dz: { plural: p[6] },
ee: { plural: p[0] },
el: { plural: p[0], ordinal: p[6] },
en: { plural: p[4], ordinal: p[40] },
eo: { plural: p[0] },
es: { plural: p[0], ordinal: p[6] },
et: { plural: p[4], ordinal: p[6] },
eu: { plural: p[0], ordinal: p[6] },
fa: { plural: p[2], ordinal: p[6] },
ff: { plural: p[13] },
fi: { plural: p[4], ordinal: p[6] },
fil: { plural: p[14], ordinal: p[0] },
fo: { plural: p[0] },
fr: { plural: p[13], ordinal: p[0] },
fur: { plural: p[0] },
fy: { plural: p[4], ordinal: p[6] },
ga: { plural: p[15] },
gd: { plural: p[16] },
gl: { plural: p[4], ordinal: p[6] },
gsw: { plural: p[0] },
gu: { plural: p[2], ordinal: p[41] },
guw: { plural: p[1] },
gv: { plural: p[17] },
ha: { plural: p[0] },
haw: { plural: p[0] },
he: { plural: p[18], ordinal: p[6] },
hi: { plural: p[2], ordinal: p[41] },
hr: { plural: p[8], ordinal: p[6] },
hsb: { plural: p[12], ordinal: p[6] },
hu: { plural: p[0], ordinal: p[42] },
hy: { plural: p[13], ordinal: p[0] },
id: { plural: p[6], ordinal: p[6] },
ig: { plural: p[6] },
ii: { plural: p[6] },
"in": { plural: p[6], ordinal: p[6] },
is: { plural: p[19], ordinal: p[6] },
it: { plural: p[4], ordinal: p[43] },
iu: { plural: p[20] },
iw: { plural: p[18], ordinal: p[6] },
ja: { plural: p[6], ordinal: p[6] },
jbo: { plural: p[6] },
jgo: { plural: p[0] },
ji: { plural: p[4] },
jmc: { plural: p[0] },
jv: { plural: p[6] },
jw: { plural: p[6] },
ka: { plural: p[0], ordinal: p[44] },
kab: { plural: p[13] },
kaj: { plural: p[0] },
kcg: { plural: p[0] },
kde: { plural: p[6] },
kea: { plural: p[6] },
kk: { plural: p[0], ordinal: p[45] },
kkj: { plural: p[0] },
kl: { plural: p[0] },
km: { plural: p[6], ordinal: p[6] },
kn: { plural: p[2], ordinal: p[6] },
ko: { plural: p[6], ordinal: p[6] },
ks: { plural: p[0] },
ksb: { plural: p[0] },
ksh: { plural: p[21] },
ku: { plural: p[0] },
kw: { plural: p[20] },
ky: { plural: p[0], ordinal: p[6] },
lag: { plural: p[22] },
lb: { plural: p[0] },
lg: { plural: p[0] },
lkt: { plural: p[6] },
ln: { plural: p[1] },
lo: { plural: p[6], ordinal: p[0] },
lt: { plural: p[23], ordinal: p[6] },
lv: { plural: p[24], ordinal: p[6] },
mas: { plural: p[0] },
mg: { plural: p[1] },
mgo: { plural: p[0] },
mk: { plural: p[25], ordinal: p[46] },
ml: { plural: p[0], ordinal: p[6] },
mn: { plural: p[0], ordinal: p[6] },
mo: { plural: p[26], ordinal: p[0] },
mr: { plural: p[2], ordinal: p[47] },
ms: { plural: p[6], ordinal: p[0] },
mt: { plural: p[27] },
my: { plural: p[6], ordinal: p[6] },
nah: { plural: p[0] },
naq: { plural: p[20] },
nb: { plural: p[0], ordinal: p[6] },
nd: { plural: p[0] },
ne: { plural: p[0], ordinal: p[48] },
nl: { plural: p[4], ordinal: p[6] },
nn: { plural: p[0] },
nnh: { plural: p[0] },
no: { plural: p[0] },
nqo: { plural: p[6] },
nr: { plural: p[0] },
nso: { plural: p[1] },
ny: { plural: p[0] },
nyn: { plural: p[0] },
om: { plural: p[0] },
or: { plural: p[0] },
os: { plural: p[0] },
pa: { plural: p[1], ordinal: p[6] },
pap: { plural: p[0] },
pl: { plural: p[28], ordinal: p[6] },
prg: { plural: p[24], ordinal: p[6] },
ps: { plural: p[0] },
pt: { plural: p[29], ordinal: p[6] },
"pt-PT": { plural: p[30] },
rm: { plural: p[0] },
ro: { plural: p[26], ordinal: p[0] },
rof: { plural: p[0] },
root: { plural: p[6], ordinal: p[6] },
ru: { plural: p[31], ordinal: p[6] },
rwk: { plural: p[0] },
sah: { plural: p[6] },
saq: { plural: p[0] },
se: { plural: p[20] },
seh: { plural: p[0] },
ses: { plural: p[6] },
sg: { plural: p[6] },
sh: { plural: p[8], ordinal: p[6] },
shi: { plural: p[32] },
si: { plural: p[33], ordinal: p[6] },
sk: { plural: p[9], ordinal: p[6] },
sl: { plural: p[34], ordinal: p[6] },
sma: { plural: p[20] },
smi: { plural: p[20] },
smj: { plural: p[20] },
smn: { plural: p[20] },
sms: { plural: p[20] },
sn: { plural: p[0] },
so: { plural: p[0] },
sq: { plural: p[0], ordinal: p[49] },
sr: { plural: p[8], ordinal: p[6] },
ss: { plural: p[0] },
ssy: { plural: p[0] },
st: { plural: p[0] },
sv: { plural: p[4], ordinal: p[50] },
sw: { plural: p[4], ordinal: p[6] },
syr: { plural: p[0] },
ta: { plural: p[0], ordinal: p[6] },
te: { plural: p[0], ordinal: p[6] },
teo: { plural: p[0] },
th: { plural: p[6], ordinal: p[6] },
ti: { plural: p[1] },
tig: { plural: p[0] },
tk: { plural: p[0] },
tl: { plural: p[14], ordinal: p[0] },
tn: { plural: p[0] },
to: { plural: p[6] },
tr: { plural: p[0], ordinal: p[6] },
ts: { plural: p[0] },
tzm: { plural: p[35] },
ug: { plural: p[0] },
uk: { plural: p[31], ordinal: p[51] },
ur: { plural: p[4], ordinal: p[6] },
uz: { plural: p[0], ordinal: p[6] },
ve: { plural: p[0] },
vi: { plural: p[6], ordinal: p[0] },
vo: { plural: p[0] },
vun: { plural: p[0] },
wa: { plural: p[1] },
wae: { plural: p[0] },
wo: { plural: p[6] },
xh: { plural: p[0] },
xog: { plural: p[0] },
yi: { plural: p[4] },
yo: { plural: p[6] },
zh: { plural: p[6], ordinal: p[6] },
zu: { plural: p[2], ordinal: p[6] }
};

@@ -0,18 +1,18 @@

// "lookup" algorithm http://tools.ietf.org/html/rfc4647#section-3.4
"use strict";
// "lookup" algorithm http://tools.ietf.org/html/rfc4647#section-3.4
module.exports = lookupClosestLocale;
function lookupClosestLocale(locale, available) {
var locales = [].concat(locale || []);
for (var l = 0, ll = locales.length; l < ll; ++l) {
var current = locales[l].split("-");
while (current.length) {
if (current.join("-") in available) {
return current.join("-");
}
current.pop();
}
}
return "en";
var locales = [].concat(locale || []);
for (var l = 0, ll = locales.length; l < ll; ++l) {
var current = locales[l].split("-");
while (current.length) {
if (current.join("-") in available) {
return current.join("-");
}
current.pop();
}
}
return "en";
}

@@ -5,2 +5,6 @@ "use strict";

/**
* Intl.MessageFormat class
**/
module.exports = MessageFormat;
/*!

@@ -20,73 +24,68 @@ * Intl.MessageFormat polyfill

/**
* Intl.MessageFormat class
**/
function MessageFormat(pattern, locale) {
var options = arguments[2] === undefined ? {} : arguments[2];
var options = arguments[2] === undefined ? {} : arguments[2];
// don't use class so it can be called without new
if ("object" !== typeof this || !(this instanceof MessageFormat)) {
return new MessageFormat(pattern, locale, options);
}
// don't use class so it can be called without new
if (typeof this !== "object" || !(this instanceof MessageFormat)) {
return new MessageFormat(pattern, locale, options);
}
if ("string" !== typeof pattern) {
throw new TypeError("message pattern must be a string");
}
if (typeof pattern !== "string") {
throw new TypeError("message pattern must be a string");
}
var closest = lookupClosestLocale(locale, MessageFormat.data.locales),
data = MessageFormat.data.locales[closest],
enableCache = "cache" in options ? options.cache : true,
cache = MessageFormat.data.formats.cache,
key = closest + ":message:" + pattern,
formats = MessageFormat.data.formats,
format = undefined;
var closest = lookupClosestLocale(locale, MessageFormat.data.locales);
var data = MessageFormat.data.locales[closest];
var enableCache = "cache" in options ? options.cache : true;
var cache = MessageFormat.data.formats.cache;
var key = closest + ":message:" + pattern;
var formats = MessageFormat.data.formats;
var format = undefined;
if (enableCache && key in cache) {
format = cache[key];
} else {
format = Interpreter.interpret(Parser.parse(pattern, {
escape: options.escape
}), {
locale: locale,
data: data,
formats: formats,
cache: enableCache
});
if (enableCache) {
cache[key] = format;
}
}
if (enableCache && key in cache) {
format = cache[key];
} else {
format = Interpreter.interpret(Parser.parse(pattern, {
escape: options.escape
}), {
locale: locale,
data: data,
formats: formats,
cache: enableCache
});
if (enableCache) {
cache[key] = format;
}
}
this.resolvedOptions = function resolvedOptions() {
return data;
};
this.format = format;
this.resolvedOptions = function resolvedOptions() {
return data;
};
this.format = format;
}
Object.defineProperties(MessageFormat.prototype, {
resolvedOptions: {
configurable: true,
writable: true,
value: function resolvedOptions() {}
},
format: {
configurable: true,
writable: true,
value: function format() {}
}
resolvedOptions: {
configurable: true,
writable: true,
value: function resolvedOptions() {}
},
format: {
configurable: true,
writable: true,
value: function format() {}
}
});
Object.defineProperties(MessageFormat, {
supportedLocalesOf: {
configurable: true,
writable: true,
value: function supportedLocalesOf() {
return Object.keys(MessageFormat.data.locales);
}
},
data: {
value: data
}
});
module.exports = MessageFormat;
supportedLocalesOf: {
configurable: true,
writable: true,
value: function supportedLocalesOf() {
return Object.keys(MessageFormat.data.locales);
}
},
data: {
value: data
}
});

@@ -26,333 +26,336 @@ "use strict";

var Parser = (function () {
function Parser() {
var _ref = arguments[0] === undefined ? {} : arguments[0];
function Parser() {
var _ref = arguments[0] === undefined ? {} : arguments[0];
var escape = _ref.escape;
var escape = _ref.escape;
_classCallCheck(this, Parser);
_classCallCheck(this, Parser);
this.escape = escape || "'";
this.pattern = null;
this.index = 0;
}
this.escape = escape || "'";
this.pattern = null;
this.index = 0;
}
Parser.prototype.parse = function parse(pattern) {
this.pattern = pattern;
this.index = 0;
return this.parseMessage("message");
};
Parser.prototype.parse = function parse(pattern) {
this.pattern = pattern;
this.index = 0;
return this.parseMessage("message");
};
Parser.prototype.isDigit = function isDigit(char) {
return "0" === char || "1" === char || "2" === char || "3" === char || "4" === char || "5" === char || "6" === char || "7" === char || "8" === char || "9" === char;
};
Parser.prototype.isDigit = function isDigit(char) {
return char === "0" || char === "1" || char === "2" || char === "3" || char === "4" || char === "5" || char === "6" || char === "7" || char === "8" || char === "9";
};
Parser.prototype.isWhitespace = function isWhitespace(char) {
return " " === char || "\t" === char || "\n" === char || "\r" === char || "\f" === char || "\u000b" === char || " " === char || "\u2028" === char || "\u2029" === char;
};
Parser.prototype.isWhitespace = function isWhitespace(char) {
return char === " " || char === "\t" || char === "\n" || char === "\r" || char === "\f" || char === "\u000b" || char === " " || char === "\u2028" || char === "\u2029";
};
Parser.prototype.skipWhitespace = function skipWhitespace() {
var pattern = this.pattern,
length = pattern.length;
while (this.index < length && this.isWhitespace(pattern.charAt(this.index))) {
++this.index;
}
};
Parser.prototype.skipWhitespace = function skipWhitespace() {
var pattern = this.pattern;
var length = pattern.length;
while (this.index < length && this.isWhitespace(pattern.charAt(this.index))) {
++this.index;
}
};
Parser.prototype.parseText = function parseText(parentType) {
var text = "",
char = undefined,
pattern = this.pattern,
length = pattern.length,
isHashSpecial = "plural" === parentType || "selectordinal" === parentType,
isArgStyle = "style" === parentType,
escape = this.escape;
while (this.index < length) {
char = pattern.charAt(this.index);
if ("{" === char || "}" === char || isHashSpecial && "#" === char || isArgStyle && this.isWhitespace(char)) {
break;
} else if ("'" === escape && "'" === char) {
char = pattern.charAt(++this.index);
if ("'" === char) {
// double is always 1 '
text += char;
++this.index;
} else if ( // only when necessary
"{" === char || "}" === char || isHashSpecial && "#" === char || isArgStyle && this.isWhitespace(char)) {
text += char;
while (++this.index < length) {
char = pattern.charAt(this.index);
if ("''" === pattern.slice(this.index, this.index + 2)) {
// double is always 1 '
text += char;
++this.index;
} else if ("'" === char) {
// end of quoted
++this.index;
break;
} else {
text += char;
}
}
} else {
// lone ' is just a '
text += "'"
// already incremented
;
}
} else if (escape && escape === char) {
char = pattern.charAt(++this.index);
text += char;
++this.index;
} else {
text += char;
++this.index;
}
}
Parser.prototype.parseText = function parseText(parentType) {
var pattern = this.pattern;
var length = pattern.length;
var isHashSpecial = parentType === "plural" || parentType === "selectordinal";
var isArgStyle = parentType === "style";
var escape = this.escape;
var text = "";
var char = undefined;
while (this.index < length) {
char = pattern.charAt(this.index);
if (char === "{" || char === "}" || isHashSpecial && char === "#" || isArgStyle && this.isWhitespace(char)) {
break;
} else if (escape === "'" && char === "'") {
char = pattern.charAt(++this.index);
if (char === "'") {
// double is always 1 '
text += char;
++this.index;
} else if (
// only when necessary
char === "{" || char === "}" || isHashSpecial && char === "#" || isArgStyle && this.isWhitespace(char)) {
text += char;
while (++this.index < length) {
char = pattern.charAt(this.index);
if (pattern.slice(this.index, this.index + 2) === "''") {
// double is always 1 '
text += char;
++this.index;
} else if (char === "'") {
// end of quoted
++this.index;
break;
} else {
text += char;
}
}
} else {
// lone ' is just a '
text += "'"
// already incremented
;
}
} else if (escape && escape === char) {
char = pattern.charAt(++this.index);
text += char;
++this.index;
} else {
text += char;
++this.index;
}
}
return text;
};
return text;
};
Parser.prototype.parseArgument = function parseArgument() {
var pattern = this.pattern;
if ("#" === pattern.charAt(this.index)) {
++this.index; // move passed #
return ["#"];
}
Parser.prototype.parseArgument = function parseArgument() {
var pattern = this.pattern;
if (pattern.charAt(this.index) === "#") {
++this.index; // move passed #
return ["#"];
}
++this.index; // move passed {
var id = this.parseArgId(),
char = pattern.charAt(this.index);
if ("}" === char) {
// end argument
++this.index; // move passed }
return [id];
}
if ("," !== char) {
this.throwExpected(",");
}
++this.index; // move passed ,
++this.index; // move passed {
var id = this.parseArgId();
var char = pattern.charAt(this.index);
if (char === "}") {
// end argument
++this.index; // move passed }
return [id];
}
if (char !== ",") {
this.throwExpected(",");
}
++this.index; // move passed ,
var type = this.parseArgType();
char = pattern.charAt(this.index);
if ("}" === char) {
// end argument
if ("plural" === type || "selectordinal" === type || "select" === type) {
this.throwExpected(type + " message options");
}
++this.index; // move passed }
return [id, type];
}
if ("," !== char) {
this.throwExpected(",");
}
++this.index; // move passed ,
var type = this.parseArgType();
char = pattern.charAt(this.index);
if (char === "}") {
// end argument
if (type === "plural" || type === "selectordinal" || type === "select") {
this.throwExpected(type + " message options");
}
++this.index; // move passed }
return [id, type];
}
if (char !== ",") {
this.throwExpected(",");
}
++this.index; // move passed ,
var format = undefined,
offset = undefined;
if ("plural" === type || "selectordinal" === type) {
offset = this.parsePluralOffset();
format = this.parseSubMessages(type);
} else if ("select" === type) {
format = this.parseSubMessages(type);
} else {
format = this.parseSimpleFormat();
}
char = pattern.charAt(this.index);
if ("}" !== char) {
// not ended argument
this.throwExpected("}");
}
++this.index; // move passed
var format = undefined;
var offset = undefined;
if (type === "plural" || type === "selectordinal") {
offset = this.parsePluralOffset();
format = this.parseSubMessages(type);
} else if (type === "select") {
format = this.parseSubMessages(type);
} else {
format = this.parseSimpleFormat();
}
char = pattern.charAt(this.index);
if (char !== "}") {
// not ended argument
this.throwExpected("}");
}
++this.index; // move passed
return "plural" === type || "selectordinal" === type ? [id, type, offset, format] : [id, type, format];
};
return type === "plural" || type === "selectordinal" ? [id, type, offset, format] : [id, type, format];
};
Parser.prototype.parseArgId = function parseArgId() {
this.skipWhitespace();
var pattern = this.pattern,
length = pattern.length,
id = "";
while (this.index < length) {
var char = pattern.charAt(this.index);
if ("{" === char || "#" === char) {
this.throwExpected("argument id");
}
if ("}" === char || "," === char || this.isWhitespace(char)) {
break;
}
id += char;
++this.index;
}
if (!id) {
this.throwExpected("argument id");
}
this.skipWhitespace();
return id;
};
Parser.prototype.parseArgId = function parseArgId() {
this.skipWhitespace();
var pattern = this.pattern;
var length = pattern.length;
var id = "";
while (this.index < length) {
var char = pattern.charAt(this.index);
if (char === "{" || char === "#") {
this.throwExpected("argument id");
}
if (char === "}" || char === "," || this.isWhitespace(char)) {
break;
}
id += char;
++this.index;
}
if (!id) {
this.throwExpected("argument id");
}
this.skipWhitespace();
return id;
};
Parser.prototype.parseArgType = function parseArgType() {
this.skipWhitespace();
var pattern = this.pattern,
argType = undefined,
types = ["number", "date", "time", "ordinal", "duration", "spellout", "plural", "selectordinal", "select"];
for (var t = 0, tt = types.length; t < tt; ++t) {
var type = types[t];
if (pattern.slice(this.index, this.index + type.length) === type) {
argType = type;
this.index += type.length;
break;
}
}
if (!argType) {
this.throwExpected(types.join(", "));
}
this.skipWhitespace();
return argType;
};
Parser.prototype.parseArgType = function parseArgType() {
this.skipWhitespace();
var pattern = this.pattern;
var argType = undefined;
var types = ["number", "date", "time", "ordinal", "duration", "spellout", "plural", "selectordinal", "select"];
for (var t = 0, tt = types.length; t < tt; ++t) {
var type = types[t];
if (pattern.slice(this.index, this.index + type.length) === type) {
argType = type;
this.index += type.length;
break;
}
}
if (!argType) {
this.throwExpected(types.join(", "));
}
this.skipWhitespace();
return argType;
};
Parser.prototype.parseSimpleFormat = function parseSimpleFormat() {
this.skipWhitespace();
var style = this.parseText("style");
if (!style) {
this.throwExpected("argument style name");
}
this.skipWhitespace();
return style;
};
Parser.prototype.parseSimpleFormat = function parseSimpleFormat() {
this.skipWhitespace();
var style = this.parseText("style");
if (!style) {
this.throwExpected("argument style name");
}
this.skipWhitespace();
return style;
};
Parser.prototype.parsePluralOffset = function parsePluralOffset() {
this.skipWhitespace();
var offset = 0,
pattern = this.pattern,
length = pattern.length;
if ("offset:" === pattern.slice(this.index, this.index + 7)) {
this.index += 7; // move passed offset:
this.skipWhitespace();
var start = this.index;
while (this.index < length && this.isDigit(pattern.charAt(this.index))) {
++this.index;
}
if (start === this.index) {
this.throwExpected("offset number");
}
offset = +pattern.slice(start, this.index);
this.skipWhitespace();
}
return offset;
};
Parser.prototype.parsePluralOffset = function parsePluralOffset() {
this.skipWhitespace();
var offset = 0;
var pattern = this.pattern;
var length = pattern.length;
if (pattern.slice(this.index, this.index + 7) === "offset:") {
this.index += 7; // move passed offset:
this.skipWhitespace();
var start = this.index;
while (this.index < length && this.isDigit(pattern.charAt(this.index))) {
++this.index;
}
if (start === this.index) {
this.throwExpected("offset number");
}
offset = +pattern.slice(start, this.index);
this.skipWhitespace();
}
return offset;
};
Parser.prototype.parseSubMessages = function parseSubMessages(parentType) {
this.skipWhitespace();
var pattern = this.pattern,
length = pattern.length,
options = {},
hasSubs = false;
while (this.index < length && "}" !== pattern.charAt(this.index)) {
var selector = this.parseSelector();
this.skipWhitespace();
options[selector] = this.parseSubMessage(parentType);
hasSubs = true;
this.skipWhitespace();
}
if (!hasSubs) {
this.throwExpected(parentType + " message options");
}
if (!("other" in options)) {
// does not have an other selector
this.throwExpected(null, null, "\"other\" option must be specified in " + parentType);
}
return options;
};
Parser.prototype.parseSubMessages = function parseSubMessages(parentType) {
this.skipWhitespace();
var pattern = this.pattern;
var length = pattern.length;
var options = {};
var hasSubs = false;
while (this.index < length && pattern.charAt(this.index) !== "}") {
var selector = this.parseSelector();
this.skipWhitespace();
options[selector] = this.parseSubMessage(parentType);
hasSubs = true;
this.skipWhitespace();
}
if (!hasSubs) {
this.throwExpected(parentType + " message options");
}
if (!("other" in options)) {
// does not have an other selector
this.throwExpected(null, null, "\"other\" option must be specified in " + parentType);
}
return options;
};
Parser.prototype.parseSelector = function parseSelector() {
var selector = "",
pattern = this.pattern,
length = pattern.length;
while (this.index < length) {
var char = pattern.charAt(this.index);
if ("}" === char || "," === char) {
this.throwExpected("{");
}
if ("{" === char || this.isWhitespace(char)) {
break;
}
selector += char;
++this.index;
}
if (!selector) {
this.throwExpected("selector");
}
this.skipWhitespace();
return selector;
};
Parser.prototype.parseSelector = function parseSelector() {
var pattern = this.pattern;
var length = pattern.length;
var selector = "";
while (this.index < length) {
var char = pattern.charAt(this.index);
if (char === "}" || char === ",") {
this.throwExpected("{");
}
if (char === "{" || this.isWhitespace(char)) {
break;
}
selector += char;
++this.index;
}
if (!selector) {
this.throwExpected("selector");
}
this.skipWhitespace();
return selector;
};
Parser.prototype.parseSubMessage = function parseSubMessage(parentType) {
var char = this.pattern.charAt(this.index);
if ("{" !== char) {
this.throwExpected("{");
}
++this.index; // move passed {
var message = this.parseMessage(parentType);
char = this.pattern.charAt(this.index);
if ("}" !== char) {
this.throwExpected("}");
}
++this.index; // move passed }
return message;
};
Parser.prototype.parseSubMessage = function parseSubMessage(parentType) {
var char = this.pattern.charAt(this.index);
if (char !== "{") {
this.throwExpected("{");
}
++this.index; // move passed {
var message = this.parseMessage(parentType);
char = this.pattern.charAt(this.index);
if (char !== "}") {
this.throwExpected("}");
}
++this.index; // move passed }
return message;
};
Parser.prototype.parseMessage = function parseMessage(parentType) {
var pattern = this.pattern,
length = pattern.length,
text = undefined,
elements = [];
if (text = this.parseText(parentType)) {
elements.push(text);
}
while (this.index < length) {
if ("}" === pattern.charAt(this.index)) {
if ("message" === parentType) {
this.throwExpected();
}
break;
}
elements.push(this.parseArgument(parentType));
if (text = this.parseText(parentType)) {
elements.push(text);
}
}
return elements;
};
Parser.prototype.parseMessage = function parseMessage(parentType) {
var pattern = this.pattern;
var length = pattern.length;
var text = undefined;
var elements = [];
if (text = this.parseText(parentType)) {
elements.push(text);
}
while (this.index < length) {
if (pattern.charAt(this.index) === "}") {
if (parentType === "message") {
this.throwExpected();
}
break;
}
elements.push(this.parseArgument(parentType));
if (text = this.parseText(parentType)) {
elements.push(text);
}
}
return elements;
};
Parser.prototype.throwExpected = function throwExpected(expected, found, message) {
var pattern = this.pattern,
lines = pattern.slice(0, this.index).split(/\r?\n/),
offset = this.index,
line = lines.length,
column = lines.slice(-1)[0].length;
if (!found) {
found = this.pattern.charAt(this.index) || "end of input";
}
if (!message) {
message = this.errorMessage(expected, found);
}
message += " in " + pattern.replace(/\r?\n/g, "\n");
Parser.prototype.throwExpected = function throwExpected(expected, found, message) {
var pattern = this.pattern;
var lines = pattern.slice(0, this.index).split(/\r?\n/);
var offset = this.index;
var line = lines.length;
var column = lines.slice(-1)[0].length;
if (!found) {
found = this.pattern.charAt(this.index) || "end of input";
}
if (!message) {
message = this.errorMessage(expected, found);
}
message += " in " + pattern.replace(/\r?\n/g, "\n");
throw new SyntaxError(message, expected, found, offset, line, column);
};
throw new SyntaxError(message, expected, found, offset, line, column);
};
Parser.prototype.errorMessage = function errorMessage(expected, found) {
if (!expected) {
return "Unexpected " + found + " found";
}
return "Expected " + expected + " but " + found + " found";
};
Parser.prototype.errorMessage = function errorMessage(expected, found) {
if (!expected) {
return "Unexpected " + found + " found";
}
return "Expected " + expected + " but " + found + " found";
};
Parser.parse = function parse(pattern, options) {
return new Parser(options).parse(pattern);
};
Parser.parse = function parse(pattern, options) {
return new Parser(options).parse(pattern);
};
return Parser;
return Parser;
})();
module.exports = Parser;
/**

@@ -363,22 +366,20 @@ * Syntax Error

var SyntaxError = (function (Error) {
function SyntaxError(message, expected, found, offset, line, column) {
_classCallCheck(this, SyntaxError);
var SyntaxError = (function (_Error) {
function SyntaxError(message, expected, found, offset, line, column) {
_classCallCheck(this, SyntaxError);
this.name = "SyntaxError";
this.message = message;
this.expected = expected;
this.found = found;
this.offset = offset;
this.line = line;
this.column = column;
}
this.name = "SyntaxError";
this.message = message;
this.expected = expected;
this.found = found;
this.offset = offset;
this.line = line;
this.column = column;
}
_inherits(SyntaxError, Error);
_inherits(SyntaxError, _Error);
return SyntaxError;
return SyntaxError;
})(Error);
module.exports = Parser;
Parser.SyntaxError = SyntaxError;

@@ -24,95 +24,95 @@ "use strict";

var Printer = (function () {
function Printer() {
_classCallCheck(this, Printer);
}
function Printer() {
_classCallCheck(this, Printer);
}
Printer.prototype.print = function print(ast) {
return this.printMessage(ast);
};
Printer.prototype.print = function print(ast) {
return this.printMessage(ast);
};
Printer.prototype.printMessage = function printMessage(ast, parent) {
var _this = this;
Printer.prototype.printMessage = function printMessage(ast, parent) {
var _this = this;
return ast.map(function (element) {
return _this.printElement(element, parent);
}).join("");
};
return ast.map(function (element) {
return _this.printElement(element, parent);
}).join("");
};
Printer.prototype.printElement = function printElement(element, parent) {
if ("string" === typeof element) {
return this.printString(element, parent);
}
Printer.prototype.printElement = function printElement(element, parent) {
if (typeof element === "string") {
return this.printString(element, parent);
}
if ("#" === element[0]) {
return "#";
}
if (element[0] === "#") {
return "#";
}
var type = element[1];
switch (type) {
case "plural":
case "selectordinal":
return this.printPlural(element);
case "select":
return this.printSelect(element);
default:
return this.printArgument(element);
}
};
var type = element[1];
switch (type) {
case "plural":
case "selectordinal":
return this.printPlural(element);
case "select":
return this.printSelect(element);
default:
return this.printArgument(element);
}
};
Printer.prototype.printString = function printString(element, parent) {
var special = "plural" === parent ? /[{}#]+/g : /[{}]+/g;
return element.replace(/'/g, "''") // double apostrophe
.replace(special, "'$&'") // escape syntax
;
};
Printer.prototype.printString = function printString(element, parent) {
var special = parent === "plural" ? /[{}#]+/g : /[{}]+/g;
return element.replace(/'/g, "''") // double apostrophe
.replace(special, "'$&'") // escape syntax
;
};
Printer.prototype.printArgument = function printArgument(element) {
var key = element[0],
type = element[1],
style = element[2];
return "{ " + key + (type ? ", " + type : "") + (style ? ", " + this.printString(style) : "") + " }";
};
Printer.prototype.printArgument = function printArgument(element) {
var key = element[0];
var type = element[1];
var style = element[2];
return "{ " + key + (type ? ", " + type : "") + (style ? ", " + this.printString(style) : "") + " }";
};
Printer.prototype.printPlural = function printPlural(element) {
var key = element[0],
type = element[1],
offset = element[2],
options = element[3];
return "{ " + key + ", " + type + "," + (offset ? " offset:" + offset : "") + this.printOptions(options, "plural") + "\n}";
};
Printer.prototype.printPlural = function printPlural(element) {
var key = element[0];
var type = element[1];
var offset = element[2];
var options = element[3];
return "{ " + key + ", " + type + "," + (offset ? " offset:" + offset : "") + this.printOptions(options, "plural") + "\n}";
};
Printer.prototype.printSelect = function printSelect(element) {
var key = element[0],
type = element[1],
options = element[2];
return "{ " + key + ", " + type + "," + this.printOptions(options, "select") + "\n}";
};
Printer.prototype.printSelect = function printSelect(element) {
var key = element[0];
var type = element[1];
var options = element[2];
return "{ " + key + ", " + type + "," + this.printOptions(options, "select") + "\n}";
};
Printer.prototype.printOptions = function printOptions(options, parent) {
var _this = this;
Printer.prototype.printOptions = function printOptions(options, parent) {
var _this = this;
var keys = Object.keys(options),
padLength = Math.max.apply(Math, keys.map(function (key) {
return key.length;
}));
return keys.map(function (key) {
return "\n\t" + _this.leftSpacePad(key, padLength) + " {" + _this.printMessage(options[key], parent) + "}";
}).join("");
};
var keys = Object.keys(options);
var padLength = Math.max.apply(Math, keys.map(function (key) {
return key.length;
}));
return keys.map(function (key) {
return "\n " + _this.leftSpacePad(key, padLength) + " {" + _this.printMessage(options[key], parent) + "}";
}).join("");
};
Printer.prototype.leftSpacePad = function leftSpacePad(string, count) {
var padding = "";
for (var i = string.length; i < count; ++i) {
padding += " ";
}
return padding + string;
};
Printer.prototype.leftSpacePad = function leftSpacePad(string, count) {
var padding = "";
for (var i = string.length; i < count; ++i) {
padding += " ";
}
return padding + string;
};
Printer.print = function print(ast, options) {
return new Printer(options).print(ast);
};
Printer.print = function print(ast, options) {
return new Printer(options).print(ast);
};
return Printer;
return Printer;
})();
module.exports = Printer;
{
"name": "message-format",
"version": "1.0.0",
"version": "1.1.0",
"description": "Intl.MessageFormat polyfill supporting ICU message format",

@@ -22,12 +22,10 @@ "keywords": [

"devDependencies": {
"babel": "4.6.3",
"babel-core": "4.6.3",
"babel-loader": "4.0.0",
"babel": "4.7.16",
"babel-core": "4.7.16",
"babel-loader": "4.2.0",
"benchmark": "1.0.0",
"chai": "2.1.0",
"eslint": "0.15.1",
"chai": "2.1.2",
"intl": "0.1.4",
"intl-messageformat": "1.0.4",
"istanbul": "0.3.6",
"jscs": "1.11.3",
"intl-messageformat": "1.1.0",
"istanbul": "0.3.10",
"karma": "0.12.31",

@@ -44,4 +42,5 @@ "karma-chai": "0.1.0",

"karma-webpack": "1.5.0",
"mocha": "2.1.0",
"webpack": "1.6.0"
"mocha": "2.2.1",
"standard": "^3.2.1",
"webpack": "1.7.3"
},

@@ -51,3 +50,3 @@ "scripts": {

"cldr": "scripts/cldr.sh",
"lint": "jscs src/*.js && eslint src/*.js || true",
"lint": "standard",
"prepublish": "babel --loose=all src --out-dir lib && webpack -p",

@@ -58,2 +57,7 @@ "test": "npm run lint && npm run test-node && npm run test-browsers",

},
"standard": {
"ignore": [
"lib/**"
]
},
"repository": {

@@ -60,0 +64,0 @@ "type": "git",

module.exports = require('./lib/parser')
module.exports = require('./lib/printer')

@@ -8,2 +8,3 @@ # message-format

[![Build Status][build-image]][build]
[![JS Standard Style][style-image]][style]

@@ -25,3 +26,4 @@

The library works great with tools like browserify and webpack for use in
front-end code.
front-end code. Also check out [format-message][format-message] for an
alternative API and inlining translations at build time.

@@ -31,3 +33,4 @@ Note: message-format relies on `Intl.NumberFormat` and `Intl.DateTimeFormat`

environment missing these (like node <= 0.10, IE < 11, or Safari) you'll
need to use a [polyfill][intl].
need to use a [polyfill][intl]. If `Intl` formats are missing, it falls
back on `toLocaleString` which may be the same as `toString`.

@@ -194,6 +197,6 @@

var message = new MessageFormat('{ n, selectordinal,\
one {#st}\
two {#nd}\
few {#rd}\
other {#th}\
one {#st}\
two {#nd}\
few {#rd}\
other {#th}\
} place', 'en')

@@ -242,2 +245,5 @@ message.format({ n:102 }) // "102nd place"

[build-image]: https://img.shields.io/travis/thetalecrafter/message-format.svg
[style]: https://github.com/feross/standard
[style-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[format-message]: https://github.com/thetalecrafter/format-message
[icu-message]: http://userguide.icu-project.org/formatparse/messages

@@ -250,2 +256,1 @@ [icu-cpp]: http://icu-project.org/apiref/icu4c/classicu_1_1MessageFormat.html

[LICENSE]: https://github.com/thetalecrafter/message-format/blob/master/LICENSE-MIT

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc