{"name":"y18n","version":"3.2.0","description":"the bare-bones internationalization library used by yargs","main":"index.js","scripts":{"pretest":"standard","test":"nyc mocha","coverage":"nyc report --reporter=text-lcov | coveralls"},"repository":{"type":"git","url":"git@github.com:bcoe/y18n.git"},"keywords":["i18n","internationalization","yargs"],"author":{"name":"Ben Coe","email":"ben@npmjs.com"},"license":"ISC","bugs":{"url":"https://github.com/bcoe/y18n/issues"},"homepage":"https://github.com/bcoe/y18n","devDependencies":{"chai":"^3.3.0","coveralls":"^2.11.4","mocha":"^2.3.3","nyc":"^3.2.2","rimraf":"^2.4.3","standard":"^5.3.1"},"readme":"# y18n\n\n[![Build Status][travis-image]][travis-url]\n[![Coverage Status][coveralls-image]][coveralls-url]\n[![NPM version][npm-image]][npm-url]\n[![js-standard-style][standard-image]][standard-url]\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\nvar __ = require('y18n').__\n\nconsole.log(__('my awesome string %s', 'foo'))\n```\n\noutput:\n\n`my awesome string foo`\n\n_pluralization support:_\n\n```js\nvar __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## 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\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## License\n\nISC\n\n[travis-url]: https://travis-ci.org/bcoe/y18n\n[travis-image]: https://img.shields.io/travis/bcoe/y18n.svg\n[coveralls-url]: https://coveralls.io/github/bcoe/y18n\n[coveralls-image]: https://img.shields.io/coveralls/bcoe/y18n.svg\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","readmeFilename":"README.md","_id":"y18n@3.2.0","_shasum":"3bec64c93b730d924a6148c765757932433e34c8","_from":"https://registry.npmjs.org/y18n/-/y18n-3.2.0.tgz","_resolved":"https://registry.npmjs.org/y18n/-/y18n-3.2.0.tgz"}