{"bugs":{"url":"https://github.com/yargs/y18n/issues"},"dist":{"shasum":"c504495ba9b59230dd60226d1dd89c3c0a1b745e","tarball":"https://registry.npmjs.org/y18n/-/y18n-4.0.2.tgz","fileCount":9,"integrity":"sha512-DnBDwcL54b5xWMM/7RfFg4xs5amYxq2ot49aUfLjQSAracXkGvlZq0txzqr3Pa6Q0ayuCxBcwTzrPUScKY0O8w==","signatures":[{"sig":"MEUCIHNRSpQmiqU2CH1vd8F3M5fbFSaK3PWHPEqw0ItgRrv3AiEAqXJON/ZV+luaoLjsSNd4VerwEeUSTEjVLZcbR9mpbT8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgbQ6gCRA9TVsSAnZWagAA9gMQAIB0Hp9P+JtCe+iYpU4n\neIVvRlgeZvPz/sX32aXQO70RE8oKJal4i3lECi9iA2gWeb1MFHC0iiwQWxmM\ne73ERJ1PPWOEuaozP9I+HGkx+y8IaLeMl0/Hk75hDTkWlY8IY6awoDwVj7/c\nY3d/A/+442k+oOM2HdN8WSN7dbjRiwMp3/0JxqQY+o1njWbUBy77cExXfDOM\nbkwLxPO/El/QzfctyDj2YKHpvdNcBOzaDRKN6vH5V6slV8TfjX+yNyewqjQz\nvS1pONXgRb7Yff8qatzfW1Uts85cQ1kCv7Opt47wcbNOBmcq2vKhysuTyp4P\nHsx7AKV9NudVTsa2vkd4R0w7IfQgdn8V31mENkPEFsUdb7IAGU8TaJJUAl1k\nFrEzU9KAiO6xok1EMq01WLUWny1ATAL6hVJc/gimIKk0ob2FOYff3WdC4iHE\nLantYcxGvpXpK8ks0OEeKtQw1tSwk+zn6n7NAqzrCM4JEm++raM0qn3IqUf0\ntzSeCLGyAUvG2O7kwWHSOYXx9CguvWZCXudHE/hizyU7+ciSL+7pX8bLrsG2\nikcAOGJXjzWD9zCfqnwy3XIc+Vkub7FQITeeF+gaAdjcgTHLv0pjrhpWC+ie\nvOrB+0bbu1c44c3GBuxIwhSeUiRtXYCPDT4VgBJknuowgKH7t3GcEw0J+Sgi\nXpV1\r\n=q3dj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./build/index.cjs","name":"y18n","type":"module","author":{"name":"Ben Coe","email":"bencoe@gmail.com"},"module":"./build/lib/index.js","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","engines":{"node":">=10"},"exports":{".":[{"import":"./index.mjs","require":"./build/index.cjs"},"./build/index.cjs"]},"gitHead":"bcfdd05cf8405593cd3261e25fde4976efd8672f","license":"ISC","scripts":{"fix":"standardx --fix '**/*.ts' '**/*.cjs' '**/*.mjs'","test":"c8 --reporter=text --reporter=html mocha test/*.cjs","check":"standardx '**/*.ts' '**/*.cjs' '**/*.mjs'","compile":"tsc","prepare":"npm run compile","pretest":"rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs","coverage":"c8 report --check-coverage","posttest":"npm run check","test:esm":"c8 --reporter=text --reporter=html mocha test/esm/*.mjs","build:cjs":"rollup -c","precompile":"rimraf build","postcompile":"npm run build:cjs"},"_npmUser":{"name":"oss-bot","email":"bencoe+oss-bot@gmail.com"},"homepage":"https://github.com/yargs/y18n","keywords":["i18n","internationalization","yargs"],"standardx":{"ignore":["build"]},"repository":{"url":"git+https://github.com/yargs/y18n.git","type":"git"},"_npmVersion":"6.14.11","description":"the bare-bones internationalization library used by yargs","directories":{},"maintainers":[{"name":"bcoe","email":"bencoe@gmail.com"},{"name":"nexdrew","email":"andrewbgoode@gmail.com"},{"name":"oss-bot","email":"bencoe+oss-bot@gmail.com"}],"_nodeVersion":"10.24.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"c8":"^7.3.0","gts":"^3.0.0","chai":"^4.0.1","mocha":"^8.0.0","rimraf":"^3.0.2","rollup":"^2.26.10","cross-env":"^7.0.2","standardx":"^5.0.0","typescript":"^4.0.0","@types/node":"^14.6.4","@wessberg/rollup-plugin-ts":"^1.3.1","ts-transform-default-export":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/y18n_4.0.2_1617759904116_0.11983796019170101","host":"s3://npm-registry-packages"},"_id":"y18n@4.0.2","version":"4.0.2"}