{"_id":"@astatum/sapphire-i18next","_rev":"2-96d7c38f3494042bc26672f66aa8c4e8","name":"@astatum/sapphire-i18next","dist-tags":{"latest":"5.0.3"},"versions":{"5.0.1":{"name":"@astatum/sapphire-i18next","version":"5.0.1","description":"Plugin for @sapphire/framework to support i18next.","author":{"name":"@sapphire"},"license":"MIT","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"},"./register":{"import":"./register.mjs","require":"./register.js","types":"./register.d.ts"}},"sideEffects":["./dist/register.js","./dist/register.mjs","./register.js","./register.mjs"],"homepage":"https://github.com/sapphiredev/plugins/tree/main/packages/i18next","scripts":{"test":"vitest run","lint":"eslint src tests --ext ts --fix","build":"tsc -b src && yarn esm:register && yarn esm:default","esm:register":"gen-esm-wrapper dist/register.js dist/register.mjs","esm:default":"gen-esm-wrapper dist/index.js dist/index.mjs","docs":"typedoc-json-parser","prepack":"yarn build","bump":"cliff-jumper","check-update":"cliff-jumper --dry-run"},"dependencies":{"@sapphire/utilities":"^3.11.0","@skyra/i18next-backend":"^2.0.2","chokidar":"^3.5.3","i18next":"^22.4.13","tslib":"^2.5.0"},"repository":{"type":"git","url":"git+https://github.com/sapphiredev/plugins.git","directory":"packages/i18next"},"engines":{"node":">=v14","npm":">=7"},"keywords":["sapphiredev","plugin","bot","typescript","ts","yarn","discord","sapphire","i18next","i18n"],"bugs":{"url":"https://github.com/sapphiredev/plugins/issues"},"publishConfig":{"access":"public"},"devDependencies":{"@favware/cliff-jumper":"^2.0.0","gen-esm-wrapper":"^1.1.3","typedoc":"^0.23.28","typedoc-json-parser":"^7.2.0","typescript":"^4.9.5"},"gitHead":"2680409da422db298af52814d9954dfff80de0c2","_id":"@astatum/sapphire-i18next@5.0.1","_nodeVersion":"19.8.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-7FPOjw2HmjZ7fyEI5it0j6iKRjz2lRk/GqGKEMLmXNic+wMIKnCXiq2AC2pL0ftK9ijGdH99p8dyUEQqKm5FGw==","shasum":"b95b52f0f603cd10a668cc416d396a6df2ec5322","tarball":"https://registry.npmjs.org/@astatum/sapphire-i18next/-/sapphire-i18next-5.0.1.tgz","fileCount":27,"unpackedSize":67767,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWlplEjL8zOGdqTltNuPTXjXnWY4QPW/MgFBTZBHAU5wIhALduaZgsn/8n4IZFW4q/jh+ktu086lpDESj5Q3J98bjQ"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIZoKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo4Gg//a4bp0qbN9Dt3Dwn3MxZPt8/oSsecM/a2U4xSgdIdtj9jLHSZ\r\nIM/SWfAW3LpZ5oNXga76DflsD0Rmvb9X7pxoCchAIvCZzSKYImfOW4Xh1VsM\r\nTx7dHI0zYnF53cyelA5Ov5+phLrFRa/D3646Do48iO9OZYiQRcMwdGAOjM3J\r\ngrQqxwVfTbvyT6mrK/7uALTzH1EL99whgzF3ob2uvlUtFmTYUOYslTEQ3fLG\r\ndOcJRLpkWf1XrUbOAueMW9YbH4WDDlaOO3RIYcD6qYBDRhGlm/qAaoIeeo1n\r\nINzagDmMqZP783ia20zJD/FdRzHZYZTyL+j6CMJJUSPZ2hFkkL3hQHXUaORx\r\niVsg7pTE6nEFziy/upmVhDb/s7EBquV3kWZUvF9t+5Vy+KLmQR56vO/k5+Xs\r\n51IXHjxM8VlL0F4ToaAQDZmVY4mYm/9/NOcZMZqukHE//pgWnoTULJgt3V/a\r\nSM5xu0M7fion9LvzPthdCYYAPRwd15eGPYOBtgOSNzBV++aPH0OKDe0M5VWb\r\ncKlKXSdQOHwM941J/iQHs9crXVzmaKOdKhZv9me3TilxGuRDRzAcApdMAC1J\r\nGKLXKV0GPxAh9ffXa1tpDl3k5PmzoT80/P5bsmLCffH5ak7vbKnmyUbeJBR9\r\n4jQPlwvmGSjgDwpfnB1/r0CXZHpKkgCtxPQ=\r\n=n05F\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"handerfall","email":"clashroyaletms@gmail.com"},"directories":{},"maintainers":[{"name":"handerfall","email":"clashroyaletms@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sapphire-i18next_5.0.1_1679923721863_0.753074176796011"},"_hasShrinkwrap":false},"5.0.2":{"name":"@astatum/sapphire-i18next","version":"5.0.2","description":"Plugin for @sapphire/framework to support i18next.","author":{"name":"@sapphire"},"license":"MIT","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"},"./register":{"import":"./register.mjs","require":"./register.js","types":"./register.d.ts"}},"sideEffects":["./dist/register.js","./dist/register.mjs","./register.js","./register.mjs"],"homepage":"https://github.com/sapphiredev/plugins/tree/main/packages/i18next","scripts":{"test":"vitest run","lint":"eslint src tests --ext ts --fix","build":"tsc -b src && yarn esm:register && yarn esm:default","esm:register":"gen-esm-wrapper dist/register.js dist/register.mjs","esm:default":"gen-esm-wrapper dist/index.js dist/index.mjs","docs":"typedoc-json-parser","prepack":"yarn build","bump":"cliff-jumper","check-update":"cliff-jumper --dry-run"},"dependencies":{"@sapphire/utilities":"^3.11.0","@skyra/i18next-backend":"^2.0.2","chokidar":"^3.5.3","i18next":"^22.4.13","tslib":"^2.5.0"},"repository":{"type":"git","url":"git+https://github.com/sapphiredev/plugins.git","directory":"packages/i18next"},"engines":{"node":">=v14","npm":">=7"},"keywords":["sapphiredev","plugin","bot","typescript","ts","yarn","discord","sapphire","i18next","i18n"],"bugs":{"url":"https://github.com/sapphiredev/plugins/issues"},"publishConfig":{"access":"public"},"devDependencies":{"@favware/cliff-jumper":"^2.0.0","gen-esm-wrapper":"^1.1.3","typedoc":"^0.23.28","typedoc-json-parser":"^7.2.0","typescript":"^4.9.5"},"gitHead":"2680409da422db298af52814d9954dfff80de0c2","_id":"@astatum/sapphire-i18next@5.0.2","_nodeVersion":"19.8.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-M9RgNU6J0+eelwJleQJ3okWjyI5k8kqo0ZzBmKunmSQzFTTrJSr68gb3FY/ukKyC0wbdUL9b1MX8xJtqc8Yilg==","shasum":"16654a1d8e973fc508ed58fe5ddea3076277401c","tarball":"https://registry.npmjs.org/@astatum/sapphire-i18next/-/sapphire-i18next-5.0.2.tgz","fileCount":27,"unpackedSize":67757,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCvikDtCZ95P4mxn6ElbhXZa2159cQ0vSLlLRi7Q8bolwIgS5BSUA54Q1MAtHjzs/W1e49KKuHizulSLG5WHBWdHvA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIaYhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpbrA/+PDBcPoFiJCdDUNrH/SqdSZBjLwaG1A1dJoYGURfdvN6hNPhm\r\niY5GcM3quBTirhyoKi9TMymup+dNeXtftKVxgPC2Cay5w1vwjbBy0B8BP3QE\r\nqtM9GfCohON06kCCt2GGsI3tThrr7pNyVZySXKbxUCxGLjJK/QghS6jomPPJ\r\nPZ0kpnh8gO4IWFH8DfYual3J82SDJOLPq+inML0vDPRE7B5zbPbugSkn3fm9\r\nAzXY+fNIo/TOAPQ8arNqd/C8lyE2scxsVQR/LPibJDFEZZgYzEBcZtVq8yrr\r\nKjFA6krtNNah8yNdVLdTSkMhXXYJXiXKy9KcPSZemgLfZnUKHMKgDwAbgPMC\r\nJeK9w2TRfwsVkwKIKfOnrh1h67XOFjpX4CCG32g3tIWJUrKabExxWZppYvEo\r\nvdO5gfcZ4ZiDzNTY8x67XOrzZ2DHTRezm/0ljDuJQj7g9UHDaMz9Ogis6yZo\r\nSXCppqAwQ7NRpE8vHiZYJcQMLi5RvIYYWU/zff2SJCRz+7H1Ertw3SU3+g1D\r\nuowEGMXu5oBL2yCWm2GlYZ8yFx08E+oS8z7BQQ1Vf/D2G3mpM+JVpdufX6pg\r\nspSDBDTgCDk0/Ny5EB38gFoTBEirTCLr8k6MD5QVUm3j+2FohdZ6z2PXNiq9\r\nEOwiyDhFV+lzXzQ5/KHu6B1bysyELMJc8lU=\r\n=6Zi9\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"handerfall","email":"clashroyaletms@gmail.com"},"directories":{},"maintainers":[{"name":"handerfall","email":"clashroyaletms@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sapphire-i18next_5.0.2_1679926817245_0.3747357454153484"},"_hasShrinkwrap":false},"5.0.3":{"name":"@astatum/sapphire-i18next","version":"5.0.3","description":"Plugin for @sapphire/framework to support i18next.","author":{"name":"@sapphire"},"license":"MIT","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"},"./register":{"import":"./register.mjs","require":"./register.js","types":"./register.d.ts"}},"sideEffects":["./dist/register.js","./dist/register.mjs","./register.js","./register.mjs"],"homepage":"https://github.com/sapphiredev/plugins/tree/main/packages/i18next","scripts":{"test":"vitest run","lint":"eslint src tests --ext ts --fix","build":"tsc -b src && yarn esm:register && yarn esm:default","esm:register":"gen-esm-wrapper dist/register.js dist/register.mjs","esm:default":"gen-esm-wrapper dist/index.js dist/index.mjs","docs":"typedoc-json-parser","prepack":"yarn build","bump":"cliff-jumper","check-update":"cliff-jumper --dry-run"},"dependencies":{"@sapphire/utilities":"^3.11.0","@skyra/i18next-backend":"^2.0.2","chokidar":"^3.5.3","i18next":"^22.4.13","tslib":"^2.5.0"},"repository":{"type":"git","url":"git+https://github.com/sapphiredev/plugins.git","directory":"packages/i18next"},"engines":{"node":">=v14","npm":">=7"},"keywords":["sapphiredev","plugin","bot","typescript","ts","yarn","discord","sapphire","i18next","i18n"],"bugs":{"url":"https://github.com/sapphiredev/plugins/issues"},"publishConfig":{"access":"public"},"devDependencies":{"@favware/cliff-jumper":"^2.0.0","gen-esm-wrapper":"^1.1.3","typedoc":"^0.23.28","typedoc-json-parser":"^7.2.0","typescript":"^4.9.5"},"gitHead":"2680409da422db298af52814d9954dfff80de0c2","_id":"@astatum/sapphire-i18next@5.0.3","_nodeVersion":"19.8.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-Wbm2XM5o4Wh7fJsf2IDXbN7ObmnVtp586re9rxWUxi1Tstef+RuTPkIq8pCk/XZ4eO6TRgTQxIT2ajmUghKRDw==","shasum":"16de332e8eb04439c190e2f4e570e138f293ef47","tarball":"https://registry.npmjs.org/@astatum/sapphire-i18next/-/sapphire-i18next-5.0.3.tgz","fileCount":27,"unpackedSize":67733,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2Ygd7nLQI+34XIJ/NXejANRH9Xt858WEQBkjBUaATPwIhANs8hUZJzzUZKAnCAQWsou71/8s4hGlSdsq8j/jaQYam"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIab0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqNbg/8DaJwORZp2UEX0AvtzGSC10cRlr8UKLtLonME6QRALS0JeuU0\r\nmLbCVW94GcAEPDSMqzGpYWrce0yud+QsOGhwKtCV4oPuF65+eTeiu/GVa+9f\r\nayImyDDay+Gt7drgB+xjtxyO18ebSJFtAkkVkevjCRThxzB+H6NvOkK+aLoz\r\nHZfPObMt5eFcGlXralrex0ABXgzSHCQu6Qrb5lPg5Z9OOaYFOvnEEKKcx7ke\r\n+SXKKjYBgEe+Be4f/OJY2ZA8rlC8lpPS1ulp8J3SVf3Sfb5wRLSwqeoU/vpl\r\nG+QIV0yUFo/MtyYqoTi/QcpHoifLH+OrQ3N4WvDq67/n6D38Vd9BrRQoKo7A\r\nI1XkL6i5lh135X4cInXUIaWVm7sJw6X/Amp3IPiFFdo07620en14GX6IBh3E\r\ne5l4VBH6PSIsXIke18KG8pSy/TIFp6BoxbNrWwq66djY0UL3S5SdarE9Bfd/\r\nFHePxpBFjLOGAtxp7oExxOacwK3yAejWnSbG4b/Homjxdxk74MsN6d+RsX+2\r\n3WT/Xw/kFUT5NcbpT5pny1ojt/knhHzs8H/CAcBh0PKIjl5q5U+/EG5jK1qi\r\nF7TIq+8Rml9/zxgJ57DUo8hbqZqYBiiN4LYtliUXCzRVZYd9Aj220vTMyFJ7\r\nAGyt9mGKNwUQ0h0eI35ZCfilSYcr2fpdLK0=\r\n=a8dY\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"handerfall","email":"clashroyaletms@gmail.com"},"directories":{},"maintainers":[{"name":"handerfall","email":"clashroyaletms@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sapphire-i18next_5.0.3_1679927027999_0.7337614043828751"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-27T13:28:41.787Z","5.0.1":"2023-03-27T13:28:42.041Z","modified":"2023-03-27T14:23:48.372Z","5.0.2":"2023-03-27T14:20:17.487Z","5.0.3":"2023-03-27T14:23:48.184Z"},"maintainers":[{"name":"handerfall","email":"clashroyaletms@gmail.com"}],"description":"Plugin for @sapphire/framework to support i18next.","homepage":"https://github.com/sapphiredev/plugins/tree/main/packages/i18next","keywords":["sapphiredev","plugin","bot","typescript","ts","yarn","discord","sapphire","i18next","i18n"],"repository":{"type":"git","url":"git+https://github.com/sapphiredev/plugins.git","directory":"packages/i18next"},"author":{"name":"@sapphire"},"bugs":{"url":"https://github.com/sapphiredev/plugins/issues"},"license":"MIT","readme":"<div align=\"center\">\n\n![Sapphire Logo](https://cdn.skyra.pw/gh-assets/sapphire-banner.png)\n\n# @sapphire/plugin-i18next\n\n**Plugin for <a href=\"https://github.com/sapphiredev/framework\">@sapphire/framework</a> to support i18next based internationalization.**\n\n[![GitHub](https://img.shields.io/github/license/sapphiredev/plugins)](https://github.com/sapphiredev/plugins/blob/main/LICENSE.md)\n[![codecov](https://codecov.io/gh/sapphiredev/plugins/branch/main/graph/badge.svg?token=QWL8FB16BR)](https://codecov.io/gh/sapphiredev/plugins)\n[![npm bundle size](https://img.shields.io/bundlephobia/min/@sapphire/plugin-in17n?logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@sapphire/plugin-in17n)\n[![npm](https://img.shields.io/npm/v/@sapphire/plugin-in17n?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@sapphire/plugin-in17n)\n\n</div>\n\n## Description\n\nAn implementation of i18next's [filesystem backend] for Sapphire. It allows you to use a JSON-based `languages` directory to add internationalization for your bot using `SapphireClient`'s `fetchLanguage` hook and a custom message extension, adding features such as `sendTranslated` and `resolveKey`.\n\n[filesystem backend]: https://github.com/i18next/i18next-fs-backend\n\n## Features\n\n-   Fully ready for TypeScript!\n-   Includes ESM ready entrypoint\n-   Framework agnostic\n-   Includes convenience register for discord.js\n\n## Installation\n\n`@sapphire/plugin-i18next` depends on the following packages. Be sure to install these along with this package!\n\n-   [`@sapphire/framework`](https://www.npmjs.com/package/@sapphire/framework)\n-   [`discord.js`](https://www.npmjs.com/package/discord.js)\n\nYou can use the following command to install this package, or replace `npm install` with your package manager of choice.\n\n```sh\nnpm install @sapphire/plugin-i18next @sapphire/framework discord.js\n```\n\n---\n\n## Usage\n\nThis registers the methods and options necessary for message translations in the Sapphire client.\n\n```typescript\n// Main bot file\n// Be sure to register the plugin before instantiating the client.\nimport '@sapphire/plugin-i18next/register';\n```\n\nThe basic structure of a translation file is as follows:\n\n```jsonc\n// languages/en-US/commands/ping.json\n{\n\t\"success\": \"Pong!\",\n\t\"success_with_args\": \"Pong! Took me {{latency}}ms to reply\"\n}\n```\n\nThe `resolveKey` function can be used anywhere to get translated text by its key. In this example, it is used in a method to send a message.\n\n```typescript\nimport { resolveKey } from '@sapphire/plugin-i18next';\nimport { Command } from '@sapphire/framework';\nimport type { Message } from 'discord.js';\n\nexport class PingCommand extends Command {\n\tpublic constructor(context: Command.Context, options: Command.Options) {\n\t\tsuper(context, {\n\t\t\t...options,\n\t\t\tdescription: 'ping pong'\n\t\t});\n\t}\n\n\tpublic async messageRun(message: Message) {\n\t\tawait message.channel.send(await resolveKey('commands/ping:success'));\n\t}\n}\n```\n\n`sendLocalized` will send translated text resolved from a key to a specified channel.\n\n```typescript\nimport { sendLocalized } from '@sapphire/plugin-i18next';\nimport { Command } from '@sapphire/framework';\n\nimport type { Message } from 'discord.js';\n\nexport class PingCommand extends Command {\n\tpublic constructor(context: Command.Context, options: Command.Options) {\n\t\tsuper(context, {\n\t\t\t...options,\n\t\t\tdescription: 'ping pong'\n\t\t});\n\t}\n\n\tpublic async messageRun(message: Message) {\n\t\tawait sendLocalized(message, 'commands/ping:success');\n\t}\n}\n```\n\n`editLocalized` edits a message, replacing its content with translated text resolved from its key.\n\n```typescript\nimport { editLocalized } from '@sapphire/plugin-i18next';\nimport { Command } from '@sapphire/framework';\n\nimport type { Message } from 'discord.js';\n\nexport class PingCommand extends Command {\n\tpublic constructor(context: Command.Context, options: Command.Options) {\n\t\tsuper(context, {\n\t\t\t...options,\n\t\t\tdescription: 'ping pong'\n\t\t});\n\t}\n\n\tpublic async messageRun(message: Message) {\n\t\tawait editLocalized(message, 'commands/ping:success_args', { latency: ws.ping });\n\t}\n}\n```\n\n`fetchLanguage` returns the guild-specific language that the client is using.\n\n```typescript\nimport { fetchLanguage } from '@sapphire/plugin-i18next';\nimport { Command } from '@sapphire/framework';\n\nimport type { Message } from 'discord.js';\n\nexport class PingCommand extends Command {\n\tpublic constructor(context: Command.Context, options: Command.Options) {\n\t\tsuper(context, {\n\t\t\t...options,\n\t\t\tdescription: 'ping pong'\n\t\t});\n\t}\n\n\tpublic async messageRun(message: Message) {\n\t\treturn message.channel.send(await fetchLanguage(message));\n\t\t// ===> en-US\n\t}\n}\n```\n\n## Buy us some doughnuts\n\nSapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!\n\nWe accept donations through Open Collective, Ko-fi, Paypal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.\n\n|   Donate With   |                       Address                       |\n| :-------------: | :-------------------------------------------------: |\n| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) |\n|      Ko-fi      |      [Click Here](https://sapphirejs.dev/kofi)      |\n|     Patreon     |    [Click Here](https://sapphirejs.dev/patreon)     |\n|     PayPal      |     [Click Here](https://sapphirejs.dev/paypal)     |\n\n## Contributors\n\nPlease make sure to read the [Contributing Guide][contributing] before making a pull request.\n\nThank you to all the people who already contributed to Sapphire!\n\n<a href=\"https://github.com/sapphiredev/plugins/graphs/contributors\">\n  <img src=\"https://contrib.rocks/image?repo=sapphiredev/plugins\" />\n</a>\n\n[contributing]: https://github.com/sapphiredev/.github/blob/main/.github/CONTRIBUTING.md\n","readmeFilename":"README.md"}