{"_id":"@dysporium/polyglot-core","_rev":"2-88f612380bba1913a9000de1c3bf414c","name":"@dysporium/polyglot-core","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@dysporium/polyglot-core","version":"1.0.0","keywords":["i18n","internationalization","translation","polyglot"],"license":"MIT","_id":"@dysporium/polyglot-core@1.0.0","maintainers":[{"name":"paulmothapo","email":"paulmothapo.personal@gmail.com"}],"dist":{"shasum":"8271e52cb7be4c9bbe36765d8017f0622fda9b5d","tarball":"https://registry.npmjs.org/@dysporium/polyglot-core/-/polyglot-core-1.0.0.tgz","fileCount":7,"integrity":"sha512-q56pFmG+3bV8hrhm6IDMfef1gOg9AFYhlQG5efkyShL0bwlhLHFL+5eCinORQgyuULeWvW9vbfK6mulMrr9AQw==","signatures":[{"sig":"MEUCIQDJ7w1DAFwEDJk63o6M2uMRFLQSMCF3/oJC0YMEZsp2VgIgPqAMSedjBn4gJhG8PnexHe1tymKVobTCNOtwxldH6n0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":216371},"main":"./dist/index.js","_from":"file:dysporium-polyglot-core-1.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"paulmothapo","email":"paulmothapo.personal@gmail.com"},"_resolved":"C:\\Users\\paulm\\AppData\\Local\\Temp\\0b6af5834039ef5ee64f3913d7b14358\\dysporium-polyglot-core-1.0.0.tgz","_integrity":"sha512-q56pFmG+3bV8hrhm6IDMfef1gOg9AFYhlQG5efkyShL0bwlhLHFL+5eCinORQgyuULeWvW9vbfK6mulMrr9AQw==","_npmVersion":"11.1.0","description":"Core translation engine for Dysporium Polyglot","directories":{},"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","typescript":"^5.3.3"},"_npmOperationalInternal":{"tmp":"tmp/polyglot-core_1.0.0_1767091780192_0.4916761717844875","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@dysporium/polyglot-core","version":"2.0.0","description":"Core translation engine for Dysporium Polyglot","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"keywords":["i18n","internationalization","translation","polyglot"],"license":"MIT","devDependencies":{"tsup":"^8.0.1","typescript":"^5.3.3"},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit"},"_id":"@dysporium/polyglot-core@2.0.0","_integrity":"sha512-OWK29e4cjAzNa0TLMybI9+fchMNJDmDLIMMQ3iTE12tWnWT96c3s1zfVs8ON7O8bIBpOoqSDDm4L7MofA67/RA==","_resolved":"/tmp/a5cfb25a5bde8b2a1b8eafa215021feb/dysporium-polyglot-core-2.0.0.tgz","_from":"file:dysporium-polyglot-core-2.0.0.tgz","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-OWK29e4cjAzNa0TLMybI9+fchMNJDmDLIMMQ3iTE12tWnWT96c3s1zfVs8ON7O8bIBpOoqSDDm4L7MofA67/RA==","shasum":"2e7963a3c317f172b56826395aa910a7f53b339a","tarball":"https://registry.npmjs.org/@dysporium/polyglot-core/-/polyglot-core-2.0.0.tgz","fileCount":9,"unpackedSize":216315,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCtATYNyRMGMtZvUMdf8GOqH687fgEkzK76HA/7TJbuCQIgMLXedhU0OnrWIhycJ4Ed1VANTK5buygNTZGdYQtXBjo="}]},"_npmUser":{"name":"paulmothapo","email":"paulmothapo.personal@gmail.com"},"directories":{},"maintainers":[{"name":"paulmothapo","email":"paulmothapo.personal@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/polyglot-core_2.0.0_1767114497632_0.440659988186352"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-30T10:49:40.091Z","modified":"2025-12-30T17:08:18.037Z","1.0.0":"2025-12-30T10:49:40.371Z","2.0.0":"2025-12-30T17:08:17.803Z"},"license":"MIT","keywords":["i18n","internationalization","translation","polyglot"],"description":"Core translation engine for Dysporium Polyglot","maintainers":[{"name":"paulmothapo","email":"paulmothapo.personal@gmail.com"}],"readme":"# @dysporium/polyglot-core\n\nThe foundational translation engine that powers Dysporium Polyglot. This package provides framework-agnostic internationalization primitives for JavaScript and TypeScript applications.\n\n## Overview\n\nThis is the core package of the Dysporium Polyglot ecosystem. It handles all translation logic, locale management, and text formatting without any framework dependencies. Use this package directly when building custom integrations or when working outside of React or DOM environments.\n\n## Features\n\n### Translation Engine\n\nThe `Translator` class serves as the central hub for all translation operations. It manages the current locale, resolves translation keys against your translation files, and handles fallback logic when translations are missing.\n\n### Automatic Language Detection\n\nThe `LanguageDetector` identifies the user's preferred language through multiple sources including browser settings, URL parameters, cookies, and localStorage. Detection sources are configurable and can be prioritized to match your application's needs.\n\n### String Interpolation\n\nVariable substitution within translation strings uses a configurable delimiter syntax. The default double curly brace format can be customized to match existing translation files or team preferences.\n\n### Pluralization\n\nBuilt-in plural form resolution supports the grammatical rules of different languages. The system handles languages with simple singular/plural distinctions as well as those with more complex plural categories.\n\n### Translation Loaders\n\nModular loaders fetch translations from various sources:\n\n- **JSONLoader** reads translation files from the local filesystem or bundled assets\n- **RemoteLoader** fetches translations from HTTP endpoints\n- **CompositeLoader** combines multiple loaders with priority ordering\n- **CachedLoader** wraps any loader with caching to reduce redundant requests\n\n### Event System\n\nAn event emitter provides hooks into the translation lifecycle. Subscribe to locale changes, translation loading completion, missing translation warnings, and error conditions.\n\n### Fallback Chain\n\nWhen a translation is missing in the current locale, the engine walks through configured fallback locales before ultimately falling back to the default locale. This ensures users always see meaningful content.\n\n## Installation\n\nInstall via your preferred package manager:\n\n**npm**\n\n    npm install @dysporium/polyglot-core\n\n**pnpm**\n\n    pnpm add @dysporium/polyglot-core\n\n**yarn**\n\n    yarn add @dysporium/polyglot-core\n\n## Package Exports\n\nThe package provides the following primary exports:\n\n- `Translator` - Main translation class\n- `TranslationStore` - Storage and retrieval of translation data\n- `LanguageDetector` - Browser language detection utilities\n- `InterpolationFormatter` - Variable substitution in strings\n- `PluralFormatter` - Plural form selection\n- `BaseLoader`, `JSONLoader`, `RemoteLoader`, `CompositeLoader`, `CachedLoader` - Translation loading strategies\n- `EventEmitter` - Subscription-based event handling\n- Full TypeScript type definitions for all interfaces and options\n\n## Related Packages\n\n- `@dysporium/polyglot-react` - React bindings with hooks and components (includes core)\n- `@dysporium/polyglot-dom` - Vanilla JS DOM integration with automatic element translation (includes core)\n- `@dysporium/polyglot-ai` - AI-powered translation using OpenAI, Claude, or custom providers (includes core)\n\nMost users should install one of the above packages rather than core directly. Install core only when building custom integrations or working in environments without React or DOM access.\n\n## Requirements\n\n- Node.js 16 or later\n- TypeScript 5.0 or later (for type definitions)\n\n## License\n\nMIT\n\n","readmeFilename":"README.md"}