{"_id":"@alef-prime/i18n-pick","name":"@alef-prime/i18n-pick","dist-tags":{"alpha":"0.1.0-alpha.0","latest":"0.1.0-alpha.0"},"versions":{"0.1.0-alpha.0":{"name":"@alef-prime/i18n-pick","version":"0.1.0-alpha.0","description":"Six lines of code that kill 50 lang === 'he' ? ... : ... ternaries. A tiny helper for picking a value from a per-locale map with a safe fallback.","type":"module","main":"./index.mjs","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.mjs"}},"engines":{"node":">=18"},"keywords":["i18n","locale","ternary","pick","react","next","alef-prime"],"homepage":"https://www.n50.io/evolution","repository":{"type":"git","url":"git+https://github.com/Ilya0527/alef-prime-i18n-pick.git"},"license":"MIT","author":{"name":"ALEF-PRIME","url":"Ilya Glikman"},"sideEffects":false,"gitHead":"ea06f6cdd3ec7a2c451fef8f6560ad23e39f1ebf","_id":"@alef-prime/i18n-pick@0.1.0-alpha.0","bugs":{"url":"https://github.com/Ilya0527/alef-prime-i18n-pick/issues"},"_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-g5K0KPjZZFv4Ga4HFk+xqWw9XK2Dqlxuca0ydJGcHsTwlSCZi8JV3lvup76+FBmOK0IU3u8Wo0OGSM+wfng5ww==","shasum":"8e706c81cbeadcaed40182eec462b270d980baa5","tarball":"https://registry.npmjs.org/@alef-prime/i18n-pick/-/i18n-pick-0.1.0-alpha.0.tgz","fileCount":4,"unpackedSize":4306,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCS0Gwza/McTU7jEpONA1lGFVJdT9+5XtlxMwJME5hnYgIgBa8XBSeZPkQGmFm77HY6GzaU6VOWwLNe4jaNkleawp4="}]},"_npmUser":{"name":"n50","email":"ilya0527@gmail.com"},"directories":{},"maintainers":[{"name":"n50","email":"ilya0527@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/i18n-pick_0.1.0-alpha.0_1779107625290_0.03573944322753109"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-18T12:33:45.218Z","0.1.0-alpha.0":"2026-05-18T12:33:45.437Z","modified":"2026-05-18T12:33:45.618Z"},"maintainers":[{"name":"n50","email":"ilya0527@gmail.com"}],"description":"Six lines of code that kill 50 lang === 'he' ? ... : ... ternaries. A tiny helper for picking a value from a per-locale map with a safe fallback.","homepage":"https://www.n50.io/evolution","keywords":["i18n","locale","ternary","pick","react","next","alef-prime"],"repository":{"type":"git","url":"git+https://github.com/Ilya0527/alef-prime-i18n-pick.git"},"author":{"name":"ALEF-PRIME","url":"Ilya Glikman"},"bugs":{"url":"https://github.com/Ilya0527/alef-prime-i18n-pick/issues"},"license":"MIT","readme":"# @alef-prime/i18n-pick\n\n> Six lines of code that kill 50+ `lang === \"he\" ? ... : ...` ternaries.\n\nBorn after running our own evolution sensor on [n50.io](https://www.n50.io) and finding **50 identical ternary chains across 14 files**, all written by hand because nobody had stopped to extract the helper.\n\n```ts\nimport { pick } from \"@alef-prime/i18n-pick\";\n\n// Before — 70+ chars per call site:\nconst title = lang === \"he\" ? \"מפעיל\" : lang === \"ru\" ? \"оператор\" : \"operator\";\n\n// After — 50 chars, one shape, one place to change the brand voice:\nconst title = pick(lang, { he: \"מפעיל\", ru: \"оператор\", en: \"operator\" });\n```\n\nThat's it. No build step. No runtime cost. No dependencies. 6 lines of source.\n\n## API\n\n```ts\npick(lang, map, fallback?)\n```\n\n- `lang` — your current locale (`\"he\"`, `\"en\"`, `\"ru\"`, anything stringly).\n- `map` — `Partial<Record<lang | \"en\", T>>`. Provide the locales you have; missing ones fall back.\n- `fallback` — defaults to `\"en\"`. Used when `lang` key is missing in the map.\n- Returns the matched value, or the fallback, or the first map value if neither matches.\n\n```ts\nimport { picker } from \"@alef-prime/i18n-pick\";\n// Pre-bound to one lang:\nconst t = picker(\"he\");\nt({ he: \"שלום\", en: \"hello\" });   // → \"שלום\"\n```\n\n## Why not just use i18next?\n\nBecause most product code doesn't need 800kB of i18n infrastructure to label a button. It needs **one inline helper for inline strings**. Use `i18next` for full catalogs; use `i18n-pick` for the 80% of cases where you'd otherwise write a ternary.\n\n## Status: alpha · 0.1.0\n\nBorn from [ALEF-PRIME](https://www.n50.io)'s glass-box evolution. Sibling of [`@alef-prime/audit`](https://github.com/Ilya0527/alef-site/tree/main/audit) and [`@alef-prime/deploy-verify`](https://github.com/Ilya0527/alef-prime-deploy-verify). Watch the parent loop at [n50.io/evolution](https://www.n50.io/evolution).\n\n## License\n\nMIT.\n","readmeFilename":"README.md","_rev":"1-ce7f9492a42137d20acb827c0bc9dd8e"}