{"id":18883981,"url":"https://github.com/unsplash/intlc","last_synced_at":"2025-07-15T11:05:16.315Z","repository":{"id":37806395,"uuid":"436762971","full_name":"unsplash/intlc","owner":"unsplash","description":"Compile ICU messages into code. Supports TypeScript and JSX. No runtime.","archived":false,"fork":false,"pushed_at":"2024-11-21T12:43:00.000Z","size":895,"stargazers_count":60,"open_issues_count":38,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-11T03:05:59.007Z","etag":null,"topics":["icu","internationalization","localization","react","typesafe","typescript"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/unsplash.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-12-09T21:13:09.000Z","updated_at":"2025-03-16T16:44:08.000Z","dependencies_parsed_at":"2023-12-16T17:23:36.890Z","dependency_job_id":"e61011da-1007-4ef8-89ad-5b8f1cb78008","html_url":"https://github.com/unsplash/intlc","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/unsplash/intlc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unsplash%2Fintlc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unsplash%2Fintlc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unsplash%2Fintlc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unsplash%2Fintlc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unsplash","download_url":"https://codeload.github.com/unsplash/intlc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unsplash%2Fintlc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265430233,"owners_count":23763963,"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":["icu","internationalization","localization","react","typesafe","typescript"],"created_at":"2024-11-08T07:10:10.132Z","updated_at":"2025-07-15T11:05:16.270Z","avatar_url":"https://github.com/unsplash.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# intlc\n\nCompile ICU messages into code. Supports TypeScript and JSX. No runtime.\n\n- **Compatible** - supports most common ICU syntax [with some optional extras](https://github.com/unsplash/intlc/wiki/ICU-syntax).\n- **Typesafe** - embraces TypeScript output, taking advantage of unions to forgo the need for wildcards.\n- **Lightweight** - no runtime, so no bundle or performance bloat. Just plain functions.\n- **Fast** - compiles via a native binary. Most projects can expect everything to compile in under a second.\n- **Unopinionated** - JSON/ICU in, code out. Structure your application around this in whichever way suits you.\n- **Maintained** - in production at [unsplash.com](https://unsplash.com).\n\nhttps://user-images.githubusercontent.com/6402443/194868749-23c86dd1-4996-4c60-a0b6-88685078fb38.mov\n\n## CLI\n\nGrab a binary from the releases page: https://github.com/unsplash/intlc/releases\n\n```\nUsage: intlc COMMAND\n  Compile ICU messages into code.\n\nAvailable options:\n  -h,--help                Show this help text\n  --version                Print version information\n\nAvailable commands:\n  compile\n  flatten\n  lint\n  prettify\n```\n\n### Compiling\n\nTake a JSON object of ICU messages, and a locale, and output TypeScript to stdout.\n\n```console\n$ cat translations.json\n{\"welcome\":{\"message\": \"Hello {name}\"}}\n$ intlc compile translations.json -l en-US \u003e translations.ts\n$ cat translations.ts\nexport const welcome: (x: { name: string }) =\u003e string = x =\u003e `Hello ${x.name}`\n```\n\nCheck out an example project integration in our wiki: https://github.com/unsplash/intlc/wiki/Example-project-integration\n\n### Flattening\n\nHoist selectors up as much as possible. This is often preferred by translators.\n\n```console\n$ cat translations.json\n{\"openSource\":{\"message\": \"Open source at {company} is {company, select, Unsplash {encouraged!} other {unknown}}\"}}\n$ intlc flatten --minify translations.json\n{\"openSource\":{\"message\":\"{company, select, Unsplash {Open source at {company} is encouraged!} other {Open source at {company} is unknown}}\"}}\n```\n\n### Linting\n\nLint against suboptimal use of ICU syntax.\n\n```console\n$ cat translations.json\n{\"welcome\":{\"message\": \"Hello {name, select, other {{name}}}\"}}\n$ intlc lint translation.json\ntranslations.json:1:32:\n  |\n1 | {\"welcome\":{\"message\": \"Hello {name, select, other {{name}}}\"}}\n  |                                ^^^^\nredundant-select: Select named `name` is redundant as it only contains a wildcard.\n\nLearn more: https://github.com/unsplash/intlc/wiki/Lint-rules-reference#redundant-select\n```\n\nA reference for lint rules can be found in our wiki: https://github.com/unsplash/intlc/wiki/Lint-rules-reference\n\n### Formatting\n\nPretty-print an ICU message. Useful for inspecting larger messages such as flattened ones.\n\n```console\n$ cat translations.json\n{\"tagline\": {\"message\":\"{hasTags, boolean, true {{type, select, overLimit {{upperLimit, number}+ best free {formattedListOfTags} photos on Unsplash} belowLimit {{photoTotal, number} best free {formattedListOfTags} photos on Unsplash}}} false {{type, select, overLimit {{upperLimit, number}+ best free photos on Unsplash} belowLimit {{photoTotal, number} best free photos on Unsplash}}}}\"}}\n$ intlc prettify $(cat translations.json | jq -r .tagline.message)\n{hasTags, boolean,\n  true {{type, select,\n    overLimit {{upperLimit, number}+ best free {formattedListOfTags} photos on Unsplash}\n    belowLimit {{photoTotal, number} best free {formattedListOfTags} photos on Unsplash}\n  }}\n  false {{type, select,\n    overLimit {{upperLimit, number}+ best free photos on Unsplash}\n    belowLimit {{photoTotal, number} best free photos on Unsplash}\n  }}\n}\n\n```\n\n## Schema\n\nTranslation files should be encoded as JSON and might look something like this:\n\n```json\n{\n  \"welcome\": {\n    \"message\": \"Hello {name}\",\n    \"description\": \"Welcome message\",\n    \"backend\": \"ts\"\n  }\n}\n```\n\nAt present, the following backends (compilation targets) are supported:\n\n- TypeScript (`ts`, default)\n- TypeScript/React (`tsx`)\n\nThe description is optional and ignored by intlc. It can be used documentatively for developers and/or translators.\n\n## Contributing\n\nCheck out `ARCHITECTURE.md`.\n\nCurrently building against GHC 9.6.4. A Nix flake is included with all necessary dependencies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funsplash%2Fintlc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funsplash%2Fintlc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funsplash%2Fintlc/lists"}