{"id":28466611,"url":"https://github.com/locize/fluent-translation-parser","last_synced_at":"2025-06-30T23:32:31.961Z","repository":{"id":33006335,"uuid":"149430853","full_name":"locize/fluent-translation-parser","owner":"locize","description":"parses fluent translations to AST","archived":false,"fork":false,"pushed_at":"2023-03-03T07:53:22.000Z","size":647,"stargazers_count":3,"open_issues_count":8,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-07T07:04:52.683Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/locize.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-09-19T10:05:39.000Z","updated_at":"2024-03-15T11:54:10.000Z","dependencies_parsed_at":"2024-10-30T22:51:41.651Z","dependency_job_id":"1884af3c-80f2-4096-96ef-6c5796d92861","html_url":"https://github.com/locize/fluent-translation-parser","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":"0.33333333333333337","last_synced_commit":"d4b6562550822ada7bee988aa3f98ef635d7ef42"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/locize/fluent-translation-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Ffluent-translation-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Ffluent-translation-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Ffluent-translation-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Ffluent-translation-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locize","download_url":"https://codeload.github.com/locize/fluent-translation-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Ffluent-translation-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259820791,"owners_count":22916544,"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":"2025-06-07T07:04:51.993Z","updated_at":"2025-06-30T23:32:31.949Z","avatar_url":"https://github.com/locize.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\n[![Travis](https://img.shields.io/travis/locize/fluent-translation-parser/master.svg?style=flat-square)](https://travis-ci.org/i18next-translation-parser)\n[![Coveralls](https://img.shields.io/coveralls/locize/fluent-translation-parser/master.svg?style=flat-square)](https://coveralls.io/github/locize/fluent-translation-parser)\n[![npm version](https://img.shields.io/npm/v/i18next-translation-parser.svg?style=flat-square)](https://www.npmjs.com/package/i18next-translation-parser)\n[![David](https://img.shields.io/david/locize/fluent-translation-parser.svg?style=flat-square)](https://david-dm.org/locize/fluent-translation-parser)\n\nThis is a module to parse an i18next translation string into an AST and back to a string.\n\n# Getting started\n\nSource can be loaded via [npm](https://www.npmjs.com/package/fluent-translation-parser) or [downloaded](https://github.com/locize/fluent-chained-backend/blob/master/fluentTranslationParser.min.js) from this repo.\n\n```\n# npm package\n$ npm install fluent-translation-parser\n```\n\n# Sample\n\n```js\nimport { parse, stringify } from \"fluent-translation-parser\";\n\nconst AST = parse(`\n    { $unreadEmails -\u003e\n        [one] You have one unread email.\n       *[other] You have { $unreadEmails } unread emails.\n    }\n`);\n// will return\n/*\n[\n  {\n    \"type\": \"text\",\n    \"content\": \"    { $unreadEmails -\u003e\\n        [one] You have one unread email.\\n       *[other] You have { $unreadEmails } unread emails.\\n    }\",\n    \"children\": [\n      {\n        \"type\": \"text\",\n        \"content\": \"    \"\n      },\n      {\n        \"type\": \"selector\",\n        \"raw\": \"{ $unreadEmails -\u003e\",\n        \"prefix\": \"{\",\n        \"suffix\": \"-\u003e\",\n        \"content\": \" $unreadEmails \",\n        \"variable\": \"unreadEmails\"\n      },\n      {\n        \"type\": \"text\",\n        \"content\": \"\\n        \"\n      },\n      {\n        \"type\": \"variant\",\n        \"isDefault\": false,\n        \"raw\": \"[one]\",\n        \"prefix\": \"[\",\n        \"suffix\": \"]\",\n        \"content\": \"one\",\n        \"variable\": \"one\"\n      },\n      {\n        \"type\": \"text\",\n        \"content\": \" You have one unread email.\\n       \"\n      },\n      {\n        \"type\": \"variant\",\n        \"isDefault\": true,\n        \"raw\": \"*[other]\",\n        \"prefix\": \"*[\",\n        \"suffix\": \"]\",\n        \"content\": \"other\",\n        \"variable\": \"other\"\n      },\n      {\n        \"type\": \"text\",\n        \"content\": \" You have \"\n      },\n      {\n        \"type\": \"variable\",\n        \"raw\": \"{ $unreadEmails }\",\n        \"prefix\": \"{\",\n        \"suffix\": \"}\",\n        \"content\": \" $unreadEmails \",\n        \"variable\": \"unreadEmails\"\n      },\n      {\n        \"type\": \"text\",\n        \"content\": \" unread emails.\\n    \"\n      },\n      {\n        \"type\": \"closingBracket\",\n        \"raw\": \"}\",\n        \"prefix\": \"\",\n        \"suffix\": \"}\",\n        \"content\": \"\"\n      },\n      {\n        \"type\": \"text\",\n        \"content\": \"\"\n      }\n    ]\n  }\n]\n*/\nstringify(AST);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocize%2Ffluent-translation-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocize%2Ffluent-translation-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocize%2Ffluent-translation-parser/lists"}