{"_id":"@dmhd6219/i18next-slavic","name":"@dmhd6219/i18next-slavic","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@dmhd6219/i18next-slavic","version":"0.1.0","description":"Typed Slavic-case (declension) helper hook for react-i18next, plus a CLI that generates resource types from your locale JSON.","keywords":["i18next","react-i18next","i18n","slavic","russian","declension","cases","typescript","react","hook"],"license":"MIT","author":{"name":"dmhd6219"},"repository":{"type":"git","url":"git+https://github.com/dmhd6219-additional-projects/thesis-experiments.git","directory":"packages/i18next-slavic"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"bin":{"i18next-slavic":"dist/cli.js"},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"peerDependencies":{"i18next":">=23","react":">=18","react-i18next":">=14"},"devDependencies":{"@types/node":"^24.12.2","@types/react":"^19.2.7","i18next":"^25.8.13","react":"^19.2.0","react-i18next":"^16.5.4","tsup":"^8.3.5","typescript":"~5.9.3"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"gitHead":"165dc7561f5d22c6555cbcee07ffa6c9baa7d6c5","_id":"@dmhd6219/i18next-slavic@0.1.0","bugs":{"url":"https://github.com/dmhd6219-additional-projects/thesis-experiments/issues"},"homepage":"https://github.com/dmhd6219-additional-projects/thesis-experiments#readme","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-f/IYqiF0tRN1IEB13ll/kn501gTHrL/6TlfE7KBk/pu4cWLxDlR46qsfD9LjpINXIbujGqcYNLK6DG4nvXdQgw==","shasum":"4cf31d5d9e8d2ed97a11d4b01601426963e73a21","tarball":"https://registry.npmjs.org/@dmhd6219/i18next-slavic/-/i18next-slavic-0.1.0.tgz","fileCount":15,"unpackedSize":47047,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFxNe5/Oc3S3Khq/HCpu47AtA1CKoQ4abFu6H1tvv5PdAiBCae5okI7AicHER59iKmhA0UcrNhXSlRLPXTGdjo8lVw=="}]},"_npmUser":{"name":"dmhd6219","email":"svyatoslavsvyatkin@yandex.ru"},"directories":{},"maintainers":[{"name":"dmhd6219","email":"svyatoslavsvyatkin@yandex.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/i18next-slavic_0.1.0_1780515877540_0.43352313496618855"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-03T19:44:37.367Z","0.1.0":"2026-06-03T19:44:37.678Z","modified":"2026-06-03T19:44:37.871Z"},"maintainers":[{"name":"dmhd6219","email":"svyatoslavsvyatkin@yandex.ru"}],"description":"Typed Slavic-case (declension) helper hook for react-i18next, plus a CLI that generates resource types from your locale JSON.","homepage":"https://github.com/dmhd6219-additional-projects/thesis-experiments#readme","keywords":["i18next","react-i18next","i18n","slavic","russian","declension","cases","typescript","react","hook"],"repository":{"type":"git","url":"git+https://github.com/dmhd6219-additional-projects/thesis-experiments.git","directory":"packages/i18next-slavic"},"author":{"name":"dmhd6219"},"bugs":{"url":"https://github.com/dmhd6219-additional-projects/thesis-experiments/issues"},"license":"MIT","readme":"# i18next-slavic\n\nTyped **Slavic-case (declension) helper** for [`react-i18next`](https://react.i18next.com/),\nplus a small **CLI** that generates fully-typed resource definitions from your locale JSON.\n\nSlavic languages (Russian, Ukrainian, Polish, …) inflect nouns across six\ngrammatical cases. `i18next-slavic` maps each case to an i18next\n[`context`](https://www.i18next.com/translation-function/context), so you keep\none translation key and let i18next pick the right form — with full TypeScript\nautocomplete on your keys.\n\n## Install\n\n```bash\nnpm install @dmhd6219/i18next-slavic\n# peers (you almost certainly already have these):\nnpm install i18next react-i18next react\n```\n\n## The hook\n\n```tsx\nimport { useSlavicTranslation } from '@dmhd6219/i18next-slavic';\n\nfunction Greeting() {\n  const { tCase, t } = useSlavicTranslation('common');\n\n  return (\n    <p>\n      {/* \"Добро пожаловать в Москву\" — resolved from `city_accusative` */}\n      Добро пожаловать в {tCase('city', 'accusative')}\n    </p>\n  );\n}\n```\n\n`useSlavicTranslation` is a thin wrapper over `useTranslation` and returns the\nusual `{ t, i18n, ready }` plus:\n\n```ts\ntCase(\n  key: TranslationKey,          // typed from your own resources\n  wordCase: SlavicCase,         // 'nominative' | 'genitive' | 'dative' | …\n  options?: TOptions,\n  defaultValue?: string,\n): string\n```\n\n`SlavicCase` covers all six cases:\n\n```ts\ntype SlavicCase =\n  | 'nominative'\n  | 'genitive'\n  | 'dative'\n  | 'accusative'\n  | 'instrumental'\n  | 'prepositional';\n```\n\n### Locale JSON\n\nProvide one base key plus a context-suffixed variant per case:\n\n```json\n{\n  \"city\": \"Москва\",\n  \"city_genitive\": \"Москвы\",\n  \"city_dative\": \"Москве\",\n  \"city_accusative\": \"Москву\",\n  \"city_instrumental\": \"Москвой\",\n  \"city_prepositional\": \"Москве\"\n}\n```\n\n## The CLI\n\nThe bundled `i18next-slavic` command scans your locale JSON and writes a typed\n`Resources` interface plus the i18next module augmentation that powers\nautocomplete in the hook.\n\n```bash\nnpx @dmhd6219/i18next-slavic --locales public/locales/ru --out src/@types/resources.d.ts\n```\n\n> After installing, the local bin is exposed as `i18next-slavic`, so inside an\n> npm script you can call it directly (see below).\n\n| Option | Alias | Default | Description |\n| ------ | ----- | ------- | ----------- |\n| `--locales <dir>` | `-l` | `public/locales/ru` | Locale folder to read |\n| `--out <file>` | `-o` | `src/@types/resources.d.ts` | Output `.d.ts` file |\n| `--default-ns <ns>` | `-n` | `common` | `defaultNS` written into `i18next.d.ts` |\n| `--cwd <dir>` | `-c` | auto-detected | Project root |\n| `--help` | `-h` | | Show help |\n\nIt writes two files:\n\n- **`<out>`** — the `Resources` interface, regenerated on every run.\n- **`<out-dir>/i18next.d.ts`** — the i18next augmentation, created once and then\n  left untouched so your manual tweaks survive.\n\nAdd it to your scripts so types stay in sync:\n\n```json\n{\n  \"scripts\": {\n    \"i18n:types\": \"i18next-slavic\"\n  }\n}\n```\n\n> Context/plural variants (keys containing `_`) are intentionally excluded from\n> the generated key union — you reference the base key and pass the case to\n> `tCase`.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-7753eb92e99df59fda6f2a4da9b2e661"}