{"id":17058132,"url":"https://github.com/onigoetz/i18n","last_synced_at":"2025-04-12T17:44:09.682Z","repository":{"id":36966348,"uuid":"276197032","full_name":"onigoetz/i18n","owner":"onigoetz","description":"I18n Libraries and tools","archived":false,"fork":false,"pushed_at":"2024-04-10T17:05:11.000Z","size":14692,"stargazers_count":8,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-10T20:57:31.366Z","etag":null,"topics":["i18n","icu-messageformat","intl","l10n","messageformat","translation","typescript"],"latest_commit_sha":null,"homepage":"https://onigoetz.github.io/i18n/","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/onigoetz.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}},"created_at":"2020-06-30T20:03:13.000Z","updated_at":"2024-04-15T14:59:54.832Z","dependencies_parsed_at":"2023-02-15T04:46:31.520Z","dependency_job_id":"54133361-295c-4639-a5f0-c81aca9e8f33","html_url":"https://github.com/onigoetz/i18n","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onigoetz%2Fi18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onigoetz%2Fi18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onigoetz%2Fi18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onigoetz%2Fi18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onigoetz","download_url":"https://codeload.github.com/onigoetz/i18n/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248609252,"owners_count":21132876,"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":["i18n","icu-messageformat","intl","l10n","messageformat","translation","typescript"],"created_at":"2024-10-14T10:28:55.955Z","updated_at":"2025-04-12T17:44:09.644Z","avatar_url":"https://github.com/onigoetz.png","language":"TypeScript","readme":"# @onigoetz/i18n\n\n[![Latest version](https://img.shields.io/github/release/onigoetz/i18n.svg?style=flat-square)](https://github.com/onigoetz/i18n/releases)\n![License](https://img.shields.io/github/license/onigoetz/i18n?style=flat-square)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/onigoetz/i18n/node.js.yml?style=flat-square\u0026logo=github)\n[![Sonar Coverage](https://sonarcloud.io/api/project_badges/measure?project=onigoetz_i18n\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=onigoetz_i18n)\n[![Sonar Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=onigoetz_i18n\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=onigoetz_i18n)\n[![NPM Downloads](https://img.shields.io/npm/dm/@onigoetz/messageformat?style=flat-square\u0026logo=npm)](https://www.npmjs.com/package/@onigoetz/messageformat)\n\nA suite of packages to ease your translation needs.\n\n## Packages\n\n- `@onigoetz/messageformat` a MessageFormat parsing and rendering library\n- `@onigoetz/make-plural` a lighter fork of `make-plural` meant for browser usage\n- `@onigoetz/intl-formatters` default formatters if you don't already have formatters for dates and numbers, uses the standard `Intl` API\n\n## Features\n\n- Small, Fast and no NPM dependencies\n- TypeScript ❤️\n- Fully tested\n- Flexible; Use one package, or two, bring your own formatters, or use the embedded ones, use on Node.js, or in the browser. You choose !\n- ICU MessageFormat compatible\n- CLDR compatible\n\n## Example\n\n```typescript\nimport { parse, createRenderer } from \"@onigoetz/messageformat\";\nimport {\n  dateFormatter,\n  numberFormatter,\n  pluralGenerator,\n} from \"@onigoetz/intl-formatters\";\n\n// Parse the MessageFormat to a renderable format\nconst parsed = parse(\"{test, plural, offset:3 one{one test} other {# test} }\");\n\n// Create a localized renderer\nconst render = createRenderer(\n  \"en\",\n  (locale: T, type) =\u003e pluralGenerator(locale, { type }),\n  (locale: T, options, value: number) =\u003e\n    numberFormatter(locale, options)(value),\n  (locale: T, options, value: Date) =\u003e dateFormatter(locale, options)(value)\n);\n\nrender(parsed, { test: 4 }); // =\u003e \"one test\"\nrender(parsed, { test: 7 }); // =\u003e \"4 test\"\n```\n\n## Who is the audience for this library ?\n\nThis library is meant for applications starting with medium scale, where you might have multiple libraries and frameworks inside.\nSince these libraries don't make any assumption about your stack, you can integrate them in any kind of application.\n\nMost importantly, if you have an environment where pre-compiling translations isn't possible,\nfor example because your translation build process is separate from your app build process or you have a modular application / microfrontend.\n\nThis library is very interesting as a lightweight runtime because of its small footprint and performant parsing.\n\n## Inspiration\n\nThis suite of packages certainly wouldn't exist without the previous work in the field.\n\nThis package forked [`make-plural`](https://www.npmjs.com/package/make-plural) at version 4 to make it smaller.\nTook inspiration for the MessageFormat parser from [`@ffz/icu-msgparser`](https://www.npmjs.com/package/@ffz/icu-msgparser)\nfor its small size and [`@phensley/messageformat`](https://www.npmjs.com/package/@phensley/messageformat) for its parsing speed.\n\n## Building\n\n- `yarn build`\n- `yarn test`\n\n## Linting\n- `yarn format --write`\n- `yarn check --apply`","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonigoetz%2Fi18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonigoetz%2Fi18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonigoetz%2Fi18n/lists"}