{"_id":"@achimismaili/easy-web-i18n","_rev":"4-9eb6f428d216e70488a380af00f54e82","name":"@achimismaili/easy-web-i18n","dist-tags":{"latest":"1.0.0"},"versions":{"0.3.1":{"name":"@achimismaili/easy-web-i18n","version":"0.3.1","license":"UNLICENSED","_id":"@achimismaili/easy-web-i18n@0.3.1","maintainers":[{"name":"achimismaili","email":"achim@ismaili.de"}],"homepage":"https://github.com/achimismaili/easy-web#readme","bugs":{"url":"https://github.com/achimismaili/easy-web/issues"},"dist":{"shasum":"a57bb1d0d3aa7ea9da2c73dc16eade1120f6fa3b","tarball":"https://registry.npmjs.org/@achimismaili/easy-web-i18n/-/easy-web-i18n-0.3.1.tgz","fileCount":47,"integrity":"sha512-VoHXxWp/QHxsD/n8RAEY+f+FxQbpkj9UkszIU+Qo4MDnv1jlIgK7GQGrNXARkCRXoGJndgT54QrXm6DQULYZVg==","signatures":[{"sig":"MEYCIQD3rTluecTwx9B/9qYRFuo49olscyVB03tZRGN/y/HolgIhALXlNTH+8dLcNKhOeaaGDciP7lt2jQ18TN+plCordFyN","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54825},"type":"module","_from":"file:achimismaili-easy-web-i18n-0.3.1.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"achimismaili","email":"achim@ismaili.de"},"_resolved":"C:\\Users\\ACHIMI~1\\AppData\\Local\\Temp\\33e4df3c06a6011c9bbfcf45c10cd7d7\\achimismaili-easy-web-i18n-0.3.1.tgz","_integrity":"sha512-VoHXxWp/QHxsD/n8RAEY+f+FxQbpkj9UkszIU+Qo4MDnv1jlIgK7GQGrNXARkCRXoGJndgT54QrXm6DQULYZVg==","repository":{"url":"git+https://github.com/achimismaili/easy-web.git","type":"git","directory":"packages/i18n"},"_npmVersion":"10.9.8","description":"Bilingual i18n utilities for IT-CI web projects. Built for static-prerender sites on Azure Static Web Apps using Astro and Paraglide-JS.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"astro":"^6.0.0","vitest":"^3.2.4","typescript":"^5.5.0","@vitest/coverage-v8":"^3.2.4","@inlang/paraglide-js":"^2.0.0"},"peerDependencies":{"astro":">=4.0.0 <7.0.0","@inlang/paraglide-js":"^2.0.0"},"peerDependenciesMeta":{"astro":{"optional":false},"@inlang/paraglide-js":{"optional":false}},"_npmOperationalInternal":{"tmp":"tmp/easy-web-i18n_0.3.1_1782497132472_0.03304273517228529","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @easy-web/i18n. Install that instead; this package is no longer updated."},"0.4.0":{"name":"@achimismaili/easy-web-i18n","version":"0.4.0","license":"UNLICENSED","_id":"@achimismaili/easy-web-i18n@0.4.0","maintainers":[{"name":"achimismaili","email":"achim@ismaili.de"}],"homepage":"https://github.com/achimismaili/easy-web#readme","bugs":{"url":"https://github.com/achimismaili/easy-web/issues"},"dist":{"shasum":"812e96eb9038df2d51cb9970239750b07f34fe2b","tarball":"https://registry.npmjs.org/@achimismaili/easy-web-i18n/-/easy-web-i18n-0.4.0.tgz","fileCount":23,"integrity":"sha512-ql73DLbrg+fSFPlawBshmaBgSnRhSl4DxyhX98MCraKjVfsHu7BszMERi8YXXaJIWghKoj/k7qpWJDAtlGIguQ==","signatures":[{"sig":"MEUCIC2cZtDvheqn1imrZFo/xVYNxa9Gzx5RvjrhJAysjA2nAiEA9LYePeOQesoMLP6Lwsregsr27evPH9dSRKM4sCP20DY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@achimismaili%2feasy-web-i18n@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":26646},"type":"module","_from":"file:achimismaili-easy-web-i18n-0.4.0.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d7dcdfc6-336b-4447-8753-51b2be207119"}},"_resolved":"/tmp/256e33b782a5619975695b92748022c1/achimismaili-easy-web-i18n-0.4.0.tgz","_integrity":"sha512-ql73DLbrg+fSFPlawBshmaBgSnRhSl4DxyhX98MCraKjVfsHu7BszMERi8YXXaJIWghKoj/k7qpWJDAtlGIguQ==","repository":{"url":"git+https://github.com/achimismaili/easy-web.git","type":"git","directory":"packages/i18n"},"_npmVersion":"11.18.0","description":"Bilingual i18n utilities for IT-CI web projects. Built for static-prerender sites on Azure Static Web Apps using Astro and Paraglide-JS.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"astro":"^6.0.0","vitest":"^3.2.4","typescript":"^5.5.0","@vitest/coverage-v8":"^3.2.4","@inlang/paraglide-js":"^2.0.0"},"peerDependencies":{"astro":">=6.0.0 <8.0.0","@inlang/paraglide-js":"^2.0.0"},"peerDependenciesMeta":{"astro":{"optional":false},"@inlang/paraglide-js":{"optional":false}},"_npmOperationalInternal":{"tmp":"tmp/easy-web-i18n_0.4.0_1783064869740_0.2688760669050836","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @easy-web/i18n. Install that instead; this package is no longer updated."},"1.0.0":{"name":"@achimismaili/easy-web-i18n","version":"1.0.0","license":"MIT","_id":"@achimismaili/easy-web-i18n@1.0.0","maintainers":[{"name":"achimismaili","email":"achim@ismaili.de"}],"homepage":"https://github.com/achimismaili/easy-web#readme","bugs":{"url":"https://github.com/achimismaili/easy-web/issues"},"dist":{"shasum":"25f57749357909e00fb1a10cc78fd5ca448867d3","tarball":"https://registry.npmjs.org/@achimismaili/easy-web-i18n/-/easy-web-i18n-1.0.0.tgz","fileCount":23,"integrity":"sha512-bZkn5pFge1jYUkmWCYOvkZwkfd3zXzCZQuTJOIhfy80iEJb8DSbm9nJFxEh1f9LFthQckkE2Y8EurY/xqQNkKg==","signatures":[{"sig":"MEUCIQCzR2Trhig/I89PWYbb6z+BENCxK2d3B7efYqkSAqAOhAIgMpbZoEC7LsQ5NM+vhdASfRZLqDFB3Je60iEilrvj6EA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@achimismaili%2feasy-web-i18n@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":26639},"type":"module","_from":"file:achimismaili-easy-web-i18n-1.0.0.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d7dcdfc6-336b-4447-8753-51b2be207119"}},"_resolved":"/tmp/8bf6b563f929111907d5cf9ddb871a0a/achimismaili-easy-web-i18n-1.0.0.tgz","_integrity":"sha512-bZkn5pFge1jYUkmWCYOvkZwkfd3zXzCZQuTJOIhfy80iEJb8DSbm9nJFxEh1f9LFthQckkE2Y8EurY/xqQNkKg==","repository":{"url":"git+https://github.com/achimismaili/easy-web.git","type":"git","directory":"packages/i18n"},"_npmVersion":"12.0.1","description":"Bilingual i18n utilities for IT-CI web projects. Built for static-prerender sites on Azure Static Web Apps using Astro and Paraglide-JS.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"astro":"^6.0.0","vitest":"^3.2.4","typescript":"^5.5.0","@vitest/coverage-v8":"^3.2.4","@inlang/paraglide-js":"^2.0.0"},"peerDependencies":{"astro":">=6.0.0 <8.0.0","@inlang/paraglide-js":"^2.0.0"},"peerDependenciesMeta":{"astro":{"optional":false},"@inlang/paraglide-js":{"optional":false}},"_npmOperationalInternal":{"tmp":"tmp/easy-web-i18n_1.0.0_1784214873469_0.9573269972051637","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @easy-web/i18n. Install that instead; this package is no longer updated."}},"time":{"created":"2026-06-26T18:05:32.312Z","modified":"2026-08-30T11:43:33.337Z","0.3.1":"2026-06-26T18:05:32.605Z","0.4.0":"2026-07-03T07:47:49.884Z","1.0.0":"2026-07-16T15:14:33.596Z"},"bugs":{"url":"https://github.com/achimismaili/easy-web/issues"},"license":"MIT","homepage":"https://github.com/achimismaili/easy-web#readme","repository":{"url":"git+https://github.com/achimismaili/easy-web.git","type":"git","directory":"packages/i18n"},"description":"Bilingual i18n utilities for IT-CI web projects. Built for static-prerender sites on Azure Static Web Apps using Astro and Paraglide-JS.","maintainers":[{"name":"achimismaili","email":"achim@ismaili.de"}],"readme":"# @achimismaili/easy-web-i18n\n\nBilingual i18n utilities for IT-CI web projects. Built for static-prerender sites on Azure Static Web Apps using Astro and Paraglide-JS.\n\n## Installation\n\nAdd the package and its peer dependencies. Install from npm.\n\n```bash\npnpm add @achimismaili/easy-web-i18n @inlang/paraglide-js astro\n```\n\n## Quick start\n\nCreate a central i18n instance using the factory. This ensures consistency across your routing, SEO, and formatting.\n\n```ts\nimport { createI18n } from '@achimismaili/easy-web-i18n';\n\nexport const i18n = createI18n({\n  locales: ['de', 'en'] as const,\n  defaultLocale: 'de',\n  baseUrl: 'https://dev.ismaili.de'\n});\n```\n\n## Paraglide setup\n\nThis library works alongside [Paraglide-JS](https://inlang.com/m/gerre34r/library-inlang-paraglideJs).\n\n1. Initialize paraglide in your project.\n2. Store your translation files in `messages/{locale}.json` (e.g., `messages/de.json`, `messages/en.json`).\n3. Commit the generated paraglide output to git to ensure reliable builds.\n\n## Astro config\n\nUse the factory output to configure Astro's native i18n settings in `astro.config.mjs`:\n\n```ts\nimport { defineConfig } from 'astro/config';\nimport { i18n } from './src/lib/i18n'; // path to your factory instance\n\nexport default defineConfig({\n  i18n: {\n    locales: i18n.locales,\n    defaultLocale: i18n.defaultLocale,\n    routing: {\n      prefixDefaultLocale: false\n    }\n  }\n});\n```\n\n## Intl formatters\n\nThe factory provides type-safe wrappers around standard `Intl` formatters.\n\n```ts\nconst { format } = i18n;\nconst locale = 'de';\n\nformat.date(locale, new Date());\nformat.number(locale, 1234.56);\nformat.currency(locale, 99.99, 'EUR');\nformat.relativeTime(locale, -1, 'day');\nformat.list(locale, ['Apfel', 'Birne', 'Banane']);\n```\n\n## SEO hreflang\n\nAutomatically generate alternate links for your head section.\n\n```astro\n---\n// BaseLayout.astro\nimport { i18n } from '../lib/i18n';\nconst links = i18n.getAlternateLinks(Astro.url.pathname);\n---\n\n<head>\n  {links.map(link => (\n    <link rel=\"alternate\" hreflang={link.hreflang} href={link.href} />\n  ))}\n  <link rel=\"canonical\" href={i18n.getCanonicalUrl(Astro.url.pathname, Astro.currentLocale)} />\n</head>\n```\n\n## Migration from v0.1\n\n| v0.1 Primitive | v0.3 Factory (Recommended) | v0.3 Primitive |\n| :--- | :--- | :--- |\n| `localizedHref('/about', 'en')` | `i18n.localizedHref('/about', 'en')` | `localizedHref({path, locale, defaultLocale})` |\n| `getLocaleFromPath(pathname)` | `i18n.getLocaleFromPath(pathname)` | `getLocaleFromPath({pathname, locales, defaultLocale})` |\n\nNote: The `SupportedLocale` type is removed. Use the generic `L` inferred from the `createI18n` config.\n\n## SSR caveat\n\n`@achimismaili/easy-web-i18n` does not support SSR features like `Accept-Language` header detection or middleware. It is designed for static-prerender deployments on Azure Static Web Apps.\n","readmeFilename":"README.md"}