{"_id":"@autoglot/next","_rev":"2-28e4af65811b1231ad6cdf5ce94bf7d4","name":"@autoglot/next","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.3":{"name":"@autoglot/next","version":"0.1.3","keywords":["next","nextjs","i18n","translation","localization"],"license":"MIT","_id":"@autoglot/next@0.1.3","maintainers":[{"name":"xzebra","email":"zebrv.apps@gmail.com"}],"dist":{"shasum":"7dbfaa435b7a802c6237846113892007893fda26","tarball":"https://registry.npmjs.org/@autoglot/next/-/next-0.1.3.tgz","fileCount":8,"integrity":"sha512-kpUI2qcKTl3JxigpO07d2RpdbU+0Xy6KnGjOA1gJbYS7GnEUTXniM6ZnaxWqVIZUsjScCWAYxgzuVmk6PuLorw==","signatures":[{"sig":"MEQCICjpNxRn0htZyCwBuFRpa2y+AIKAMzUEX9rmSZBElbFbAiAFw1cg09jchDDyB6sGnJ8USV8rXKGRLsj75WdvIcsLFA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11611},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"gitHead":"9f7da0ed5b7d9b55001521161390aeb6cd5bbea7","scripts":{"build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"xzebra","email":"zebrv.apps@gmail.com"},"_npmVersion":"10.9.4","description":"Automatic i18n translation for Next.js builds","directories":{},"_nodeVersion":"22.22.0","dependencies":{"@autoglot/cli":">= 0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"next":">=13","typescript":"^5.7.0","@types/node":"^22.0.0"},"peerDependencies":{"next":">=13"},"_npmOperationalInternal":{"tmp":"tmp/next_0.1.3_1771797493291_0.4277660174740221","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"_id":"@autoglot/next@0.1.5","bugs":{"url":"https://github.com/autoglot/next/issues"},"dist":{"shasum":"98c3e5a8b0dd432942bf948416904e7e61668c8f","tarball":"https://registry.npmjs.org/@autoglot/next/-/next-0.1.5.tgz","fileCount":8,"integrity":"sha512-TuHuIeEkeOE8rLIinj00py/Wyquz5RiPesgaGGoiXT6oyGYpmoEDcgoR6Pb3lL3N2HZ7Xva5f0eyK5vQNR2jew==","signatures":[{"sig":"MEUCIFOCQ8wn/l9twC74awLKwvhYUOjn+rFbunmxpL1rAe0gAiEA+tFKsObMz+CLY7P+WmJDXtWjMmQQ2XQfar+tFfmUUzI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCk7u6cH3yCw1VxJBH8lhlhYGNtXvXGHbntUzEdFbXcswIgPm3e7voDzRfEj7MO3u7J5TyGFFXlG9xe43c3t7qLGr4="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@autoglot%2fnext@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":11707},"main":"./dist/index.js","name":"@autoglot/next","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"gitHead":"f43ddbc8ef0fae5e062296a3cc7850e300cee492","license":"MIT","scripts":{"build":"tsc","typecheck":"tsc --noEmit"},"version":"0.1.5","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:2221c62d-3644-4821-90b8-0961b50ffca4"}},"homepage":"https://github.com/autoglot/next#readme","keywords":["next","nextjs","i18n","translation","localization"],"repository":{"url":"git+https://github.com/autoglot/next.git","type":"git"},"_npmVersion":"11.17.0","description":"Automatic i18n translation for Next.js builds","directories":{},"maintainers":[{"name":"xzebra","email":"zebrv.apps@gmail.com"}],"_nodeVersion":"24.19.0","dependencies":{"@autoglot/cli":">= 0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"next":">=13","typescript":"^5.7.0","@types/node":"^22.0.0"},"peerDependencies":{"next":">=13"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/next_0.1.5_1787421046241_0.041216560701703875"}}},"time":{"created":"2026-02-22T21:58:13.208Z","modified":"2026-08-22T17:50:46.751Z","0.1.3":"2026-02-22T21:58:13.432Z","0.1.5":"2026-08-22T17:50:46.353Z"},"license":"MIT","keywords":["next","nextjs","i18n","translation","localization"],"description":"Automatic i18n translation for Next.js builds","maintainers":[{"name":"xzebra","email":"zebrv.apps@gmail.com"}],"readme":"# @autoglot/next\n\nAutomatic i18n translation for Next.js. Wraps your Next.js config so translations run after every production build — no manual step required.\n\nWorks with both **webpack** and **Turbopack**.\n\n## Quick start\n\n```bash\nnpm install @autoglot/next\n```\n\n```javascript\n// next.config.mjs\nimport { withAutoglot } from '@autoglot/next';\n\nexport default withAutoglot({\n  source: 'src/locales/en.json',\n  lang: ['es', 'fr', 'de'],\n})({\n  // your existing next config\n});\n```\n\nSet your API key:\n\n```bash\nexport AUTOGLOT_API_KEY=your_key_here\n```\n\nRun `next build` and translations appear alongside your source file.\n\n## Setup\n\n1. Sign up at [autoglot.app](https://autoglot.app)\n2. Go to [dashboard / API keys](https://autoglot.app/dashboard/api-keys) and create a key\n3. Add `AUTOGLOT_API_KEY` to your environment (`.env.local`, CI secrets, etc.)\n4. Install the packages:\n\n```bash\nnpm install @autoglot/next\n```\n\n## Configuration\n\n`withAutoglot(options)` takes an options object and returns a function that wraps your Next.js config.\n\n### Options\n\n| Option | Type | Required | Default | Description |\n|--------|------|----------|---------|-------------|\n| `source` | `string` | Yes | | Path to source translation file (e.g. `src/locales/en.json`) |\n| `lang` | `string[]` | Yes | | Target language codes |\n| `sourceLanguage` | `string` | No | Auto-detect from filename | Source language code |\n| `apiKey` | `string` | No | `AUTOGLOT_API_KEY` env var | API key |\n| `apiUrl` | `string` | No | `https://api.autoglot.app` | API base URL |\n| `project` | `string` | No | | Project for glossary/style guide (`owner/repo` format) |\n| `skipCache` | `boolean` | No | `false` | Skip translation cache |\n\n### Output\n\nTranslated files are written next to the source file. For example, given `source: \"src/locales/en.json\"` and `lang: [\"es\", \"fr\"]`, you'll get:\n\n```\nsrc/locales/\n  en.json       ← your source (untouched)\n  es.json       ← generated\n  fr.json       ← generated\n```\n\n## Examples\n\n### Basic i18next setup\n\n```javascript\n// next.config.mjs\nimport { withAutoglot } from '@autoglot/next';\n\nexport default withAutoglot({\n  source: 'public/locales/en/common.json',\n  lang: ['es', 'fr', 'de', 'ja'],\n})({});\n```\n\n### With existing Next.js config\n\n```javascript\n// next.config.mjs\nimport { withAutoglot } from '@autoglot/next';\n\nconst nextConfig = {\n  reactStrictMode: true,\n  images: { domains: ['example.com'] },\n};\n\nexport default withAutoglot({\n  source: 'src/locales/en.json',\n  lang: ['es', 'fr'],\n})(nextConfig);\n```\n\n### Composing with other plugins\n\n```javascript\n// next.config.mjs\nimport { withAutoglot } from '@autoglot/next';\nimport createMDX from '@next/mdx';\n\nconst withMDX = createMDX();\n\nexport default withAutoglot({\n  source: 'src/locales/en.json',\n  lang: ['es', 'fr', 'de'],\n})(withMDX({\n  pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx'],\n}));\n```\n\n### Link to a project (glossary + style guide)\n\n```javascript\nexport default withAutoglot({\n  source: 'src/locales/en.json',\n  lang: ['es', 'fr', 'de'],\n  project: 'acme/my-app',\n})({});\n```\n\n### Explicit source language\n\n```javascript\nexport default withAutoglot({\n  source: 'locales/messages.json',\n  lang: ['fr', 'de'],\n  sourceLanguage: 'en',\n})({});\n```\n\n### Skip cache for fresh translations\n\n```javascript\nexport default withAutoglot({\n  source: 'src/locales/en.json',\n  lang: ['es'],\n  skipCache: true,\n})({});\n```\n\n### Only in production builds\n\nTranslations only run during `next build`, not `next dev`. The plugin hooks into the production compilation lifecycle, so no extra configuration is needed.\n\n## How it works\n\n1. **Next.js 15.4.1+** — uses the built-in `compiler.runAfterProductionCompile` hook, which works with both webpack and Turbopack\n2. **Older versions** — falls back to a webpack plugin that runs on the `done` hook (after compilation completes)\n3. If both mechanisms are available, a deduplication guard ensures translation only runs once\n\nThe plugin reads your source file, sends it to the autoglot API, polls until translation completes, and writes the translated files to disk.\n\n## Supported file formats\n\n| Format | Extension |\n|--------|-----------|\n| JSON | `.json` |\n| YAML | `.yml`, `.yaml` |\n| PO/POT | `.po`, `.pot` |\n| Xcode String Catalog | `.xcstrings` |\n\n## Supported languages\n\n| Code | Language | Code | Language |\n|------|----------|------|----------|\n| `de` | German | `ja` | Japanese |\n| `fr` | French | `ko` | Korean |\n| `es` | Spanish | `zh-Hans` | Simplified Chinese |\n| `it` | Italian | `zh-Hant` | Traditional Chinese |\n| `pt` | Portuguese | `ar` | Arabic |\n| `pt-BR` | Brazilian Portuguese | `he` | Hebrew |\n| `nl` | Dutch | `hi` | Hindi |\n| `pl` | Polish | `th` | Thai |\n| `ru` | Russian | `vi` | Vietnamese |\n| `uk` | Ukrainian | `id` | Indonesian |\n| `tr` | Turkish | `ms` | Malay |\n| `sv` | Swedish | `cs` | Czech |\n| `da` | Danish | `hu` | Hungarian |\n| `fi` | Finnish | `ro` | Romanian |\n| `nb` | Norwegian | `sk` | Slovak |\n| `el` | Greek | `bg` | Bulgarian |\n\n## Links\n\n- [autoglot dashboard](https://autoglot.app/dashboard)\n- [Get API key](https://autoglot.app/dashboard/api-keys)\n- [@autoglot/cli](https://github.com/autoglot/cli) — standalone CLI and library\n- [Report issues](https://github.com/autoglot/next/issues)\n","readmeFilename":"README.md","homepage":"https://github.com/autoglot/next#readme","repository":{"url":"git+https://github.com/autoglot/next.git","type":"git"},"bugs":{"url":"https://github.com/autoglot/next/issues"}}