{"id":15691542,"url":"https://github.com/dmtrkovalenko/ns-react-18next","last_synced_at":"2025-05-07T23:48:24.364Z","repository":{"id":66140170,"uuid":"138311582","full_name":"dmtrKovalenko/ns-react-18next","owner":"dmtrKovalenko","description":"[Unmaintained] Namespaced i18next localization in react with no tears","archived":false,"fork":false,"pushed_at":"2019-03-29T10:22:06.000Z","size":203,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-29T23:39:33.514Z","etag":null,"topics":["context","i18n","i18next","localization","localized","react","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmtrKovalenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-22T14:23:07.000Z","updated_at":"2020-03-25T08:26:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"f724eded-ef18-4030-8fac-281d1470bb8c","html_url":"https://github.com/dmtrKovalenko/ns-react-18next","commit_stats":{"total_commits":38,"total_committers":3,"mean_commits":"12.666666666666666","dds":"0.10526315789473684","last_synced_commit":"a02cd62f2a44abc6f56b876a89bfbba04ec9c2b6"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmtrKovalenko%2Fns-react-18next","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmtrKovalenko%2Fns-react-18next/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmtrKovalenko%2Fns-react-18next/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmtrKovalenko%2Fns-react-18next/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmtrKovalenko","download_url":"https://codeload.github.com/dmtrKovalenko/ns-react-18next/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973625,"owners_count":21834105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["context","i18n","i18next","localization","localized","react","typescript"],"created_at":"2024-10-03T18:22:12.175Z","updated_at":"2025-05-07T23:48:24.341Z","avatar_url":"https://github.com/dmtrKovalenko.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NS react-i18next\n[![npm package](https://img.shields.io/npm/v/ns-react-i18next.svg)](https://www.npmjs.org/package/ns-react-i18next)\n[![gzip bundle size](http://img.badgesize.io/https://unpkg.com/ns-react-i18next@0.1.1/index.amd.js?compression=gzip\n)](https://unpkg.com/ns-react-i18next@0.1.1/index.amd.js)\n[![codecov](https://codecov.io/gh/dmtrKovalenko/ns-react-18next/branch/master/graph/badge.svg)](https://codecov.io/gh/dmtrKovalenko/ns-react-18next)\n[![Build Status](https://travis-ci.org/dmtrKovalenko/ns-react-18next.svg?branch=master)](https://travis-ci.org/dmtrKovalenko/ns-react-18next)\n\u003e Manage i18next namespaces with a power of react v16 context\n\n## Unmaintained\n\nThe purpose of this library was merged to official [react-i18next](https://github.com/i18next/react-i18next) at v9. So please use it.  :)\n\n### Installation\nAvailable as npm package.\n```sh\nnpm install ns-react-i18next\n```\n\nAdd global provider to the root of your app\n\n```jsx\nimport * as i18n from 'i18next';\nimport { I18NextProvider } from 'ns-react-i18next'\n\ni18n\n  .use(LanguageDetector)\n  .init({\n    resources: translations,\n    fallbackLng: 'en',\n    debug: true,\n    defaultNS: 'common', // this namespace will be used if no namespace shared via context\n    fallbackNS: 'common',\n  });\n\nReactDom.render(\n  \u003cI18NextProvider i18n={i18n}\u003e\n    \u003cApp /\u003e\n  \u003c/I18NextProvider\u003e,\n  document.getElementById('root')\n)\n```\n\n### Usage\nUse another provider to share namespace between components sub-tree. Any `\u003cTranslate\u003e` component under this provider will render translated string of shared namespace + children string. Note that when the language will be changed (with a help of `i18n.changeLanguage()`) - every translate will rerender by itself.\n\n```jsx\nimport { Translate, NamespaceProvider } from 'ns-react-i18next'\n\n\u003cNamespaceProvider ns=\"specificNs\"\u003e\n  // specificNs:some_complex_structure\n  \u003cp\u003e \u003cTranslate interpolate={{ key: 'value' }}\u003e some_complex_structure \u003c/Translate\u003e \u003c/p\u003e\n  \u003cp\u003e \u003cTranslate\u003e something_specific \u003c/Translate\u003e \u003c/p\u003e // specificNs:something_specific\n\u003c/NamespaceProvider\u003e\n```\n\nEven possible to share namespace for several routes.\n\n```jsx\n\u003cNamespaceProvider ns=\"customers\"\u003e\n  \u003cRoute path=\"/customers\" component={CustomersList} /\u003e\n  \u003cRoute path=\"/customers/:id\" component={ManageCustomer} /\u003e\n\u003c/NamespaceProvider\u003e\n```\n\nThere any `Translate` of CustomersList, ManageCustomer and thiers sub-components and sub-routes of take the 'customers' namespace.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmtrkovalenko%2Fns-react-18next","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmtrkovalenko%2Fns-react-18next","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmtrkovalenko%2Fns-react-18next/lists"}