{"_id":"gettext-to-messageformat","_rev":"6-2c13c8711ec6f705338a63afa059f314","name":"gettext-to-messageformat","description":"Convert gettext input (po/pot/mo files) into messageformat-compatible JSON","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"gettext-to-messageformat","version":"0.1.0","description":"Convert gettext input (po/pot/mo files) into messageformat-compatible JSON","keywords":["messageformat","gettext","po","i18n"],"main":"index.js","repository":{"type":"git","url":"git+https://github.com/eemeli/gettext-to-messageformat.git"},"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"license":"MIT","dependencies":{"gettext-parser":"^1.3.0","make-plural":"^4.0.1"},"gitHead":"b5be7ec017f71f6ee8efb59f90657f7e1e2d5d68","bugs":{"url":"https://github.com/eemeli/gettext-to-messageformat/issues"},"homepage":"https://github.com/eemeli/gettext-to-messageformat#readme","_id":"gettext-to-messageformat@0.1.0","_npmVersion":"5.4.2","_nodeVersion":"8.8.0","_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"dist":{"integrity":"sha512-ze26XazkJEZacVpP809Crpn4cWcb2Vran3SXP7sdHx9GnClzCTUdZoXXu58p1zHy2gjJx+hEj8KDlGJMHsCFzA==","shasum":"eace63aace12b814ff03dc5e6f7f46787fca8928","tarball":"https://registry.npmjs.org/gettext-to-messageformat/-/gettext-to-messageformat-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCKSpXXqO68tOP+MDbZ7I3HabpVxxcIbQF4qjZPlP697wIgQY5WnkAUTj/rn3uCglppY/0CrnF76Jmdisrx149r3pc="}]},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gettext-to-messageformat-0.1.0.tgz_1510705720229_0.12014349992386997"},"directories":{}},"0.1.1":{"name":"gettext-to-messageformat","version":"0.1.1","description":"Convert gettext input (po/pot/mo files) into messageformat-compatible JSON","keywords":["messageformat","gettext","po","i18n"],"main":"index.js","repository":{"type":"git","url":"git+https://github.com/eemeli/gettext-to-messageformat.git"},"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"license":"MIT","dependencies":{"gettext-parser":"^1.3.0","make-plural":"^4.0.1"},"gitHead":"af051cff7b0e158572d4c42e817104c996b800d0","bugs":{"url":"https://github.com/eemeli/gettext-to-messageformat/issues"},"homepage":"https://github.com/eemeli/gettext-to-messageformat#readme","_id":"gettext-to-messageformat@0.1.1","_npmVersion":"5.4.2","_nodeVersion":"8.8.0","_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"dist":{"integrity":"sha512-tIJb8fQ6J6D+0W4HJX6dnrFqbekue20ePBTm+2Hm7kDWvX5KxwETah+X0aKYy+O5WQCoYKVdACI8HzForNJQQQ==","shasum":"c48fe44dd63f71575abf167630f5c5387e51efc7","tarball":"https://registry.npmjs.org/gettext-to-messageformat/-/gettext-to-messageformat-0.1.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmBOArMo0hWkJBfOWtBaakSI6MEWN/jfU4bdA1MozFYAIgYf/3R/DBLDL64/B2AHTslgjkAF1owTprMilOl3jHHRs="}]},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gettext-to-messageformat-0.1.1.tgz_1510706159197_0.3355962762143463"},"directories":{}},"0.2.0":{"name":"gettext-to-messageformat","version":"0.2.0","description":"Convert gettext input (po/pot/mo files) into messageformat-compatible JSON","keywords":["messageformat","gettext","po","i18n"],"main":"index.js","repository":{"type":"git","url":"git+https://github.com/eemeli/gettext-to-messageformat.git"},"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"license":"MIT","dependencies":{"gettext-parser":"^1.3.0","make-plural":"^4.0.1"},"gitHead":"c6d51e8099aad1fffb70b26585fbdc32dcaa8493","bugs":{"url":"https://github.com/eemeli/gettext-to-messageformat/issues"},"homepage":"https://github.com/eemeli/gettext-to-messageformat#readme","_id":"gettext-to-messageformat@0.2.0","_npmVersion":"5.4.2","_nodeVersion":"8.8.0","_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"dist":{"integrity":"sha512-el1c6EOruI7swDPyVRP5WicMdS90RlngAdiUmjxPTmc5gJcU7BGJuWFOHQX5nnW+hYHwExAD7BOk8Vxk0ZEHxw==","shasum":"10cfceb71002b1c41a8dd5471b92fa0e84025bd7","tarball":"https://registry.npmjs.org/gettext-to-messageformat/-/gettext-to-messageformat-0.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDunVuOjwlmVs72gzhBASEb/XnP9CmmwZJ22QT3LDTyVAIhALE3gYxGgFOrsy/x0JG97EhHwcTkJG+dj7WU5jRYQYOc"}]},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gettext-to-messageformat-0.2.0.tgz_1510868114991_0.30176068958826363"},"directories":{}},"0.3.0":{"name":"gettext-to-messageformat","version":"0.3.0","description":"Convert gettext input (po/pot/mo files) into messageformat-compatible JSON","keywords":["messageformat","gettext","po","plural-forms","i18n"],"main":"index.js","repository":{"type":"git","url":"git+https://github.com/eemeli/gettext-to-messageformat.git"},"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"license":"MIT","engines":{"node":">=6.0"},"dependencies":{"gettext-parser":"^1.3.0"},"devDependencies":{"messageformat":"^1.0.2"},"gitHead":"3c8022a5fd712d5c773777764fa2126f0c5b3cf2","bugs":{"url":"https://github.com/eemeli/gettext-to-messageformat/issues"},"homepage":"https://github.com/eemeli/gettext-to-messageformat#readme","_id":"gettext-to-messageformat@0.3.0","_npmVersion":"5.4.2","_nodeVersion":"8.8.0","_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"dist":{"integrity":"sha512-HlEGFECqAavbOYJTo1I2qh8IqWetAenixaH/AbdIuNTY0easvzrPn+yYUHy63GEjx9pXoLx2nCJcDcE27LrB2g==","shasum":"6b9f9e2f554825a03463ce6669bbb94c42fc4023","tarball":"https://registry.npmjs.org/gettext-to-messageformat/-/gettext-to-messageformat-0.3.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDX/4hsiV7F6DLZkYlBKSmdi9UGwo7ysu4MWgTAiWNhlwIhAJLeiYv1FWwxLqaHMksEqRMekGDlXofUknlmcEkXbgxx"}]},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gettext-to-messageformat-0.3.0.tgz_1511005001679_0.9101363613735884"},"directories":{}},"0.3.1":{"name":"gettext-to-messageformat","version":"0.3.1","description":"Convert gettext input (po/pot/mo files) into messageformat-compatible JSON","keywords":["messageformat","gettext","po","plural-forms","i18n"],"main":"index.js","repository":{"type":"git","url":"git+https://github.com/eemeli/gettext-to-messageformat.git"},"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"license":"MIT","engines":{"node":">=6.0"},"dependencies":{"gettext-parser":"^1.4.0"},"devDependencies":{"messageformat":"^2.3.0"},"gitHead":"1327bd3f0f0560310966f1f2076f819bbf404969","bugs":{"url":"https://github.com/eemeli/gettext-to-messageformat/issues"},"homepage":"https://github.com/eemeli/gettext-to-messageformat#readme","_id":"gettext-to-messageformat@0.3.1","_nodeVersion":"12.12.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-UyqIL3Ul4NryU95Wome/qtlcuVIqgEWVIFw0zi7Lv14ACLXfaVDCbrjZ7o+3BZ7u+4NS1mP/2O1eXZoHCoas8g==","shasum":"c303ff9e31a5c781b14629b13bddb27b9ffca1f8","tarball":"https://registry.npmjs.org/gettext-to-messageformat/-/gettext-to-messageformat-0.3.1.tgz","fileCount":5,"unpackedSize":10091,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJduck5CRA9TVsSAnZWagAAKtoQAJZhBETmK5ob0PtriReN\noDxcwxRD7sAUq2YUW2kmZHlg1XgjIwzZlrqJ1TC5eH1Fe1kF8pcpxiHysfFP\nVJFyB0pHRfy74qfUkToo5xHKGFD/Yg1fze3B19KHDpKN/9MJGQc2ODt4lNms\nXAo3aK3Ir7VyA503H6JmaHcCd92djS+ZZgUa3V7eXLc64Q4Y5IhhrXHUtqn/\nAVut1sxjfFFOP8OkLK5g00NHdqLT3qXPMkPugxDwHxqbL2elqHN5r/6TM+cO\nEn0OA0b/aNOuOSKORBrAedCaLJjU0ieTZFvWJpRlNdU2Vwi10PlgQKvByMB3\nBxWEerA17r+/vy9s9/paSvMJrVocpzew6peuwSJaOgQ8o5iPc9EOqQ7H83xo\nLSZ8I5SH4DDN2nlno8KJCFZ3HdXMIn/UFF9cKSAraeQe/nHjtW4lf6FUU1OT\nlthoZGzRsAm6KE19W+y6VcpGKrmGAj+2rmwyJyrhlBQx80trAdXvW/EeajSm\nx2RHG3cDcoJsjIoyewf7DwjFUSt6D6nYn6OW6Jq/Fb3onAxr7GwDPbomHDrL\nhVZlu6BMyswVRPg6yJa0Ut/PdigebWtqWQXkbFGrm4E28kXZ66tbHxukzED5\nn9OCdlUYks3FuJdI1Czqe8q7xiQy+GMqEqa+RxmGC/hRzTLyWr+oYQc3jcNq\nxNhN\r\n=HYdT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCGtyO/47PqtL8GJTz7s/0oNm667iVXp3BxoSJKI2+lgQIgEc9c4Dq5cgNKugTU9ydDTcx64BNqqPcIEajF791TmEA="}]},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gettext-to-messageformat_0.3.1_1572456760850_0.24236281131715454"},"_hasShrinkwrap":false},"0.4.0":{"name":"gettext-to-messageformat","version":"0.4.0","description":"Convert gettext input (po/pot/mo files) into messageformat-compatible JSON","keywords":["messageformat","gettext","po","plural-forms","i18n"],"main":"index.js","repository":{"type":"git","url":"git+https://github.com/eemeli/gettext-to-messageformat.git"},"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"license":"MIT","engines":{"node":">=6.0"},"dependencies":{"gettext-parser":"^4.0.4"},"devDependencies":{"messageformat":"^2.3.0"},"gitHead":"136584a071d9c2e844fd891a283624f89d4fe604","bugs":{"url":"https://github.com/eemeli/gettext-to-messageformat/issues"},"homepage":"https://github.com/eemeli/gettext-to-messageformat#readme","_id":"gettext-to-messageformat@0.4.0","_nodeVersion":"15.11.0","_npmVersion":"7.8.0","dist":{"integrity":"sha512-EOTNC1gcMPrLpx94we2H7XuP1irMjjywO8xMHgOqoK9N/1kZhceSmfTFKmK0mqB0XcITnsCX0H1XBxUTgEVvqQ==","shasum":"603cebb356fe675d519e7ff6ea64142a54ac414d","tarball":"https://registry.npmjs.org/gettext-to-messageformat/-/gettext-to-messageformat-0.4.0.tgz","fileCount":5,"unpackedSize":10117,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgcgB2CRA9TVsSAnZWagAAeZ4P/ibM3ZccL/VLkm3BbcaO\n4nalVmSheNeD2HW5P7dfE0pFle+fWvmiDCBPG121ZAjLKiLLKjNPZzbMTyxz\nFdYwStsOf9bH8MK0QiI09P9mowDcnZQITCKVhIVNWmjJTHbokgJr5AuInhoL\nYadoPx54g6q3VQ2Dtb8+aUvRcbFrsPQFmhMd2LJ4VQ+tZKOBN21JcH0Eq6EN\n6iXcREnGTRpNSXKQ0mCqerQMY32hv/WPb/INOKG89ilF30HcHZqplPShWqFy\n9UZd8x8AVEYw90y8eeUvrOF1ICxahqxoliDqPCZDSENYt+e1n/t8ymLpN9LO\ndAhJGMZukA8CQWLBS6mpFfrdNGlN1wN2QqB5vehhkisgRP8x3TDJ8EcXG6MO\nOLaZtJulkSVcgMHJB7QocdDqT43+h8ALcZC4684iHyPznvjAAOny+9jvApNL\nqykNp+2NroML1MFl1hjYbj/ESmXgWdYM82lX+BHDFP+mNWLkCoJQd01RcCpn\nLV4oXO38r8498IId5HTm2BwMmdlmeFzsiZdf6l8tt2V16B+j9AtuLYOJVajb\n98OciU+qV0O5fpo7fPfpfu/fl97AUnSi2mCp+iiakUO7kbJIC3dRuo32c1da\nt7sUKGTrGYLPvDISzfR5SfrNjmlDcpR6qeCDmFrOtD0BHMC4jkEji/n9UqI1\nSIxe\r\n=2wXS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHpwwiH1tRBndec/jCR2/Szeuhto1xMwtfzqpxRHu2RNAiEA3GczHy9QvMhPhVfGDZIolDBxQOt2oqkz3Qsfu8n/M1M="}]},"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gettext-to-messageformat_0.4.0_1618083958354_0.9565054616435349"},"_hasShrinkwrap":false}},"readme":"# gettext-to-messageformat\n\nConverts gettext input (po/pot/mo files) into [messageformat]-compatible JSON,\nusing [gettext-parser].\n\n\n### Installation\n\n```sh\nnpm install --save gettext-to-messageformat\n```\nor\n```sh\nyarn add gettext-to-messageformat\n```\n\nIf using in an environment that does not natively support ES6 features such as\nobject destructuring and arrow functions, you'll want to use a transpiler for this.\n\n\n### Usage\n\n```js\nconst { parsePo, parseMo } = require('gettext-to-messageformat')\nconst { headers, pluralFunction, translations } = parsePo(`\n# Examples from http://pology.nedohodnik.net/doc/user/en_US/ch-poformat.html\nmsgid \"\"\nmsgstr \"\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Language: pl\\n\"\n\"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\\n\"\n\nmsgid \"Time: %1 second\"\nmsgid_plural \"Time: %1 seconds\"\nmsgstr[0] \"Czas: %1 sekunda\"\nmsgstr[1] \"Czas: %1 sekundy\"\nmsgstr[2] \"Czas: %1 sekund\"\n\nmsgid \"%1 took %2 ms to complete.\"\nmsgstr \"Trebalo je %2 ms da se %1 završi.\"\n\nmsgid \"%s took %d ms to complete.\"\nmsgstr \"Trebalo je %2$d ms da se %1$s završi.\"\n\nmsgid \"No star named %(starname)s found.\"\nmsgstr \"Nema zvezde po imenu %(starname)s.\"\n`)\n\nconst MessageFormat = require('messageformat')\nconst mf = new MessageFormat({ [headers.Language]: pluralFunction })\nconst messages = mf.compile(translations)\n\nmessages['Time: %1 second']([1])\n// 'Czas: 1 sekunda'\n\nmessages['%s took %d ms to complete.'](['TASK', 42])\n// 'Trebalo je 42 ms da se TASK završi.'\n\nmessages['No star named %(starname)s found.']({ starname: 'Chi Draconis' })\n// 'Nema zvezde po imenu Chi Draconis.'\n```\n\nFor more examples, [gettext-parser] includes a selection of `.po` and `.mo` files\nin its test fixtures.\n\n\n### API: `parseMo(input, options)` and `parsePo(input, options)`\n\nThe two functions differ only in their expectation of the input's format. `input`\nmay be a string or a Buffer; `options` is an optional set of configuration for\nthe parser, including the following fields:\n\n- `defaultCharset` (string, default `null`) – For Buffer input only, sets the\n  default charset -- otherwise UTF-8 is assumed\n\n- `forceContext` (boolean, default `false`) – If any of the gettext messages\n  define a `msgctxt`, that is used as a top-level key in the output, and all\n  messages without a context are included under the `''` empty string context.\n  If no context is set, by default this top-level key is not included unless\n  `forceContext` is set to `true`.\n\n- `pluralFunction` (function) – If your input file does not include a Plural-Forms\n  header, or if for whatever reason you'd prefer to use your own, set this to be\n  a stringifiable function that takes in a single variable, and returns the\n  appropriate pluralisation category. Following the model used internally in\n  [messageformat], the function variable should also include `cardinal` as a\n  member array of its possible categories, in the order corresponding to the\n  gettext pluralisation categories. This is relevant if you'd like to avoid the\n  `new Function` constructor otherwise used to generate `pluralFunction`, or to\n  allow for more fine-tuned categories than gettext allows, e.g. differentiating\n  between the categories of `'1.0'` and `'1'`.\n\n- `verbose` (boolean, default `false`) – If set to `true`, missing translations\n  will cause warnings.\n\nFor more options, take a look at the [source](./index.js).\n\nBoth functions return an object containing the following fields:\n\n- `headers` (object) – The raw contents of the input file's headers, with keys\n  using canonical casing.\n- `pluralFunction` (function) – An appropriate pluralisation function to use for\n  the output translations, suitable to be used directly by [messageformat]. May\n  be `null` if none was set in `options` and if the input did not include a\n  Plural-Forms header.\n- `translations` (object) – An object containing the MessageFormat strings keyed\n  by their `msgid` and if used, `msgctxt`.\n\n[messageformat]: https://messageformat.github.io/\n[gettext-parser]: https://github.com/smhg/gettext-parser\n","maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"time":{"modified":"2022-05-03T15:40:29.341Z","created":"2017-11-15T00:28:41.153Z","0.1.0":"2017-11-15T00:28:41.153Z","0.1.1":"2017-11-15T00:36:00.113Z","0.2.0":"2017-11-16T21:35:15.966Z","0.3.0":"2017-11-18T11:36:42.578Z","0.3.1":"2019-10-30T17:32:41.004Z","0.4.0":"2021-04-10T19:45:58.473Z"},"homepage":"https://github.com/eemeli/gettext-to-messageformat#readme","keywords":["messageformat","gettext","po","plural-forms","i18n"],"repository":{"type":"git","url":"git+https://github.com/eemeli/gettext-to-messageformat.git"},"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"bugs":{"url":"https://github.com/eemeli/gettext-to-messageformat/issues"},"license":"MIT","readmeFilename":"README.md"}