{"id":14957091,"url":"https://github.com/intuit/text-provider","last_synced_at":"2025-04-03T02:12:06.611Z","repository":{"id":39042640,"uuid":"161730805","full_name":"intuit/text-provider","owner":"intuit","description":"A react component which provides all the string constants using provider pattern","archived":false,"fork":false,"pushed_at":"2024-10-26T06:08:18.000Z","size":691,"stargazers_count":24,"open_issues_count":17,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T23:07:37.462Z","etag":null,"topics":["hacktoberfest","node","npm","provider","react","react-js"],"latest_commit_sha":null,"homepage":"","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/intuit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","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-12-14T04:18:54.000Z","updated_at":"2024-08-23T18:44:12.000Z","dependencies_parsed_at":"2023-09-28T21:34:28.696Z","dependency_job_id":"0afb33c0-582f-497c-a728-d1b7dddf21b8","html_url":"https://github.com/intuit/text-provider","commit_stats":{"total_commits":103,"total_committers":11,"mean_commits":9.363636363636363,"dds":0.5825242718446602,"last_synced_commit":"54982d829b599ead4d40f5d11d305c45b00a96f1"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intuit%2Ftext-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intuit%2Ftext-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intuit%2Ftext-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intuit%2Ftext-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intuit","download_url":"https://codeload.github.com/intuit/text-provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246922248,"owners_count":20855345,"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":["hacktoberfest","node","npm","provider","react","react-js"],"created_at":"2024-09-24T13:14:04.213Z","updated_at":"2025-04-03T02:12:06.584Z","avatar_url":"https://github.com/intuit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg\n        width=\"200\" height=\"200\"\n        src=\"./logo.png\"\n    /\u003e\n    \u003ch1\u003etext-provider\u003c/h1\u003e\n    \u003cp\u003e\n        A component which provides all the string constants using provider pattern\n    \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://circleci.com/gh/intuit/text-provider\"\u003e\n        \u003cimg\n            src=\"https://img.shields.io/circleci/project/github/intuit/text-provider/master.svg?style=flat-square\u0026logo=circleci\"\n            alt=\"CircleCI\"\n        /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/text-provider\"\u003e\n        \u003cimg\n            src=\"https://img.shields.io/npm/v/text-provider.svg?style=flat-square\u0026logo=npm\"\n            alt=\"npm\"\n        /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/intuit/text-provider/graphs/contributors\"\u003e\n        \u003cimg\n            src=\"https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square\u0026logo=github\"\n            alt=\"All Contributors\"\n        /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/text-provider\"\u003e\n        \u003cimg\n            src=\"https://img.shields.io/npm/dt/text-provider.svg?style=flat-square\u0026logo=npm\"\n            alt=\"npm\"\n        /\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\nText provider is a library to place all the string constants of an application in a single place and use them inside the components in a memory friendly way.\n\nIt provides two components:\n\n1. [TextProvider](src/TextProvider.jsx)\n2. [FormattedMessage](src/FormattedMessage.jsx)\n\n## Install\n\n```bash\nnpm i text-provider\n```\n\n## Usage\n\n1. Import the string constants required for the particular presentational component:\n\n```javascript\nconst sampleText = require(\"src/nls/sample-text.json\");\n```\n\n2. Use the [TextProvider](src/TextProvider.jsx) to make it available for all the components:\n\n```jsx\n\u003cTextProvider globalText={sampleText} \u003e\n  \u003cMyPresentationalComponent /\u003e\n\u003c/TextProvider\u003e\n```\n\n3. Use it inside the presentational component:\n\n```jsx\n\u003cFormattedMessage id=\"Random Id\"/\u003e\n```\n\n```jsx\nconst randomId = \"Random Id\";\nconst values = {\n  \"valueToBeInjected\": \"Random Value\"\n};\n\n\u003cFormattedMessage id={randomId} values={values}/\u003e\n```\n\nWorks like a format string also. Example JSON:\n\n```json\n{\n  \"Random Id\": \"\u003cb\u003eRandom Text Returns\u003c/b\u003e {valueToBeInjected} for each text)\"\n}\n```\n\nThen ``${valueToBeInjected}`` gets replaced with the value specified in `values`.\n\nMake sure that a string by the same `id` exists in the JSON file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintuit%2Ftext-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintuit%2Ftext-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintuit%2Ftext-provider/lists"}