{"name":"hexo-i18n","version":"2.0.0","keywords":["hexo","i18n","localization"],"author":{"url":"https://zespia.tw","name":"Tommy Chen","email":"tommy351@gmail.com"},"license":"MIT","_id":"hexo-i18n@2.0.0","maintainers":[{"name":"ertrzyiks","email":"mateusz.derks@gmail.com"},{"name":"abnerchou","email":"hi@abnerchou.me"},{"name":"tommy351","email":"tommy351@gmail.com"},{"name":"hexobot","email":"hexojs@gmail.com"},{"name":"jlhwung","email":"i@jhuang.me"},{"name":"tomap","email":"piartt@gmail.com"},{"name":"curben","email":"bushedge@protonmail.com"},{"name":"yoshinorin","email":"yoshinorin.net@outlook.com"}],"homepage":"https://hexo.io/","bugs":{"url":"https://github.com/hexojs/hexo-i18n/issues"},"dist":{"shasum":"ec7abc160ffef202524f3ff8076b85d5701c447b","tarball":"http://registry-npm.ywwl.com/hexo-i18n/download/hexo-i18n-2.0.0.tgz","fileCount":6,"integrity":"sha512-dkUXecEtChaQMdTHN4WR13c8GwKqjbSOZPJS9qDqV6Ebnb77Wa/nQzWFckhP0dCps3a9lUQBd8hYGOMbOosiQQ==","signatures":[{"sig":"MEYCIQDBXJ36v28Yw5zB3VAayBmZEnoI9OgtZzo1cZqC07p/vQIhAKV424gd6KH8l0oDUDDEtIieBuET71/2s+qewO4JX6s2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11176,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjajhYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrdeQ//bkns2KY9PkAapsEtoTaFNAPQc+JjQv2y2nB6BkJR5ZSRDlUI\r\nLtzv1xo2M90KPNnNjNuub/+3iNIF/eIDIScdu7xBek0GmZQlDO/Qn8uR7toq\r\ntaO49fca/GP6H2ZmuDysirVpW/OfWx/V4qfijYQE98QCeX0qL42o9om7l+L8\r\nhyHqMZ3v0hf2ek66U+TkinF9LCzjMN9rdThX5Ul3rlBtp5cDQRXjbRXebzGO\r\nb2XfH1QIu2+MgN3ByWjb74exfDdm689ur9X62W8eE5NyejH4pPuHeKT42WJH\r\n2QpYZdd6r2wMJFWRVEIv2t2Oy1lvj3V+sMwYENBdj4TXRgvZwPxuh7fIEb0B\r\nHMFrkT/u536T3QuCDmPNpuHjyDQGbSw4YaHC51FEljxzvmdzQwav0iFHJFRv\r\nRhFXFspTIKnEPn+O1PDFqplnC9f8PEgHZDhf/PeFC8TSEz6CQkcWXPOBleCV\r\neCJHsrmCjmV7yBHURJetioEh7RGvVeqSJ7S0EWI3z1JCm4zPVgH+UgNwYjDi\r\nC1Bw0LR0DsPwLDvWLwQ1kbZWH/XG2xJawD0wWS1xZ8vetYaegKmFOTr6SbW2\r\nM+F/aCfuhNnuOmnKdwdShuZDeV8OO8kFAH3LGB4jkGHYqzX+FrpwEQ6DPquR\r\nybG9UBt37NQgHn6r4BsHJKgiBe1CtXMuBBs=\r\n=DtOs\r\n-----END PGP SIGNATURE-----\r\n","size":3954,"noattachment":false,"key":"/hexo-i18n/-/hexo-i18n-2.0.0.tgz"},"main":"dist/i18n.js","types":"./dist/i18n.d.ts","engines":{"node":">=14"},"gitHead":"0226fa86fcf094e11945f5081e284a9009ea9665","scripts":{"test":"mocha test/index.js --require ts-node/register","build":"tsc -b","clean":"tsc -b --clean","eslint":"eslint .","pretest":"npm run clean && npm run build","test-cov":"c8 --reporter=lcovonly npm run test","prepublish ":"npm run clean && npm run build"},"_npmUser":{"name":"yoshinorin","email":"yoshinorin.net@outlook.com"},"repository":{"url":"git+https://github.com/hexojs/hexo-i18n.git","type":"git"},"_npmVersion":"8.4.0","description":"i18n module for Hexo.","directories":{"lib":"./lib"},"_nodeVersion":"16.16.0","dependencies":{"sprintf-js":"^1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.12.0","chai":"^4.3.6","mocha":"^10.1.0","eslint":"^8.26.0","ts-node":"^10.9.1","typescript":"^4.8.4","@types/node":"^18.11.8","@types/sprintf-js":"^1.1.2","eslint-config-hexo":"^5.0.0","@typescript-eslint/parser":"^5.41.0","@typescript-eslint/eslint-plugin":"^5.41.0"},"_npmOperationalInternal":{"tmp":"tmp/hexo-i18n_2.0.0_1667905624491_0.674277795254161","host":"s3://npm-registry-packages"},"readme":"# hexo-i18n\n\n[![Build Status](https://github.com/hexojs/hexo-i18n/workflows/Tester/badge.svg)](https://github.com/hexojs/hexo-i18n/actions?query=workflow%3ATester)\n[![NPM version](https://badge.fury.io/js/hexo-i18n.svg)](https://www.npmjs.com/package/hexo-i18n)\n[![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-i18n.svg)](https://coveralls.io/r/hexojs/hexo-i18n?branch=master)\n\ni18n module for [Hexo].\n\n## Installation\n\n``` bash\n$ npm install hexo-i18n --save\n```\n\n## Usage\n\n### Example\n\n``` js\nvar i18n = new require('hexo-i18n')({\n  languages: ['zh-TW', 'en']\n});\n\ni18n.set('en', {\n  ok: 'OK',\n  name: 'My name is %1$s %2$s.',\n  index: {\n    title: 'Home'\n  },\n  video: {\n    zero: 'No videos',\n    one: 'A video',\n    other: '%d videos'\n  }\n});\n\ni18n.set('zh-TW', {\n  name: '我的名字是 %2$s %1$s。',\n  index: {\n    title: '首頁'\n  },\n  video: {\n    zero: '沒有影片',\n    one: '一部影片',\n    other: '%d 部影片'\n  }\n});\n\nvar __ = i18n.__();\nvar _p = i18n._p();\n\n__('ok') // OK\n__('index.title') // 首頁\n__('name', '大呆', '王') // 我的名字是王大呆\n_p('video', 0) // 沒有影片\n_p('video', 1) // 一部影片\n_p('video', 10) // 10 部影片\n```\n\n### new i18n([options])\n\nCreates a new i18n instance.\n\nOption | Description | Default\n--- | --- | ---\n`languages` | Default languages. It can be an array or a string | `default`\n\n### i18n.get([lang]) → Object\n\nReturns a set of localization data. `lang` can be an array or a string, or the default language defined in constructor if not set. This method will build the data in order of languages.\n\n### i18n.set(lang, data)\n\nLoads localization data.\n\n### i18n.remove(lang)\n\nUnloads localization data.\n\n### i18n.list()\n\nLists loaded languages.\n\n### i18n.__() → Function(key, arg...)\n\nReturns a function for localization.\n\n### i18n._p() → Function(key, count, ...)\n\nThis method is similar to `i18n.__`, but it returns pluralized string based on the second parameter. For example:\n\n``` js\n_p('video', 0) = __('video.zero', 0)\n_p('video', 1) = __('video.one', 1)\n_p('video', 10) = __('video.other', 10)\n```\n\n## License\n\nMIT\n\n[Hexo]: https://hexo.io/","publish_time":1667905624653,"_cnpm_publish_time":1667905624653,"dist-tags":{"latest":"2.0.0"}}