{"id":17651320,"url":"https://github.com/raiondesu/intl-schematic","last_synced_at":"2025-05-07T07:11:08.180Z","repository":{"id":209873501,"uuid":"724840507","full_name":"Raiondesu/intl-schematic","owner":"Raiondesu","description":"Yet another simple and lightweight i18n library","archived":false,"fork":false,"pushed_at":"2024-06-06T15:27:12.000Z","size":482,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-09T10:01:49.242Z","etag":null,"topics":["formatting-text","i18n","intl","l10n","localization","schema","schematic","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/intl-schematic","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/Raiondesu.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}},"created_at":"2023-11-28T22:38:31.000Z","updated_at":"2024-06-06T15:27:15.000Z","dependencies_parsed_at":"2023-12-20T11:56:45.228Z","dependency_job_id":"16fe7c84-cafe-4e24-b10c-990e71647a5f","html_url":"https://github.com/Raiondesu/intl-schematic","commit_stats":null,"previous_names":["raiondesu/intl-schematic"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raiondesu%2Fintl-schematic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raiondesu%2Fintl-schematic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raiondesu%2Fintl-schematic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raiondesu%2Fintl-schematic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Raiondesu","download_url":"https://codeload.github.com/Raiondesu/intl-schematic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242930151,"owners_count":20208408,"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":["formatting-text","i18n","intl","l10n","localization","schema","schematic","typescript","typescript-library"],"created_at":"2024-10-23T11:40:50.840Z","updated_at":"2025-03-10T21:31:04.347Z","avatar_url":"https://github.com/Raiondesu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\r\n  \u003cpicture\u003e\r\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"./logo/Dark%20Logo.svg\"\u003e\r\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"./logo/Light%20Logo.svg\"\u003e\r\n    \u003cimg alt=\"intl-schematic\" src=\"./logo/Light%20Logo.svg\"\u003e\r\n  \u003c/picture\u003e\r\n\u003c/h1\u003e\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n\r\nStupidly simple, incredibly tiny, blazingly fast.\r\n\r\nThis is a tiny framework-agnostic i18n library (1-3kb, zero-dependency)\\\r\nthat allows to localize and format strings\\\r\nwhile sparingly using the browser-standard [`Intl` API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl).\r\n\r\n`npm i -s intl-schematic`\r\n\r\nYou can also install a nightly build\\\r\n[directly from github](#install-from-github)\r\n\r\nFor more usage examples, see\\\r\nthe [main package readme](/packages/core/README.md)\r\n\r\n[List of packages](#packages)\r\n\r\n\u003c/div\u003e\r\n\r\n---\r\n\r\n### Simple usage example\r\n\r\n```ts\r\nimport { createTranslator } from 'intl-schematic';\r\n\r\n// Define a translation document factory\r\nconst getDocument = () =\u003e ({\r\n  \"hello\": \"Hello, World!\"\r\n});\r\n\r\n// Create a translator function (`t()`)\r\nconst t = createTranslator(getDocument);\r\n\r\n// Use the translator function\r\nconsole.log(t('hello')); // `Hello, World!`\r\n```\r\n\r\n## Features\r\n\r\n- 🦺 **Full type-safety**: full autocomplete on translation keys, typed translation parameters and more;\r\n- 🌌 **Truly universal**: one-size-fits-all solution - able to suit any project setup;\r\n- 🎄 **Tree-shakable**: only take what you need;\r\n- 🎈 **Incredibly lightweight**: less than 1kb for the core package, less than 5kb for every feature imaginable.\r\n- 🧩 **Easily integrates with UI-frameworks**: we don't play favorites here - [every framework can use this library](/packages/core/README.md#using-with-reactive-frameworks);\r\n- 🔌 **Pluginable**: extend any processing step without limits - see the [plugins API](/packages/plugins/) for more;\r\n- 📑 **Reference translation keys inside of other translation keys**: all with JSON-compatible syntax;\r\n- 📃 **JSON-validation using a [JSON-schema](/packages/core/README.md#using-with-json-schema)**: intellisense and popup hints right in the translation document;\r\n- 🚫 **No string-interpolation**: translation strings will never be processed or mangled by-default, so all unicode symbols are safe to use;\r\n- 🌐 **Basic localized formatters**: declare formatting rules and translations in the same place.\r\n- 🧵 **Dynamic strings with custom pre-processors**: write custom translation logic right in JSON;\r\n\r\n## Why\r\n\r\nI've grown frustrated with current implementations of popular l10n/i18n libraries, many of which:\r\n- lack runtime JSON support,\r\n- rely on custom-written localization and formatting logic (a lot of which is already implemented in `Intl`),\r\n- are over-tailored to specific frameworks or SaaS solutions,\r\n- force to define translation documents at compile/build-time or using a specific pipeline,\r\n- lack support for modular translation documents or asynchronous/real-time localization,\r\n- interpolate over translated strings - resulting in overreliance on custom string template syntax - different for each library,\r\n- force a certain architecture on a project.\r\n\r\nThis library will try to avoid these common pitfalls, while retaining a small size and good performance.\r\n\r\n## No-goals\r\n\r\nEven though custom plugins can do literally anything with keys, values and translation documents,\\\r\nthe core library will **not** support:\r\n- **Translation key nesting using dot-notation**: needlessly complicates key lookup and maintenance;\r\n  - Instead use namespaced keys or the [`nested` plugin](/packages/plugins/nested) (which supports dot-notation!);\r\n- **String interpolation**: the library by-itself does not and will not do any processing on the strings.\r\n\r\n## Contributing\r\n\r\nTo contribute, create a branch and make a PR to `main`, or [create an issue](https://github.com/Raiondesu/intl-schematic/issues/new).\r\n\r\n### Packages\r\n\r\nThis project utilizes a monorepo structure based on [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces/),\\\r\nwith the main package being, of course, [`intl-schematic`](/packages/core/).\r\n\r\nFull list of packages at the moment:\r\n- [`intl-schematic`](/packages/core/) - main package\r\n- [`@intl-schematic/cli`](/packages/cli/) - cli package, used for automating different manual work when setting up the library\r\n- [`@intl-schematic/solid`](/packages/solid/) - reactive adapter for [`solid-js`](https://www.solidjs.com)\r\n- [`@intl-schematic/vue`](/packages/vue/) (WIP) - reactive adapter for [`vue`](https://vuejs.org)\r\n- [`@intl-schematic/react`](/packages/react/) (WIP) - reactive adapter for [`react`](https://react.com)\r\n- [Plugins](/packages/plugins/) - allow using custom formats in translation documents - not just strings:\r\n  - [`@intl-schematic/plugin-defaults`](/packages/plugins/defaults/)\r\n    - recommended collection of plugins that should be useful to most applications\r\n  - [`@intl-schematic/plugin-arrays`](/packages/plugins/arrays/) (included in **defaults**) - includes a [JSON-schema](/packages/core/README.md#using-with-json-schema)\r\n    - use arrays to cross-reference keys and define complex multiline texts\r\n  - [`@intl-schematic/plugin-functions`](/packages/plugins/functions/)\r\n    - use plain functions directly in translation documents with type-checked parameters\r\n  - [`@intl-schematic/plugin-locale`](/packages/plugins/locale/) (included in **defaults**)\r\n    - provider plugin, allows other plugins to use the provided `Intl.Locale` instance\r\n  - [`@intl-schematic/plugin-nested`](/packages/plugins/nested/) - includes a [JSON-schema](/packages/core/README.md#using-with-json-schema)\r\n    - access nested keys in deep multi-level objects\r\n  - [`@intl-schematic/plugin-processors`](/packages/plugins/processors/) (included in **defaults**) - includes a [JSON-schema](/packages/core/README.md#using-with-json-schema)\r\n    - apply custom and default processors to format the user inputs\r\n\r\n- [`tsconfig`](/packages/tsconfig/) - typescript config used by the packages\r\n\r\n### Local development\r\n\r\nTo develop locally, simply clone, and run the following in the root directory:\r\n```\r\nnpm i -ws\r\n```\r\n\r\nThe project uses TypeScript v5.3+\r\n\r\n#### Build\r\n\r\nSimply run\r\n```\r\nnpm run build\r\n```\r\nto rebuild any changed packages.\r\n\r\n### Install from github\r\n\r\nIn order to evaluate and test the newest version that is yet to be released on npm, simply install from github:\r\n\r\n```\r\nnpm install 'https://gitpkg.now.sh/Raiondesu/intl-schematic/packages/core?main'\r\n```\r\n\r\n\u003e ⚠ **Nightly builds are unstable and may be broken** ⚠\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraiondesu%2Fintl-schematic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraiondesu%2Fintl-schematic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraiondesu%2Fintl-schematic/lists"}