{"id":48259283,"url":"https://github.com/helpwave/internationlization","last_synced_at":"2026-04-04T21:26:04.749Z","repository":{"id":325363125,"uuid":"1100693717","full_name":"helpwave/internationlization","owner":"helpwave","description":"Generating typesafe translation based on .arb files","archived":false,"fork":false,"pushed_at":"2025-11-26T19:51:06.000Z","size":131,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-29T15:59:28.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helpwave.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-20T16:15:46.000Z","updated_at":"2025-11-26T19:51:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/helpwave/internationlization","commit_stats":null,"previous_names":["helpwave/internationlization"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/helpwave/internationlization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpwave%2Finternationlization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpwave%2Finternationlization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpwave%2Finternationlization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpwave%2Finternationlization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helpwave","download_url":"https://codeload.github.com/helpwave/internationlization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpwave%2Finternationlization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31415003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-04-04T21:26:04.062Z","updated_at":"2026-04-04T21:26:04.735Z","avatar_url":"https://github.com/helpwave.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# helpwave internationlization\nhelpwaves package for internationalization that creates localized and typesafe translation based on ARB files.\n\n## Usage\nCreate a `.arb` file with your translations:\n```json\n{\n  \"priceInfo\": \"The price is {price}{currency, select, usd{$USD} eur{€} other{}}.\",\n  \"@priceInfo\": {\n    \"placeholders\": {\n      \"price\": {\n        \"type\": \"number\"\n      },\n      \"currency\": {}\n    }\n  }\n}\n```\nAnd get a translation:\n\n```typescript\nimport {combineTranslation} from \"@helpwave/internationalization\";\nimport {Translation} from \"@helpwave/internationalization\";\n\ntranslations[\"en-US\"].priceInfo?.({price, currency})\n\ntype ExtensionType = { name: string } \nconst extension: Translation\u003c\"fr-FR\", ExtensionType\u003e = {\n  \"fr-FR\": {\n    name: \"Charlemagne\"\n  }\n}\n\nconst t = combineTranslation([translations, extension], \"en-US\")\n// typesafe on both function parameters \n// and handles errors automatically -\u003e return = {{${locale}:${String(key)}}}\nt(\"priceInfo\", { price, currency })\n```\n\n## Getting Started\n#### Install the package\n```\nnpm install -D @helpwave/internationalization\n```\n#### Create local ARB files\nThe file structure could look like this:\n```\n/locales\n-\u003e de-DE.arb\n-\u003e en-US.arb\n/locales/time\n-\u003e de-DE.arb\n-\u003e en-US.arb\n```\n\nThen run:\n```bash\nnpx build-intl \n```\n\nBy default `./locales` will be translated to `./i18n`, the input directory and output file are configurable with:\n```\nUsage: i18n-compile [options]\n\nOptions:\n  -i, --in \u003cdir\u003e        Input directory containing .arb files\n  -o, --out \u003cfile\u003e      Output file (e.g. ./i18n/translations.ts)\n  -f, --force           Overwrite output without prompt\n  -h, --help            Show this help message\n`)\n```\n\n\n## Tests\nThe lexer, parser and compiler are all tested with jest, see [our tests](/tests)\n\n## Examples\nExample translation files and the resulting translation can be found in the [examples folder](/examples).\n\nRebuild the examples:\n```bash\nnpm run build\nnode dist/scripts/compile-arb.js --force -i ./examples/locales -o ./examples/translations/translations.ts -n \"exampleTranslation\"\n```\n\nReact hook example:\n```typescript\ntype UseHidetideTranslationOverwrites = {\n  locale?: HightideTranslationLocales,\n}\n\ntype HidetideTranslationExtension\u003cL extends string, T extends TranslationEntries\u003e\n  = PartialTranslationExtension\u003cL, HightideTranslationLocales, T, HightideTranslationEntries\u003e\n\nexport function useHightideTranslation\u003cL extends string, T extends TranslationEntries\u003e(\n  extensions?: SingleOrArray\u003cHidetideTranslationExtension\u003cL,T\u003e\u003e,\n  overwrites?: UseHidetideTranslationOverwrites\n) {\n  const { locale: inferredLocale } = useLocale()\n  const locale = overwrites?.locale ?? inferredLocale\n  const translationExtensions = ArrayUtil.resolveSingleOrArray(extensions)\n\n  return combineTranslation\u003cL | HightideTranslationLocales, T \u0026 HightideTranslationEntries\u003e([\n    ...translationExtensions,\n    hightideTranslation as HidetideTranslationExtension\u003cL,T\u003e\n  ], locale)\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpwave%2Finternationlization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelpwave%2Finternationlization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpwave%2Finternationlization/lists"}