{"id":39706581,"url":"https://github.com/psyycker/react-translation","last_synced_at":"2026-01-18T10:34:01.288Z","repository":{"id":57138389,"uuid":"298615961","full_name":"psyycker/react-translation","owner":"psyycker","description":"A small library dependency free to enable language translation easily on your React and React Native projects.","archived":false,"fork":false,"pushed_at":"2024-01-22T12:48:23.000Z","size":3523,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-15T10:56:20.077Z","etag":null,"topics":["internationalization","react","react-native","translation","translation-files"],"latest_commit_sha":null,"homepage":"https://psyycker.github.io/react-translation/","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/psyycker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-09-25T15:48:31.000Z","updated_at":"2025-07-28T03:22:21.000Z","dependencies_parsed_at":"2024-01-22T15:05:45.668Z","dependency_job_id":null,"html_url":"https://github.com/psyycker/react-translation","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/psyycker/react-translation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyycker%2Freact-translation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyycker%2Freact-translation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyycker%2Freact-translation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyycker%2Freact-translation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psyycker","download_url":"https://codeload.github.com/psyycker/react-translation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psyycker%2Freact-translation/sbom","scorecard":{"id":748592,"data":{"date":"2025-08-11","repo":{"name":"github.com/psyycker/react-translation","commit":"011c8c13c141ac86753bc0a3fe9a1a406f894d14"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.6,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/25 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":"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":"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: npmCommand not pinned by hash: install-example.sh:56","Warn: npmCommand not pinned by hash: install-example.sh:58","Info:   0 out of   2 npmCommand dependencies pinned"],"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":"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":"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":"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":"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":"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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 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"}},{"name":"Vulnerabilities","score":0,"reason":"57 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-4www-5p9h-95mh","Warn: Project is vulnerable to: GHSA-9gqv-wp59-fq42","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-x7hr-w5r2-h6wg","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c24v-8rfc-w8vw","Warn: Project is vulnerable to: GHSA-8jhw-289h-jh2g","Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3","Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx","Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6","Warn: Project is vulnerable to: GHSA-x574-m823-4x7w","Warn: Project is vulnerable to: GHSA-4r4m-qw57-chr8","Warn: Project is vulnerable to: GHSA-xcj6-pq6g-qj4x","Warn: Project is vulnerable to: GHSA-356w-63v5-8wf4","Warn: Project is vulnerable to: GHSA-859w-5945-r5v3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-gpv5-7x3g-ghjv","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-rxrc-rgv4-jpvx","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T19:36:32.008Z","repository_id":57138389,"created_at":"2025-08-22T19:36:32.008Z","updated_at":"2025-08-22T19:36:32.008Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28534483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"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":["internationalization","react","react-native","translation","translation-files"],"created_at":"2026-01-18T10:34:01.200Z","updated_at":"2026-01-18T10:34:01.268Z","avatar_url":"https://github.com/psyycker.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/%40psyycker%2Freact-translation.svg)](https://badge.fury.io/js/%40psyycker%2Freact-translation)\n[![CircleCI](https://circleci.com/gh/psyycker/react-translation.svg?style=svg)](https://circleci.com/gh/psyycker/react-translation)\n# React Translation\nReact Translation is an easy-to-use Translation Library for React and React Native! \u003cbr/\u003e\nIt is thought to be used with shared libraries and without instance conflicts. \u003cbr/\u003e\n\n## /!\\ Version 0.7 to 0.8 breaking change\nReact and React Native components are now seamlessly integrated together. Which means that it is now possible to use\nin the same way the `Translation` component for both React and React Native.\n\n## Disclaimers\nEven if React Translation is quite stable by its simplicity, and you can easily use it on your tools,\nthis is still a work in progress project and potential breaking changes may happen especially in the way that\ntranslations are being declared.\n\u003cbr/\u003e\nI'm very glad to get feedbacks from you as it helps to improve this library at its early stage.\n\n## Documentation\n\nYou can find the documentation [here](https://psyycker.github.io/react-translation/docs/intro)\n\n## Installation\n```\nnpm install --save @psyycker/react-translation\n```\n\n## Usage\n\n### Initialise the library\n\nIn your index file (and in case of the usage of a shared library, in any index file) \u003cbr/\u003e\nImport directly the library to initialise the events:\n```js\nimport \"@psyycker/react-translation\"\n```\n\n### Set default config\n\nBy default, no locale is set, you can define it by calling the function\n\n```js\nimport { setTranslationConfig } from \"@psyycker/react-translation\"\n// Always call first before initialising the config\nimport \"@psyycker/react-translation\"\n\n// Do not call inside a component\nsetTranslationConfig({\n  defaultLocale: \"en-US\"\n})\n\n```\n\n### Translation Files\nFirst, you'll need to define your translation files. \u003cbr/\u003e\nBoth JSON and JS objects are supported \u003cbr/\u003e\nYou can nest properties to make it more readable\n```json\n{\n  \"component\": {\n    \"title\": \"My Value\"\n  }\n}\n```\n\n### Register your translation files\nLet's say you have 2 files. One for English (US) and one for French \u003cbr/\u003e\n\n```\ntranslations\n    |-- french.json\n    |-- english-us.json\n```\n\n```js\nimport { registerTranslations } from \"@psyycker/react-translation\";\nimport french from \"./translations/french.json\";\nimport englishUS from \"./translations/english-us.json\";\n\nregisterTranslations({\n  \"en-US\": englishUS,\n  \"fr-FR\": french\n})\n```\nYou can split your translation files and register them at different places. They will be merged\n\n### Translate\n\n#### With React\n\n##### Using Hooks\n\n```jsx\nimport { useTranslation, changeLocale } from \"@psyycker/react-translation\"; import {useEffect} from \"react\";\n\nfunction MyComponent() {\n\n  const { getTranslation } = useTranslation();\n\n  return (\n    \u003cdiv\u003e{getTranslation({\n      translationKey: \"component.title\",\n      defaultValue: \"My Default Value\"\n    })}\u003c/div\u003e\n  )\n}\n```\n\n##### Using Component\n\n```jsx\nimport { Translation, changeLocale } from \"@psyycker/react-translation\"; import {useEffect} from \"react\";\n\nfunction MyComponent() {\n\n  return (\n    \u003cdiv\u003e\n          \u003cTranslation \n            translationKey=\"component.title\" \n            defaultValue=\"My default value\"\n         /\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n#### With React Native\n\n```jsx\nimport { useTranslation, changeLocale } from \"@psyycker/react-translation\"; import {useEffect} from \"react\";\n\nfunction MyComponent() {\n\n  const { getTranslation } = useTranslation();\n\n  return (\n    \u003cText\u003e{getTranslation({\n      translationKey: \"component.title\",\n      defaultValue: \"My Default Value\"\n    })}\u003c/Text\u003e\n  )\n}\n```\n\n##### Using Component\n\n```jsx\nimport { Translation, changeLocale } from \"@psyycker/react-translation\"; import {useEffect} from \"react\";\nimport { StyleSheet } from \"react-native\"\n\nconst styles = StyleSheet.create({\n  textStyle: {\n    ...\n  }\n})\n\nfunction MyComponent() {\n\n  return (\n    \u003cView\u003e\n          \u003cTranslation \n            // If you want to apply a react native style on Text Component\n            style={styles.textStyle}\n            translationKey=\"component.title\" \n            defaultValue=\"My default value\"\n         /\u003e\n    \u003c/View\u003e\n  )\n}\n```\n\n##### API of Translation Component\n\n| Property       | Type   | Optional | Description                                                                  |\n|----------------|--------|----------|------------------------------------------------------------------------------|\n| translationKey | String |          | The key defined in the JSON file                                             |\n| defaultValue   | String |          | The default value if the key is not found                                    |\n| parameters     | Object | Yes      | An object which contains the values which replace `{}` in the string           |\n| style          | Object | Yes      | Can either be a CSS in JS style (React) or a Stylesheet style (React Native) |\n\n#### Using parameters\n\nYou might want to inject parameters in your translations.\n\u003cbr/\u003e\nYou can do so by using `{\u003cyourVariableName\u003e}` format (See below)\n```json\n{\n  \"component\": {\n    \"title\": \"Hello {input}\"\n  }\n}\n```\n\nAnd then, you can inject it using the parameters property\n\n```jsx\nimport { Translation, changeLocale } from \"@psyycker/react-translation\"; \nimport {useEffect} from \"react\";\n\nfunction MyComponent() {\n\n  return (\n    \u003c\u003e\n          \u003cTranslation \n            translationKey=\"component.title\" \n            defaultValue=\"My default value\"\n            parameters={{\n              input: \"My custom input\"\n            }}\n         /\u003e\n    \u003c/\u003e\n  )\n}\n```\n\nYou can also do it by calling:\n\n```js\n    getTranslation({\n      translationKey: \"component.title\",\n      defaultValue: \"My Default Value\",\n      parameters: { input: \"My Custom Input\" }\n})\n```\n\n### Change the locale\nYou can easily change the locale by doing:\n\n```js\nimport { changeLocale } from \"@psyycker/react-translations\";\n\n    ...\n\n    function onLocaleChange(newLocale){\n      changeLocale(newLocale)\n    }\n\n    ... // Probably some ui to change the locale!\n    \n```\n\n# ROADMAP\nSee the roadmap [here](https://trello.com/b/aBwAR0S5/react-translation-roadmap)\n\n# Development and examples\nSee `development.md` to see how to use the examples and participate in the repo\n\n# License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsyycker%2Freact-translation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsyycker%2Freact-translation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsyycker%2Freact-translation/lists"}