{"_id":"@auioc/i18n","_rev":"3-91c89f0b376191896bb2e864a2da91e8","name":"@auioc/i18n","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@auioc/i18n","version":"1.0.0","keywords":["i18n","l10n"],"author":{"url":"https://www.auioc.org","name":"AUIOC"},"license":"MIT","_id":"@auioc/i18n@1.0.0","maintainers":[{"name":"lainio24","email":"lainio24@outlook.com"}],"contributors":[{"url":"https://www.pccstudio.com","name":"PCC-Studio"}],"homepage":"https://github.com/auioc/node-i18n","dist":{"shasum":"7b1f40edf8e1ab7f533f04c1a8dbc4233a48f0d8","tarball":"https://registry.npmjs.org/@auioc/i18n/-/i18n-1.0.0.tgz","fileCount":5,"integrity":"sha512-MTfumzEAkW3W+KxxaEOJJzhY2Tl3Ll23hMXkGIdiMbRt5hPoevi6n/d6LyUO/P+663DGeZ8Dj1cakWKZHACljQ==","signatures":[{"sig":"MEUCIAupZdNp4DniYpHpwly9RWicv2iFfU2WkbUgmD9QryePAiEAkjs5JD5yK6rLNM+VT246g2rMMMNJaKKIeeIaUImz5rw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@auioc%2fi18n@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":12538},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"lint":"eslint .","build":"rollup -c"},"_npmUser":{"name":"lainio24","email":"lainio24@outlook.com"},"repository":{"url":"https://github.com/auioc/node-i18n.git","type":"git"},"description":"Lightweight translation (i18n) module","directories":{},"_nodeVersion":"24.20.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.6.3","eslint":"^10.9.1","rollup":"^4.18.1","@eslint/js":"^10.0.1","typescript":"^6.0.3","@types/node":"^26.4.1","rollup-plugin-dts":"^6.5.1","typescript-eslint":"^8.68.0","eslint-plugin-jsdoc":"^64.2.1","eslint-plugin-import":"^2.32.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.6","@rollup/plugin-typescript":"^11.1.6","@typescript-eslint/parser":"^8.68.0","eslint-import-resolver-typescript":"^4.4.5"},"_npmOperationalInternal":{"tmp":"tmp/i18n_1.0.0_1788626095597_0.2485639764201688","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@auioc/i18n","version":"1.1.0","keywords":["i18n","l10n"],"author":{"url":"https://www.auioc.org","name":"AUIOC"},"license":"MIT","_id":"@auioc/i18n@1.1.0","maintainers":[{"name":"lainio24","email":"lainio24@outlook.com"}],"contributors":[{"url":"https://www.pccstudio.com","name":"PCC-Studio"}],"homepage":"https://github.com/auioc/node-i18n","dist":{"shasum":"17a693bf7966bab26daed0434a3edca376768b76","tarball":"https://registry.npmjs.org/@auioc/i18n/-/i18n-1.1.0.tgz","fileCount":6,"integrity":"sha512-odIznPTgtFve3gvFyWzuhXc3vWHtFvTGuPLqWu4Ywms5VNmt3KscqTCxdUDnK0gX9L+4eCTKC+xXXQpLFdq04A==","signatures":[{"sig":"MEUCIQCz+Lu6brp3i5rK7WsfzYsPKs+nYmIvwe8YnLwaJnyT+AIgQb1LmxKeSGwEYvn+eHr0YJJ1WQgdzxn4rK0dNAgywaQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCnPqLmDJ68xEW0AigqeCLJV4BAihN6zsONBBYn7B3lFgIhAM99ij2whKURrLI5t+Murs/gnIxz6HC+3csZl8BygYnq","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@auioc%2fi18n@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":17736},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","browser":"dist/browser/i18n.js","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"lint":"eslint .","build":"rollup -c"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e8ba212c-0a90-48bb-ae20-5d0650191e26"}},"repository":{"url":"https://github.com/auioc/node-i18n.git","type":"git"},"description":"Lightweight translation (i18n) module","directories":{},"_nodeVersion":"24.20.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.6.3","eslint":"^10.9.1","rollup":"^4.18.1","@eslint/js":"^10.0.1","typescript":"^6.0.3","@types/node":"^26.4.1","rollup-plugin-dts":"^6.5.1","typescript-eslint":"^8.68.0","eslint-plugin-jsdoc":"^64.2.1","eslint-plugin-import":"^2.32.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.6","@rollup/plugin-typescript":"^11.1.6","@typescript-eslint/parser":"^8.68.0","eslint-import-resolver-typescript":"^4.4.5"},"_npmOperationalInternal":{"tmp":"tmp/i18n_1.1.0_1788660547386_0.3245069426215963","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-09-05T16:34:55.450Z","modified":"2026-09-06T16:30:06.768Z","1.0.0":"2026-09-05T16:34:55.723Z","1.1.0":"2026-09-06T02:09:07.455Z"},"author":{"url":"https://www.auioc.org","name":"AUIOC"},"license":"MIT","homepage":"https://github.com/auioc/node-i18n","keywords":["i18n","l10n"],"repository":{"url":"https://github.com/auioc/node-i18n.git","type":"git"},"description":"Lightweight translation (i18n) module","contributors":[{"url":"https://www.pccstudio.com","name":"PCC-Studio"}],"maintainers":[{"email":"lainio24@outlook.com","name":"lainio24"},{"email":"wsloth56@gmail.com","name":"wakelesssloth56"}],"readme":"# @auioc/i18n\n\nLightweight (~100 lines, <1KB) translation (i18n) module\n\n[![License](https://img.shields.io/github/license/auioc/node-i18n?style=flat-square)](https://github.com/auioc/node-i18n/blob/main/LICENSE)\n[![NPM Version](https://img.shields.io/npm/v/%40auioc%2Fi18n?style=flat-square&logo=npm)](https://www.npmjs.com/package/@auioc/i18n)\n![NPM Package Size](https://img.shields.io/bundlejs/size/%40auioc/i18n?style=flat-square&label=size%20(gzip)&logo=npm)\n[![GitHub Release](https://img.shields.io/github/v/release/auioc/node-i18n?style=flat-square&logo=github)](https://github.com/auioc/node-i18n/releases)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/auioc/node-i18n/dev-build.yml?style=flat-square&logo=github&label=dev%20build)](https://github.com/auioc/node-i18n/actions/workflows/dev-build.yml)\n\n>[!NOTE]\n> This module itself does not support loading translation files from the file system, the network, etc. Handle this on your own.\n\n## Install\n\n### Node.js\n\n```sh\nnpm install @auioc/i18n\n```\n\n```typescript\nimport I18n from '@auioc/i18n';\nconst i18n = new I18n();\n```\n\n### Browser\n\n#### IIFE\n\n```html\n<script src=\"https://unpkg.com/@auioc/i18n/dist/browser/i18n.js\"></script>\n<script>\n    const i18n = new I18n();\n</script>\n```\n\n#### ECMAScript module\n\n```html\n<script type=\"module\">\n    import I18n from \"https://esm.unpkg.com/@auioc/i18n\";\n    // import I18n from \"https://unpkg.com/@auioc/i18n/dist/index.js\";\n    const i18n = new I18n();\n</script>\n```\n\n## Example\n\n```json5\n// en.json\n{\n    \"hello\": \"Hello\",\n    // Positional parameters\n    \"greeting_1\": \"Hello, {0}\",\n    // Named parameters\n    \"greeting_2\": \"Hello, {name}\",\n    // Singular or plural form\n    \"item\": { \"one\": \"Item\", \"other\": \"Items\" },\n    // The following two are equivalent\n    \"user.profile.title\": \"Profile\",\n    \"user\": { \"profile\": { \"title\": \"Profile\" } }\n}\n```\n\n```typescript\nimport I18n from '@auioc/i18n';\n\n// This module itself does not support loading translation files\n// from the file system, the network, etc.\n// Handle this on your own.\nimport en from './i18n/en.json' with { type: 'json' };\n\nconst i18n = new I18n('en', en);\n\n// Recommended: Use a convenient function object\nconst t = i18n.t();\nt('hello');                          // \"Hello\"\nt('greeting_1', 'John');             // \"Hello, John\"\nt.t('greeting_1', 'John');           // \"Hello, John\"\nt.k('greeting_2', { name: 'John' }); // \"Hello, John\"\nt.n('item', 5);                      // \"Items\"\nt.nk('item', 5);                     // \"Items\"\n\n// Use the I18n instance methods directly\ni18n.translate('hello');                         // \"Hello\"\ni18n.translate('greeting', { name: 'John' });    // \"Hello, John\"\ni18n.translatePlural('item', 1);                 // \"Item\"\ni18n.translatePlural('item', 5);                 // \"Items\"\n```\n\n## TODO\n\n- [ ] Improve docs\n\n## Credits\n\n- [AUIOC](https://www.auioc.com)\n- [PCC-Studio](https://www.pccstudio.com)\n\n## License\n\nPackage `@auioc/i18n` is licensed under the **MIT License**.\nThe full license is in the [LICENSE](/LICENSE) file.\n","readmeFilename":""}