{"name":"y18n","version":"5.0.0","description":"the bare-bones internationalization library used by yargs","exports":{"import":"./index.mjs","require":"./build/index.cjs"},"type":"module","module":"./build/lib/index.js","types":"./build/index.cjs.d.ts","keywords":["i18n","internationalization","yargs"],"homepage":"https://github.com/yargs/y18n","bugs":{"url":"https://github.com/yargs/y18n/issues"},"repository":{"type":"git","url":"git+https://github.com/yargs/y18n.git"},"license":"ISC","author":{"name":"Ben Coe","email":"bencoe@gmail.com"},"main":"index.js","scripts":{"check":"standardx '**/*.ts' '**/*.cjs' '**/*.mjs'","fix":"standardx --fix '**/*.ts' '**/*.cjs' '**/*.mjs'","pretest":"rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs","test":"c8 --reporter=text --reporter=html mocha test/*.cjs","test:esm":"c8 --reporter=text --reporter=html mocha test/esm/*.mjs","posttest":"npm run check","coverage":"c8 report --check-coverage","precompile":"rimraf build","compile":"tsc","postcompile":"npm run build:cjs","build:cjs":"rollup -c","prepare":"npm run compile"},"devDependencies":{"@types/node":"^14.6.4","@wessberg/rollup-plugin-ts":"^1.3.1","c8":"^7.3.0","chai":"^4.0.1","cross-env":"^7.0.2","gts":"^2.0.2","mocha":"^8.0.0","rimraf":"^3.0.2","rollup":"^2.26.10","standardx":"^5.0.0","ts-transform-default-export":"^1.0.2","typescript":"^4.0.0"},"engines":{"node":">=10"},"standardx":{"ignore":["build"]},"gitHead":"335133842bfa398ba34d53ae17135d2604bf3e68","_id":"y18n@5.0.0","_nodeVersion":"12.18.2","_npmVersion":"6.14.5","dist":{"integrity":"sha512-kmhFIXV4iTEaUF09bNkcjbwp0XKUKF5SGmKHusIj+oQOvZyfy3Z+UFkjJWbKhPiHVNExkEuw2UmCDBGELch4jA==","shasum":"8e056f5aa98abd2bcfa2cf2c3557c5d24ac472ae","tarball":"http://registry-npm.ywwl.com/y18n/download/y18n-5.0.0.tgz","fileCount":9,"unpackedSize":20481,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfUvl0CRA9TVsSAnZWagAAq08P/2j00Ww2HPHYfHimXaq2\nC1ALZRCtELgrQPln5l1V0XCvht9/VoxUJajrvu9ff2ARCWzDe2zJZ+5TwONN\nO0dVwfG+idNkarLfSH2iduGDUmAfNsWzeWvbZ3UMQuDffRlG/vTN3IKavLkT\nHEGORY+J4oX9xJcDwvG203JXK1/mL6dyuO0Y2sCW58PgiJVqUgokTHwTCyEq\n/QNqFrRRsudvdp2YvRbVeQO8ez0+LcHlPr2R51EDO4K5ecEtr8vbNAtiXPQu\nGxM9fx4UAx454VwmXhtp8wMeTPQgoy6AdceYjyukooFXneQekrNoHALvUthB\n9rsRyL8t16OjltILG0WZ4nkAKquY5Se4HuuA4YaTwIddPs23Ia+oIhPdvbU6\n927zIuIuIc0jQJ93DLXvYS3YO+bz+1KgSTJEaHvAZIWJujjAclyzxLlFakoc\nukZml0RW12DkaXr+8CqJdvL/hy7to6YUiKd5hG2btql09vUqo0uGjZsSVvP+\nrEM0bBQDVq+NQku35R8uhNjQXG4twsywVAuJzIl8NI6Cn2ZPCJabcHFR8T8W\nm7FSGjhQEbQKnIusZIxAaeJq+A6utAlrmhX3sBhVFvB5QLk7ZEoZVKH2j2aj\nEhyYUIrgt6TD3VSNmD9avq7J6AO6j2cx0/N4CDY4uVQqMJmGffV0KkWgVT2r\nfU4f\r\n=Aj11\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC409Ch+vFVlCAN7SPzrmb/Vezs8xBkbIkngajNZBV/MQIhAPWGMQYhId/5ABPK6f6mB4vCtY/L97Td4CEd4JRouS3/"}],"size":5422,"noattachment":false,"key":"/y18n/-/y18n-5.0.0.tgz"},"maintainers":[{"email":"ben@npmjs.com","name":"bcoe"},{"email":"andrewbgoode@gmail.com","name":"nexdrew"}],"_npmUser":{"name":"bcoe","email":"bencoe@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/y18n_5.0.0_1599273332047_0.682491923761469"},"_hasShrinkwrap":false,"readme":"# y18n\n\n[![NPM version][npm-image]][npm-url]\n[![js-standard-style][standard-image]][standard-url]\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThe bare-bones internationalization library used by yargs.\n\nInspired by [i18n](https://www.npmjs.com/package/i18n).\n\n## Examples\n\n_simple string translation:_\n\n```js\nconst __ = require('y18n')().__;\n\nconsole.log(__('my awesome string %s', 'foo'));\n```\n\noutput:\n\n`my awesome string foo`\n\n_using tagged template literals_\n\n```js\nconst __ = require('y18n')().__;\n\nconst str = 'foo';\n\nconsole.log(__`my awesome string ${str}`);\n```\n\noutput:\n\n`my awesome string foo`\n\n_pluralization support:_\n\n```js\nconst __n = require('y18n')().__n;\n\nconsole.log(__n('one fish %s', '%d fishes %s', 2, 'foo'));\n```\n\noutput:\n\n`2 fishes foo`\n\n## Deno Example\n\nAs of `v5` `y18n` supports [Deno](https://github.com/denoland/deno):\n\n```typescript\nimport y18n from \"https://deno.land/x/y18n/deno.ts\";\n\nconst __ = y18n({\n  locale: 'pirate',\n  directory: './test/locales'\n}).__\n\nconsole.info(__`Hi, ${'Ben'} ${'Coe'}!`)\n```\n\nYou will need to run with `--allow-read` to load alternative locales.\n\n## JSON Language Files\n\nThe JSON language files should be stored in a `./locales` folder.\nFile names correspond to locales, e.g., `en.json`, `pirate.json`.\n\nWhen strings are observed for the first time they will be\nadded to the JSON file corresponding to the current locale.\n\n## Methods\n\n### require('y18n')(config)\n\nCreate an instance of y18n with the config provided, options include:\n\n* `directory`: the locale directory, default `./locales`.\n* `updateFiles`: should newly observed strings be updated in file, default `true`.\n* `locale`: what locale should be used.\n* `fallbackToLanguage`: should fallback to a language-only file (e.g. `en.json`)\n  be allowed if a file matching the locale does not exist (e.g. `en_US.json`),\n  default `true`.\n\n### y18n.\\_\\_(str, arg, arg, arg)\n\nPrint a localized string, `%s` will be replaced with `arg`s.\n\nThis function can also be used as a tag for a template literal. You can use it\nlike this: <code>__&#96;hello ${'world'}&#96;</code>. This will be equivalent to\n`__('hello %s', 'world')`.\n\n### y18n.\\_\\_n(singularString, pluralString, count, arg, arg, arg)\n\nPrint a localized string with appropriate pluralization. If `%d` is provided\nin the string, the `count` will replace this placeholder.\n\n### y18n.setLocale(str)\n\nSet the current locale being used.\n\n### y18n.getLocale()\n\nWhat locale is currently being used?\n\n### y18n.updateLocale(obj)\n\nUpdate the current locale with the key value pairs in `obj`.\n\n## Supported Node.js Versions\n\nLibraries in this ecosystem make a best effort to track\n[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a\npost on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).\n\n## License\n\nISC\n\n[npm-url]: https://npmjs.org/package/y18n\n[npm-image]: https://img.shields.io/npm/v/y18n.svg\n[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n[standard-url]: https://github.com/feross/standard\n","publish_time":1599273332173,"_cnpm_publish_time":1599273332173,"dist-tags":{"engines-test":"6.0.0-alpha.0","latest":"5.0.8","latest-3":"3.2.2","latest-4":"4.0.3","next":"4.0.0"}}