{"_id":"@axlotl-lab/react-i18n","_rev":"7-8f6a9d6688e920ca1bf0104e35106849","name":"@axlotl-lab/react-i18n","dist-tags":{"latest":"1.2.1"},"versions":{"1.0.0":{"name":"@axlotl-lab/react-i18n","version":"1.0.0","author":{"name":"axlotl-lab"},"license":"MIT","_id":"@axlotl-lab/react-i18n@1.0.0","maintainers":[{"name":"mmalomo","email":"mariano.malomo@gmail.com"}],"homepage":"https://github.com/axlotl-lab/react-i18n#readme","bugs":{"url":"https://github.com/axlotl-lab/react-i18n/issues"},"dist":{"shasum":"3448cee85b75b2750e4e41c3c48287bcfc210c14","tarball":"https://registry.npmjs.org/@axlotl-lab/react-i18n/-/react-i18n-1.0.0.tgz","fileCount":9,"integrity":"sha512-uao3KWc/QPrX7dROQuzaSbhD/IL+8s8AyI4lc4z0Ur6btqnrnkkPlJwvzVu4OC/PVgYNw7r2ThtUevTSQzYBJw==","signatures":[{"sig":"MEQCIAzHavt3//w8j8D7as7ZhdKO8T973u1oR/exXuyEL6f5AiAvI/k2QC29FQtwAUoQtVc7thFIbYkeZZotPOwR9wF4Rw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21943},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"5ba68402857f27aab16c6e07df2afd44fb67866e","scripts":{"test":"jest","build":"bunchee","build:publish":"npm run test && npm run build && npm publish"},"_npmUser":{"name":"mmalomo","email":"mariano.malomo@gmail.com"},"repository":{"url":"git+https://github.com/axlotl-lab/react-i18n.git","type":"git"},"_npmVersion":"10.1.0","description":"A versatile way to manage translations in your React application.","directories":{"test":"tests"},"_nodeVersion":"20.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","bunchee":"^5.4.0","ts-jest":"^29.2.5","ts-node":"^10.9.2","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/react":"^18.3.5","@types/react-dom":"^18.3.0","@testing-library/react":"^16.0.1","jest-environment-jsdom":"^29.7.0"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/react-i18n_1.0.0_1725739967649_0.699590024078222","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@axlotl-lab/react-i18n","version":"1.0.1","author":{"name":"axlotl-lab"},"license":"MIT","_id":"@axlotl-lab/react-i18n@1.0.1","maintainers":[{"name":"mmalomo","email":"mariano.malomo@gmail.com"}],"homepage":"https://github.com/axlotl-lab/react-i18n#readme","bugs":{"url":"https://github.com/axlotl-lab/react-i18n/issues"},"dist":{"shasum":"b1c65dd48ad21c9aedf5f26de35fb9b23c04352b","tarball":"https://registry.npmjs.org/@axlotl-lab/react-i18n/-/react-i18n-1.0.1.tgz","fileCount":9,"integrity":"sha512-ImIirPvdo4ai1V6k16Km7i8eVOtU0ixFudQlvdVIUd+Ewr3LhfOBoeYVBbZ/6BVzXSNE0wFwNxWG8cf/96t80w==","signatures":[{"sig":"MEUCIQCH9NbmdZhOjUNcybWDX8y9jPbSU4NSziEJT0n3DlAwuAIgeDYRmjARSGLPy/3YktlGt5TFHN20ep3MkVtoAOqU0WA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21916},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"d8da481b67aac52e63c3d5f93b545c4c5243c2dd","scripts":{"test":"jest","build":"bunchee","build:publish":"npm run test && npm run build && npm publish"},"_npmUser":{"name":"mmalomo","email":"mariano.malomo@gmail.com"},"repository":{"url":"git+https://github.com/axlotl-lab/react-i18n.git","type":"git"},"_npmVersion":"10.2.3","description":"A versatile way to manage translations in your React application.","directories":{"test":"tests"},"_nodeVersion":"20.10.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","bunchee":"^5.4.0","ts-jest":"^29.2.5","ts-node":"^10.9.2","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/react":"^18.3.5","@types/react-dom":"^18.3.0","@testing-library/react":"^16.0.1","jest-environment-jsdom":"^29.7.0"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/react-i18n_1.0.1_1725967072218_0.7731129868119364","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@axlotl-lab/react-i18n","version":"1.0.2","author":{"name":"axlotl-lab"},"license":"MIT","_id":"@axlotl-lab/react-i18n@1.0.2","maintainers":[{"name":"mmalomo","email":"mariano.malomo@gmail.com"}],"homepage":"https://github.com/axlotl-lab/react-i18n#readme","bugs":{"url":"https://github.com/axlotl-lab/react-i18n/issues"},"dist":{"shasum":"df76fc3076c5bf6a8261f1bcfce95be1bff2d39a","tarball":"https://registry.npmjs.org/@axlotl-lab/react-i18n/-/react-i18n-1.0.2.tgz","fileCount":9,"integrity":"sha512-G4kOfVItaM8YFQ8Yio6GoqLWBeHwOo3lFI5qCvcTSQ8hTRJfekjhUBrp5TvRqLc9JS+WYgvvatC8y5evYoreoQ==","signatures":[{"sig":"MEUCIQCoBW5RdCt6G3EXMDiyK6bydFFHeCoU2hVA313Bm81JAQIgIcqBphKRB4X0Q19eOPsigedHW6XJKzWPpvMWjByaegM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22408},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"e4414c0f014861b6d95813977b45c37853408da7","scripts":{"test":"jest","build":"bunchee","build:publish":"npm run test && npm run build && npm publish"},"_npmUser":{"name":"mmalomo","email":"mariano.malomo@gmail.com"},"repository":{"url":"git+https://github.com/axlotl-lab/react-i18n.git","type":"git"},"_npmVersion":"10.9.0","description":"A versatile way to manage translations in your React application.","directories":{"test":"tests"},"_nodeVersion":"22.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","bunchee":"^5.4.0","ts-jest":"^29.2.5","ts-node":"^10.9.2","typescript":"^5.5.4","@types/jest":"^29.5.12","@types/react":"^18.3.5","@types/react-dom":"^18.3.0","@testing-library/react":"^16.0.1","jest-environment-jsdom":"^29.7.0"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/react-i18n_1.0.2_1739208271470_0.13681036009373515","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@axlotl-lab/react-i18n","version":"1.1.0","author":{"name":"axlotl-lab"},"license":"MIT","_id":"@axlotl-lab/react-i18n@1.1.0","maintainers":[{"name":"mmalomo","email":"mariano.malomo@gmail.com"}],"homepage":"https://github.com/axlotl-lab/react-i18n#readme","bugs":{"url":"https://github.com/axlotl-lab/react-i18n/issues"},"dist":{"shasum":"cffdd0cb376012a331d8d5f91d5febf0011718ca","tarball":"https://registry.npmjs.org/@axlotl-lab/react-i18n/-/react-i18n-1.1.0.tgz","fileCount":3,"integrity":"sha512-ia2yFaCimvvSduhG1eguGKRwUZn7oK/sA/SWkKIOQBDc9kKFqrSWTJdgjPCh1ad3cIn/lS5F7y5Nve8fyrF6HQ==","signatures":[{"sig":"MEUCIHTnIfO0OTkUfVTfXFjfE6eC7QkGS1HBMTzKEHYNJ6DlAiEA5btfHBs8nWcSgKqRX1HGi9SbwOEuKpwvbppoxU8SRX0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9619},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"e271c11346db10fe9e374c713fc692f6c0bd1877","scripts":{"test":"jest","build":"bunchee","release":"node ./release.js","build:publish":"npm run test && npm run build && npm publish"},"_npmUser":{"name":"mmalomo","email":"mariano.malomo@gmail.com"},"repository":{"url":"git+https://github.com/axlotl-lab/react-i18n.git","type":"git"},"_npmVersion":"10.8.2","description":"A versatile way to manage translations in your React application.","directories":{"test":"tests"},"_nodeVersion":"20.19.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","bunchee":"^6.5.2","ts-jest":"^29.3.4","ts-node":"^10.9.2","typescript":"^5","@types/jest":"^29.5.14","@types/react":"^18","@types/react-dom":"^18","@testing-library/react":"^16.3.0","jest-environment-jsdom":"^29.7.0"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/react-i18n_1.1.0_1748441045380_0.4557285608966859","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@axlotl-lab/react-i18n","version":"1.1.1","author":{"name":"axlotl-lab"},"license":"MIT","_id":"@axlotl-lab/react-i18n@1.1.1","maintainers":[{"name":"mmalomo","email":"mariano.malomo@gmail.com"}],"homepage":"https://github.com/axlotl-lab/react-i18n#readme","bugs":{"url":"https://github.com/axlotl-lab/react-i18n/issues"},"dist":{"shasum":"ef5cdc42002d5656c1bdc27ccbc0a004c3f573a9","tarball":"https://registry.npmjs.org/@axlotl-lab/react-i18n/-/react-i18n-1.1.1.tgz","fileCount":9,"integrity":"sha512-FJiGG/uRqg6TUceO8Q7Jn4zPAPNGOqok8u+goZfjFtZwXt3KpGHEnq8FytgUkbLx+jptbhZwKMNZ/NY17w6+Yg==","signatures":[{"sig":"MEUCIBxowaEIUD74ue4Amu8LwotvRcSFYlPuLbxQEllpH4R4AiEAwhAaZBCbFXgZ5TDHoL68KEQxoIOs/4hRflI6nVnZP2A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24342},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"26c84dd17b135bae3cd4a331ec6e2c390a016e79","scripts":{"test":"jest","build":"bunchee","release":"node ./release.js","prepublishOnly":"npm test && npm run build"},"_npmUser":{"name":"mmalomo","email":"mariano.malomo@gmail.com"},"repository":{"url":"git+https://github.com/axlotl-lab/react-i18n.git","type":"git"},"_npmVersion":"10.8.2","description":"A versatile way to manage translations in your React application.","directories":{"test":"tests"},"_nodeVersion":"20.19.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","bunchee":"^6.5.2","ts-jest":"^29.3.4","ts-node":"^10.9.2","typescript":"^5","@types/jest":"^29.5.14","@types/react":"^18","@types/react-dom":"^18","@testing-library/react":"^16.3.0","jest-environment-jsdom":"^29.7.0"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/react-i18n_1.1.1_1748452885700_0.06548643727728343","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@axlotl-lab/react-i18n","version":"1.2.0","author":{"name":"axlotl-lab"},"license":"MIT","_id":"@axlotl-lab/react-i18n@1.2.0","maintainers":[{"name":"mmalomo","email":"mariano.malomo@gmail.com"}],"homepage":"https://github.com/axlotl-lab/react-i18n#readme","bugs":{"url":"https://github.com/axlotl-lab/react-i18n/issues"},"dist":{"shasum":"92efcdd8e7c80e3851089970840e6a2494e4ea21","tarball":"https://registry.npmjs.org/@axlotl-lab/react-i18n/-/react-i18n-1.2.0.tgz","fileCount":9,"integrity":"sha512-kGqgvwEzRkcEmL3AGRIMWsQLDzwOIRmtrjTVQPMFzVWLPxOMLX8NITyiHkmN2f3c9Iv+L9x5FeQgc07S6wU5YA==","signatures":[{"sig":"MEQCIDgRVVhZm5z+z8e9Vh1UnUIgNu8dUSw06h1RYX9UU29MAiBE07/B00KTnzHGKCLnJ96PCgCVxH9njcOSm5wFiWSAbw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24354},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"53129dc612941c165f7151774a13d502e90e9ba5","scripts":{"test":"jest","build":"bunchee","release":"node ./release.js","prepublishOnly":"npm test && npm run build"},"_npmUser":{"name":"mmalomo","email":"mariano.malomo@gmail.com"},"repository":{"url":"git+https://github.com/axlotl-lab/react-i18n.git","type":"git"},"_npmVersion":"10.8.2","description":"A versatile way to manage translations in your React application.","directories":{"test":"tests"},"_nodeVersion":"20.19.5","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","bunchee":"^6.5.2","ts-jest":"^29.3.4","ts-node":"^10.9.2","typescript":"^5","@types/jest":"^29.5.14","@types/react":"^18","@types/react-dom":"^18","@testing-library/react":"^16.3.0","jest-environment-jsdom":"^29.7.0"},"peerDependencies":{"react":"^18 || ^19","react-dom":"^18 || ^19"},"_npmOperationalInternal":{"tmp":"tmp/react-i18n_1.2.0_1762794210191_0.43831117605149217","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@axlotl-lab/react-i18n","version":"1.2.1","description":"A versatile way to manage translations in your React application.","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"directories":{"test":"tests"},"scripts":{"build":"bunchee","test":"jest","prepublishOnly":"npm test && npm run build","release":"node ./release.js"},"author":{"name":"axlotl-lab"},"license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/axlotl-lab/react-i18n.git"},"bugs":{"url":"https://github.com/axlotl-lab/react-i18n/issues"},"devDependencies":{"@testing-library/react":"^16.3.0","@types/jest":"^29.5.14","@types/react":"^18","@types/react-dom":"^18","bunchee":"^6.5.2","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","ts-jest":"^29.3.4","ts-node":"^10.9.2","typescript":"^5"},"peerDependencies":{"react":"^18 || ^19","react-dom":"^18 || ^19"},"_id":"@axlotl-lab/react-i18n@1.2.1","gitHead":"4f7dd7dc83307628b340db126936b3346163f615","homepage":"https://github.com/axlotl-lab/react-i18n#readme","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-5GFwS3wY0lUoU7prM35Cqw0mVqLOm5zxrvYK3yWHxJdeSywstAmTvyX41zs6X988sR8sYP9dqi3VcjC4dzw0tQ==","shasum":"502a6e4ef67dd4b28b8cfaa33608605be77c326d","tarball":"https://registry.npmjs.org/@axlotl-lab/react-i18n/-/react-i18n-1.2.1.tgz","fileCount":9,"unpackedSize":25500,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCdAzih19wopqddxgvLjeO5XXQgItwN57vZpJtTjPCEyQIhAKDle3lD8OAUJCflSGczqZzrXghCbAhaWvdePMWwN4Ye"}]},"_npmUser":{"name":"mmalomo","email":"mariano.malomo@gmail.com"},"maintainers":[{"name":"mmalomo","email":"mariano.malomo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-i18n_1.2.1_1768488288403_0.00010058588348660358"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-07T20:12:47.547Z","modified":"2026-01-15T14:44:48.677Z","1.0.0":"2024-09-07T20:12:47.851Z","1.0.1":"2024-09-10T11:17:52.370Z","1.0.2":"2025-02-10T17:24:31.622Z","1.1.0":"2025-05-28T14:04:05.551Z","1.1.1":"2025-05-28T17:21:25.886Z","1.2.0":"2025-11-10T17:03:30.365Z","1.2.1":"2026-01-15T14:44:48.540Z"},"bugs":{"url":"https://github.com/axlotl-lab/react-i18n/issues"},"author":{"name":"axlotl-lab"},"license":"MIT","homepage":"https://github.com/axlotl-lab/react-i18n#readme","repository":{"type":"git","url":"git+https://github.com/axlotl-lab/react-i18n.git"},"description":"A versatile way to manage translations in your React application.","maintainers":[{"name":"mmalomo","email":"mariano.malomo@gmail.com"}],"readme":"# react-i18n\n\nThe `useTranslations` hook provides a versatile way to manage translations in your React application, supporting nested keys, parameter interpolation, and rich content with React components.\n\n[![npm version](https://img.shields.io/npm/v/@axlotl-lab/react-i18n.svg)](https://www.npmjs.com/package/@axlotl-lab/react-i18n)\n\n## Usage\n\nAdd the `TranslationsProvider` component to your application:\n\n```jsx\nimport { TranslationsProvider } from '@axlotl-lab/react-i18n';\n\nfunction App() {\n  return (\n    <TranslationsProvider locale=\"es\" fallbackLocale=\"en\">\n      <MyApp />\n    </TranslationsProvider>\n  );\n}\n```\n\n### Parameters\n\n| Parameter      | Type   | Required | Default | Description                                              |\n|----------------|--------|----------|---------|----------------------------------------------------------|\n| locale         | string | Yes      | -       | The locale to use for translations in the entire application |\n| fallbackLocale | string | Yes      | -       | Fallback locale if translation is not found             |\n\n## Basic Translation Usage\n\nUse the `useTranslations` hook in your components:\n\n```jsx\nimport { useTranslations } from '@axlotl-lab/react-i18n';\n\nconst translations = {\n  greetings: {\n    hello: { en: 'Hello', es: 'Hola' },\n    welcome: { en: 'Welcome, {name}!', es: '¡Bienvenido, {name}!' },\n    richWelcome: { \n      en: 'Welcome to our <bold>amazing website</bold>! <image/>',\n      es: '¡Bienvenido a nuestro <bold>increíble sitio web</bold>! <image/>'\n    }\n  }\n};\n\nfunction MyComponent() {\n  const t = useTranslations({ translations });\n\n  return (\n    <div>\n      <p>{t('greetings.hello')}</p>\n      <p>{t('greetings.welcome', { name: 'John' })}</p>\n      {t.rich('greetings.richWelcome', {\n        bold: (text) => <strong>{text}</strong>,\n        image: () => <img src=\"/logo.png\" alt=\"Logo\" />\n      })}\n    </div>\n  );\n}\n```\n\n## Features\n\n### Parameter Interpolation\n\nPass parameters to be interpolated into translation strings using `{parameterName}` syntax:\n\n```javascript\nconst translations = {\n  messages: {\n    itemCount: { \n      en: 'You have {count} item{count}', \n      es: 'Tienes {count} elemento{count}' \n    },\n    userProfile: { \n      en: 'Hello {name}, you are {age} years old', \n      es: 'Hola {name}, tienes {age} años' \n    }\n  }\n};\n```\n\n```jsx\n{t('messages.itemCount', { count: 5 })}\n{/* Output: You have 5 items */}\n\n{t('messages.userProfile', { name: 'John', age: 25 })}\n{/* Output: Hello John, you are 25 years old */}\n```\n\n### Rich Content with React Components\n\nEmbed React components within translations using XML-like tags:\n\n```javascript\nconst translations = {\n  content: {\n    announcement: { \n      en: 'Visit our <link>documentation</link> and join our <discord>Discord</discord>!',\n      es: '¡Visita nuestra <link>documentación</link> y únete a nuestro <discord>Discord</discord>!'\n    }\n  }\n};\n```\n\n```jsx\n{t.rich('content.announcement', {\n  link: (text) => <a href=\"/docs\" className=\"text-blue-500\">{text}</a>,\n  discord: (text) => <a href=\"/discord\" className=\"text-purple-500\">{text}</a>\n})}\n{/* Output: Visit our <a href=\"/docs\" class=\"text-blue-500\">documentation</a> and join our <a href=\"/discord\" class=\"text-purple-500\">Discord</a>! */}\n```\n\n### Self-Closing Tags\n\nRich content also supports self-closing tags for components without content:\n\n```javascript\nconst translations = {\n  ui: {\n    separator: { \n      en: 'Before <divider/> After',\n      es: 'Antes <divider/> Después'\n    }\n  }\n};\n```\n\n```jsx\n{t.rich('ui.separator', {\n  divider: () => <hr className=\"my-4\" />\n})}\n```\n\n### Translation Key Existence Check\n\nCheck if a translation key exists before using it:\n\n```jsx\nconst t = useTranslations({ translations });\n\nif (t.exists('greetings.hello')) {\n  return <p>{t('greetings.hello')}</p>;\n}\n```\n\n### Current Locale Access\n\nAccess the current locale from the hook:\n\n```jsx\nconst t = useTranslations({ translations });\n\nreturn (\n  <div>\n    <p>Current language: {t.locale}</p>\n    <p>{t('greetings.hello')}</p>\n  </div>\n);\n```\n\n## Global Translations\n\nSet translations that are available throughout your entire application:\n\n```typescript\nimport { setGlobalTranslations } from '@axlotl-lab/react-i18n';\n\nsetGlobalTranslations({\n  common: {\n    submit: { en: 'Submit', es: 'Enviar' },\n    cancel: { en: 'Cancel', es: 'Cancelar' },\n    loading: { en: 'Loading...', es: 'Cargando...' }\n  },\n  navigation: {\n    home: { en: 'Home', es: 'Inicio' },\n    about: { en: 'About', es: 'Acerca de' }\n  }\n});\n```\n\nGlobal translations are automatically merged with local translations. Local translations take precedence in case of conflicts.\n\n```jsx\nfunction MyComponent() {\n  const localTranslations = {\n    page: {\n      title: { en: 'My Page', es: 'Mi Página' }\n    }\n  };\n  \n  const t = useTranslations({ translations: localTranslations });\n\n  return (\n    <div>\n      <h1>{t('page.title')}</h1> {/* Local translation */}\n      <button>{t('common.submit')}</button> {/* Global translation */}\n    </div>\n  );\n}\n```\n\n### TypeScript Autocomplete for Global Translations\n\nTo enable IDE autocomplete for global translations:\n\n1. **Define your global translations:**\n\n```typescript\n// globalTranslations.ts\nexport const globalTranslations = {\n  common: {\n    submit: { en: 'Submit', es: 'Enviar' },\n    cancel: { en: 'Cancel', es: 'Cancelar' }\n  },\n  navigation: {\n    home: { en: 'Home', es: 'Inicio' },\n    about: { en: 'About', es: 'Acerca de' }\n  }\n};\n\nexport type GlobalTranslationsType = typeof globalTranslations;\n```\n\n2. **Create a type declaration file:**\n\n```typescript\n// global.d.ts or types/react-i18n.d.ts\nimport { GlobalTranslationsType } from './globalTranslations';\n\ndeclare module \"@axlotl-lab/react-i18n\" {\n  type GlobalTranslations = GlobalTranslationsType;\n}\n```\n\n3. **Use with full autocomplete support:**\n\n```typescript\nimport { useTranslations } from '@axlotl-lab/react-i18n';\n\nfunction MyComponent() {\n  const t = useTranslations({ translations });\n\n  return (\n    <div>\n      <button>{t('common.submit')}</button> {/* ✅ Autocomplete works */}\n      <p>{t('myLocalKey')}</p> {/* ✅ Autocomplete works */}\n    </div>\n  );\n}\n```\n\nMake sure your `tsconfig.json` includes the path to your declaration file.\n\n## Type Safety\n\nThe hook is fully type-safe, ensuring that:\n\n- All translation keys are properly defined and accessible\n- Parameter names in interpolation match the translation strings\n- Component functions in rich content correspond to the tags used\n- Global and local translation keys are both autocompleted\n\n## Best Practices\n\n- Ensure all translation objects follow the same structure across different locales\n- Use meaningful, nested keys for better organization (e.g., `common.buttons.save` instead of `saveButton`)\n- Define global translations for commonly used text across your application\n- Use the `exists` method to conditionally render content based on translation availability\n- When using rich translations, always provide all necessary component functions to avoid unprocessed tags\n\n## Notes\n\n- Global translations are merged with local translations using a deep merge function\n- The hook will return the key itself if no translation is found, making it easy to identify missing translations during development\n- Rich content uses a regex-based parser to handle XML-like tags within translation strings","readmeFilename":"README.md"}