{"id":51200318,"url":"https://github.com/softwarity/polyglot","last_synced_at":"2026-06-28T00:01:32.402Z","repository":{"id":361842292,"uuid":"1256082758","full_name":"softwarity/polyglot","owner":"softwarity","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-01T13:21:08.000Z","size":94,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-01T14:26:09.795Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://softwarity.github.io/polyglot/","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/softwarity.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-01T12:52:49.000Z","updated_at":"2026-06-01T13:25:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/softwarity/polyglot","commit_stats":null,"previous_names":["softwarity/polyglot"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/softwarity/polyglot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwarity%2Fpolyglot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwarity%2Fpolyglot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwarity%2Fpolyglot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwarity%2Fpolyglot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softwarity","download_url":"https://codeload.github.com/softwarity/polyglot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwarity%2Fpolyglot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34872279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-06-28T00:01:31.706Z","updated_at":"2026-06-28T00:01:32.397Z","avatar_url":"https://github.com/softwarity.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @softwarity/polyglot\n\n[![npm version](https://img.shields.io/npm/v/@softwarity/polyglot.svg)](https://www.npmjs.com/package/@softwarity/polyglot)\n[![license](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)\n[![Angular](https://img.shields.io/badge/Angular-%E2%89%A517-dd0031)](https://angular.dev/guide/i18n)\n[![Node](https://img.shields.io/badge/Node-%E2%89%A518-brightgreen)](https://nodejs.org)\n[![CI](https://img.shields.io/github/actions/workflow/status/softwarity/polyglot/ci.yml?logo=githubactions\u0026logoColor=white\u0026label=CI)](https://github.com/softwarity/polyglot/actions/workflows/ci.yml)\n\n\u003e Serve **every locale** of an Angular i18n app at once, behind a single dev port.\n\n`ng serve` runs one locale at a time, so you never see the real multi-locale URL\nshape in development. **polyglot** reads your `angular.json`, spawns one `ng serve`\nper locale on a private port, and puts a single proxy in front — so `/en/`, `/fr/`,\n`/vi/`… all work from one URL, exactly like the deployed site.\n\n📖 **Documentation:** https://softwarity.github.io/polyglot/\n\n## Install\n\n```bash\nnpm i -D @softwarity/polyglot\n```\n\n## Quick start\n\n```bash\n# 1. Add a ready-to-run script to package.json (writes \"start:i18n\")\nnpx polyglot init\n\n# 2. Run it — pick which locales to start\nnpm run start:i18n\n```\n\n`init` writes the defaults so you can see and tweak them:\n\n```json\n\"scripts\": {\n  \"start:i18n\": \"polyglot --config=./angular.json --port=4200\"\n}\n```\n\nAt launch, polyglot reads your locales and asks which to run (nothing is saved):\n\n```text\nProject: my-app — source locale: en — baseHref: /\n\nAvailable locales:\n  1. en  (source)\n  2. fr\n  3. vi\n\nWhich locales to run? Comma-separated numbers (e.g. \"1,3\"), \"all\" (default), or \"q\" to quit: all\n\n▸ Proxy listening on 0.0.0.0:4200 — open one of:\n    Local:   http://localhost:4200/\n    en       → http://localhost:4200/en/  (ng serve :49b1)\n    fr       → http://localhost:4200/fr/  (ng serve :49b2)\n    vi       → http://localhost:4200/vi/  (ng serve :49b3)\n▸ Fallback locale: en\n```\n\n## Commands \u0026 options\n\n```bash\npolyglot [options]         # Start the multi-locale dev proxy (default)\npolyglot init [options]    # Add a \"start:i18n\" script to package.json\npolyglot --help            # Show usage\n```\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `--config=\u003cpath\u003e` | `./angular.json` | Angular workspace config to read locales from |\n| `--project=\u003cname\u003e` | first project | Project to serve (multi-project workspaces) |\n| `--port=\u003cnumber\u003e` | `4200` (or `$PROXY_PORT`) | Public port for the proxy |\n| `--help` | — | Print usage and exit |\n\nThere is intentionally **no** `--prebundle` flag and **no** locale flag: locales are\nchosen interactively, and Vite prebundling is derived from your selection (off for\nmultiple locales, on for one — see below).\n\n## How it works\n\n- Reads `i18n`, `baseHref` and `serve` configs from `angular.json`.\n- Picks a free **private** port per locale and spawns `ng serve --configuration=\u003clocale\u003e`\n  bound to `127.0.0.1`.\n- Runs **one** Express proxy on the public port, routing each locale's `subPath`\n  (`\u003cbaseHref\u003e\u003csubPath\u003e`) to its `ng serve` instance; any other path redirects to the source locale.\n- Tears everything down on exit (`SIGTERM` → `SIGKILL`) — no orphan servers.\n\n**Prebundling.** Angular's dev-server runs on Vite, which pre-bundles dependencies into\na shared `.angular/cache` directory. With several `ng serve` running at once, each\noptimizer keeps invalidating the others (*\"There is a new version of the pre-bundle…\"*),\nwedging SSR in a re-optimize loop. So polyglot disables prebundling automatically when\nmore than one locale runs, and keeps it on for a single locale.\n\n## Requirements\n\nA standard Angular i18n setup in `angular.json`:\n\n- an `i18n` block with `sourceLocale` and `locales` (each may declare a `subPath`);\n- a **build** configuration per locale with a matching `baseHref` (`\"/\u003csubPath\u003e/\"`);\n- a **serve** configuration per locale (`ng serve --configuration=\u003ccode\u003e`).\n\nSee the [Angular setup guide](https://softwarity.github.io/polyglot/#/angular-setup).\n\n## License\n\nMIT © [Softwarity](https://www.softwarity.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwarity%2Fpolyglot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftwarity%2Fpolyglot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwarity%2Fpolyglot/lists"}