{"id":20393068,"url":"https://github.com/aichbauer/react-i18n-kit","last_synced_at":"2026-05-07T05:31:33.483Z","repository":{"id":82477729,"uuid":"152754638","full_name":"aichbauer/react-i18n-kit","owner":"aichbauer","description":"I18n for your React Components","archived":false,"fork":false,"pushed_at":"2020-01-17T16:45:08.000Z","size":5580,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-26T05:31:00.992Z","etag":null,"topics":["i18n","internationalization","react","react-i18n-kit","reactjs","translation"],"latest_commit_sha":null,"homepage":"https://aichbauer.github.io/react-i18n-kit/","language":"JavaScript","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/aichbauer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-12T13:28:04.000Z","updated_at":"2020-11-08T14:29:07.000Z","dependencies_parsed_at":"2023-05-04T02:16:17.090Z","dependency_job_id":null,"html_url":"https://github.com/aichbauer/react-i18n-kit","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"8861cb684ea607498c898903dd5e15a6d9de6260"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/aichbauer/react-i18n-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichbauer%2Freact-i18n-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichbauer%2Freact-i18n-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichbauer%2Freact-i18n-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichbauer%2Freact-i18n-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aichbauer","download_url":"https://codeload.github.com/aichbauer/react-i18n-kit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichbauer%2Freact-i18n-kit/sbom","scorecard":{"id":172694,"data":{"date":"2025-08-11","repo":{"name":"github.com/aichbauer/react-i18n-kit","commit":"8861cb684ea607498c898903dd5e15a6d9de6260"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T16:58:33.222Z","repository_id":82477729,"created_at":"2025-08-16T16:58:33.222Z","updated_at":"2025-08-16T16:58:33.222Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32724454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["i18n","internationalization","react","react-i18n-kit","reactjs","translation"],"created_at":"2024-11-15T03:47:13.012Z","updated_at":"2026-05-07T05:31:33.467Z","avatar_url":"https://github.com/aichbauer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-i18n-kit\n\n[![npm](https://img.shields.io/npm/v/react-i18n-kit.svg?style=flat-square)](https://www.npmjs.com/package/react-i18n-kit)\n![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/react-i18n-kit.svg?style=flat-square)\n[![Travis branch](https://img.shields.io/travis/com/aichbauer/react-i18n-kit/master.svg?style=flat-square)](https://travis-ci.com/aichbauer/react-i18n-kit)\n[![Codecov branch](https://img.shields.io/codecov/c/github/aichbauer/react-i18n-kit/master.svg?style=flat-square)](https://codecov.io/gh/aichbauer/react-i18n-kit)\n[![docz](https://img.shields.io/badge/docs%20with-docz-1F2D3D.svg?style=flat-square)](https://aichbauer.github.io/react-i18n-kit)\n\n\u003e I18n for your React Components\n\n## Table of Contents\n\n- [Documentation](https://aichbauer.github.io/react-i18n-kit)\n- [Why?](#why)\n- [Installation](#installation)\n- [Functions](#functions)\n  - [withI18n](#withi18n)\n    - [Basic Usage](#basic-usage)\n    - [Options](#options)\n- [License](#license)\n\n## Why?\n\nI needed a simple way to translate my react applications without to much overhead.\n\n## Installation\n\n```sh\n$ npm i react-i18n-kit -S\n```\n\nor\n\n```sh\n$ yarn add react-i18n-kit\n```\n\n## Functions\n\nFor more detailed information you can take a look at the [documentation](https://aichbauer.github.io/react-i18n-kit).\n\n### withI18n\n\nThis is the enhancer for your Components. If you wrap your Components in this function you get access to a `i18n` and a `translate` property.\n\n#### Syntax\n\nReturns a component which renders the wrapped `Component`.\n\n```js\nconst i18n = withI18n(Component, data, options);\n```\n\n#### Parameters\n\n| Parameter | Type        | Required | Default | Description                           |\n| --------- | ----------- | -------- | ------- | ------------------------------------- |\n| Component | `Component` | true     |         | The component that gets rendered      |\n| data      | `object`    | true     |         | The translations for your `Component` |\n| options   | `object`    | false    |         | The options for your translations     |\n\n##### Component\n\nAn example for the `Component` parameter.\n\nThis component gets access to 2 exposed properties.\n\n| Property  | Type     | Description                                                          |\n| --------- | -------- | -------------------------------------------------------------------- |\n| i18n      | `object` | The committed `data` object, but only for the corresponding language |\n| translate | `func`   | The function for the dynamic translation (e.g. on a button click)    |\n\n```jsx\nconst Text = (props) =\u003e (\n  \u003cdiv\u003e\n    \u003cbutton onClick={() =\u003e props.translate('en')}\u003e\n      English\n    \u003cbutton/\u003e\n    \u003cbutton onClick={() =\u003e props.translate('de')}\u003e\n      Deutsch\n    \u003cbutton/\u003e\n    {props.i18n.text}\n  \u003c/div\u003e\n);\n```\n\n##### data\n\nAn example for the `data` parameter.\n\n```js\nconst data = {\n  de: {\n    text: \"Hallo Welt!\",\n  },\n  en: {\n    text: \"Hello World!\",\n  },\n};\n```\n\n##### options\n\n\u003e If there is no translation for a language it will take the `fallback` which is default to `en`\n\nAn example for the `options` parameter.\n\n```js\nconst options = {\n  lang: \"de\",\n  fallback: \"de\",\n};\n```\n\n## Basic Usage\n\n\u003e For more detailed information you can take a look at the [documentation](https://aichbauer.github.io/react-i18n-kit)\n\nRender a text based on the users browser language. If your browsers language is set to `de` it will render `Hallo Welt!` and if the browsers language is set to `en` it will render `Hello World!`.\n\n```jsx\nimport React from \"react\";\nimport { withI18n } from \"react-i18n-kit\";\n\nconst data = {\n  de: {\n    text: \"Hallo Welt!\",\n  },\n  en: {\n    text: \"Hello World!\",\n  },\n};\n\n/*\n  if language is:\n    - en:\n      props.i18n.text: \"Hello World!\"\n    - de:\n      props.i18n.text: \"Hallo Welt!\"\n*/\nconst Text = props =\u003e \u003cdiv\u003e{props.i18n.text}\u003c/div\u003e;\n\nconst TextI18n = withI18n(Text, data);\n\nexport { TextI18n as Text };\n```\n\nAs you see you get access to a `i18n` property. To make that enhancer work properly we have to pass an object with with keys set to a [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) code. Then the enhancer simply passes only the object with the corresponding language to the `i18n` property.\n\nFor example your browser language is set to `en-US`, `props.i18n` will be:\n\n```json\n{\n  \"text\": \"Hello World!\"\n}\n```\n\nYou can pass everything you want into these objects, but every language object has to contain the same keys (in this example `text`), which you will use in your enhanced component.\n\n#### Options\n\nIf you do not want to deside the language based on the browser language and you want to have a default value you can pass a options object.\n\nIf the user is visiting the page with a browser which has its language set to `zh` (chinese) it will automatically fallback to `en` since there is no translation for `zh` right now.\n\n```jsx\nimport React from \"react\";\nimport { withI18n } from \"react-i18n-kit\";\n\nconst data = {\n  de: {\n    text: \"Hallo Welt!\",\n  },\n  en: {\n    text: \"Hello World!\",\n  },\n};\n\nconst Text = props =\u003e \u003cdiv\u003e{props.i18n.text}\u003c/div\u003e;\n\nconst TextI18n = withI18n(Text, data, { fallback: \"en\" });\n\nexport { TextI18n as Text };\n```\n\n## License\n\nMIT © Lukas Aichbauer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faichbauer%2Freact-i18n-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faichbauer%2Freact-i18n-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faichbauer%2Freact-i18n-kit/lists"}