{"id":42133808,"url":"https://github.com/pureartisan/simple-i18n-react","last_synced_at":"2026-01-26T16:03:37.092Z","repository":{"id":44220823,"uuid":"156938878","full_name":"pureartisan/simple-i18n-react","owner":"pureartisan","description":"React component for i18n using simple-i18n","archived":false,"fork":false,"pushed_at":"2023-01-04T21:37:21.000Z","size":1101,"stargazers_count":1,"open_issues_count":16,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-04T07:39:08.021Z","etag":null,"topics":["html-tags","i18n","internationalization","localization","react","translation"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pureartisan.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}},"created_at":"2018-11-10T02:10:17.000Z","updated_at":"2020-01-11T02:43:15.000Z","dependencies_parsed_at":"2023-02-02T20:46:01.544Z","dependency_job_id":null,"html_url":"https://github.com/pureartisan/simple-i18n-react","commit_stats":null,"previous_names":["prageeth/simple-i18n-react"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/pureartisan/simple-i18n-react","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pureartisan","download_url":"https://codeload.github.com/pureartisan/simple-i18n-react/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n-react/sbom","scorecard":{"id":743387,"data":{"date":"2025-08-11","repo":{"name":"github.com/pureartisan/simple-i18n-react","commit":"ad3c4d6ac3b67922604e3174569ea9905bd7d338"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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":"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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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: Apache License 2.0: 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":"Vulnerabilities","score":0,"reason":"44 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-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"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-22T18:07:00.956Z","repository_id":44220823,"created_at":"2025-08-22T18:07:00.956Z","updated_at":"2025-08-22T18:07:00.956Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28782096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: 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":["html-tags","i18n","internationalization","localization","react","translation"],"created_at":"2026-01-26T16:03:37.028Z","updated_at":"2026-01-26T16:03:37.084Z","avatar_url":"https://github.com/pureartisan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple I18n React [![npm version](https://badge.fury.io/js/%40pureartisan%2Fsimple-i18n-react.svg)](https://badge.fury.io/js/%40pureartisan%2Fsimple-i18n-react) [![CircleCI](https://circleci.com/gh/pureartisan/simple-i18n-react.svg?style=svg)](https://circleci.com/gh/pureartisan/simple-i18n-react)\n\nReact component for i18n translations using [@pureartisan/simple-i18n](https://github.com/pureartisan/simple-i18n).\nThis supports translations to have HTML tags that are safe to use (by avoiding updating the DOM html directly, disabling XSS).\n\n## Installation\n\nNote, this module has a peer-dependency with `@pureartisans/simple-i18n`. We decided to do that as this is an extension of `@pureartisans/simple-i18n` for react and we don't want to double-include the dependency in the distrubition.\n\n```\nnpm install @pureartisans/simple-i18n-react @pureartisans/simple-i18n\n```\n\n## Getting started\n\nFor usage information of `@pureartisans/simple-i18n`, please checkout the [github repo](https://github.com/prageeth/simple-i18n).\n\n## Translations\n\n```\n// ES5\nvar Translate = require('@pureartisans/simple-i18n-react');\n\n// ES6\nimport Translate from '@pureartisans/simple-i18n-react';\n\n// assuming i18n translations are already setup using SimpleI18n as below:\nconst languages = {\n   'en': {\n      'help-info.body': 'Lorem ipsum'\n   }\n};\n\n// let's create a simple component\nconst HelpInfo = () =\u003e (\n  \u003cdiv className=\"help-info\"\u003e\n    \u003cTranslate i18nKey=\"help-info.body\" /\u003e\n  \u003c/div\u003e\n);\n```\n\n## Dynamic variables\n\n```\n// assuming i18n translations are already setup using SimpleI18n as below:\nconst languages = {\n   'en': {\n      'profile-header.greeting': 'Hi {firstName}'\n   }\n};\n\n// let's create a simple component\nconst ProfileHeader = ({ user }) =\u003e (\n  \u003cdiv className=\"profile-header\"\u003e\n    \u003cTranslate i18nKey=\"profile-header.greeting\" options={{ firstName: user.first_name }} /\u003e\n  \u003c/div\u003e\n);\n```\n\n## HTML tags\n\nYou are allowed to use basic HTML tags in the translations, with basic attributes. Attributes will be passed to the elements as props, so don't forget to use `className` instead of `class` for CSS classes.\n\n```\nconst languages = {\n   'en': {\n      'help-info.body': 'For more information, visit our \u003ca href=\"http://my-support.com\"\u003esupport page\u003c/a\u003e\u003cbr /\u003eDon\\'t forget to leave us an amazing \u003cstrong className=\"red-text\"\u003ereview\u003c/strong\u003e.'\n   }\n};\n\n// let's create a simple component\nconst HelpInfo = () =\u003e (\n  \u003cdiv className=\"help-info\"\u003e\n    \u003cTranslate i18nKey=\"help-info.body\" /\u003e\n  \u003c/div\u003e\n);\n\n// when rendered, will generate\n\u003cdiv class=\"help-info\"\u003e\n  For more information, visit our \u003ca href=\"#\"\u003esupport page\u003c/a\u003e\n  \u003cbr /\u003e\n  Don\\'t forget to leave us an amazing \u003cstrong class=\"red-text\"\u003ereview\u003c/strong\u003e.\n\u003c/div\u003e\n```\n\n***NOTE***\nThe link in the above example has been converted to a `#` when rendered, this is to prevent users accidentally clicking it and being redirected to another URL. In most cases, React applications will be a sinlge page application. In order to handle this link being clicked event, please see the [Link Click Handling](#link-click-handling)\n\n***NOTE***\nIllegal tags such as `script`, `iframe`, `img` are ignored and their content text will be displayed in the translation as static text:\n\n```\n'en': {\n  ...\n  'illegal-translation': 'I have some \u003cscript\u003ealert('illegal');\u003c/script\u003e translation'\n  ...\n};\n\n// rendering\n\u003cdiv className=\"illegal-example\"\u003e\n   \u003cTranslate i18nKey=\"illegal-translation\" /\u003e\n\u003c/div\u003e\n\n// will generate the following DOM with the content being static text\n\u003cdiv class=\"illegal-example\"\u003e\n  I have some alert('illegal'); translation\n\u003c/div\u003e\n```\n\n***NOTE***\nIllegal attribtues such as any event handlers `onclick`, `onload`, `onkeypress` are ignored:\n\n```\n'en': {\n  ...\n  'illegal-attributes': 'I have some \u003cdiv onClick=\"myClickHandler();\"\u003eClick here\u003c/div\u003e translation'\n  ...\n};\n\n// rendering\n\u003cdiv className=\"illegal-attribtues-example\"\u003e\n   \u003cTranslate i18nKey=\"illegal-attributes\" /\u003e\n\u003c/div\u003e\n\n// will generate the following DOM with no event handlers\n\u003cdiv class=\"illegal-attribtues-example\"\u003e\n  I have some \u003cdiv\u003eClick here\u003c/div\u003e translation\n\u003c/div\u003e\n```\nYou should not be using event handlers in translations. If you are in a situation that is required, then your code design is possibly flawed and is opening up to future issues. We recommend refactoring the approach.\n\n## Link Click Handling\n\nIn general, applcations have their own way of handling link clicks. Such as opening on a new tab, etc. This can be initialised one time at the start of your application.\n\n```\nimport Translate from '@pureartisans/simple-i18n-react';\n\nTranslate.setDefaultLinkHandler(function(link) { // link was taken from 'href' attribute\n   // my awesome way to handle the link click\n   myAwesomeUrlClickHandler.open(link);\n});\n\n```\n\nNow that you have already setup a general link handler, perhaps you want to change the way a single link works compared to the rest of the links:\n\n```\nconst languages = {\n   'en': {\n      'feedback.body': 'Please leave us some \u003ca href=\"feedback-handler\"\u003efeedback\u003c/a\u003e.'\n   }\n};\n\n// my custom click handler\nvar myFeedbackClickHandler = function() {\n  // open feedback popup\n};\n\n// let's create a simple component, but override the default link handler just for this component\nconst HelpInfo = () =\u003e (\n  \u003cdiv className=\"feedback-section\"\u003e\n    \u003cTranslate i18nKey=\"feedback.body\" onLinkClick={myFeedbackClickHandler} /\u003e\n  \u003c/div\u003e\n);\n\n```\n***NOTE*** In the above example, in order for link handling to be triggered when a user clicks on the link, we had to set `href` to something other than empty string or `#`. If `href` is not provided, is empty or set to `#`, the click handling is ignored.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpureartisan%2Fsimple-i18n-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpureartisan%2Fsimple-i18n-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpureartisan%2Fsimple-i18n-react/lists"}