{"id":20904659,"url":"https://github.com/sage/f-locale","last_synced_at":"2026-01-11T22:59:40.146Z","repository":{"id":21057317,"uuid":"91719005","full_name":"Sage/f-locale","owner":"Sage","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-16T10:25:42.000Z","size":266,"stargazers_count":0,"open_issues_count":11,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-08T15:17:06.831Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Sage.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-18T17:12:43.000Z","updated_at":"2020-03-24T11:09:50.000Z","dependencies_parsed_at":"2024-11-18T13:30:10.819Z","dependency_job_id":null,"html_url":"https://github.com/Sage/f-locale","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":0.09090909090909094,"last_synced_commit":"b414da9ac56c78eadd906fa04a4747889117429e"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Ff-locale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Ff-locale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Ff-locale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sage%2Ff-locale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sage","download_url":"https://codeload.github.com/Sage/f-locale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246747222,"owners_count":20827105,"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":[],"created_at":"2024-11-18T13:18:24.514Z","updated_at":"2026-01-11T22:59:40.133Z","avatar_url":"https://github.com/Sage.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# f-locale\n\nLocalization helper for f-promise\n\n`f-locale` is a companion package for [`f-promise`](https://github.com/Sage/f-promise).\nIt provides a small helper to manage localized messages.\n\n## Installation\n\n```sh\nnpm install --save f-locale\n```\n\n## Usage\n\nResources must be placed in JSON files inside a `resources` subdirectory of the current directory:\n\n```sh\nsource-folder/\n    resources/\n        module1-en.json\n        module1-fr.json\n        ...\n        module2-en.json\n        module2-fr.json\n        ...\n    module1.ts\n    module2.ts\n```\n\nThe JSON files contain a simple object hash:\n\n```json\n{\n    \"simple\": \"a simple message\",\n    \"complex\": \"a more complex message with {{0}} and {{1}} args\"\n}\n```\n\n`f-locale` uses [handlebars](http://handlebarsjs.com/) formatting directives.\n\nBasic usage:\n\n```js\nimport { locale } from 'f-locale';\nconst resources = locale.resources(module);\n\n// setting the locale\nlocale.current = 'fr';\n// loading a simple message\nconsole.log(resources.message('simple'));\n// formating a parameterized message\ncconsole.log(resources.format('complex', 'hello', 5));\n```\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsage%2Ff-locale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsage%2Ff-locale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsage%2Ff-locale/lists"}