{"id":19251350,"url":"https://github.com/springtype-org/st-i18n","last_synced_at":"2025-02-23T16:40:40.300Z","repository":{"id":57369100,"uuid":"336413570","full_name":"springtype-org/st-i18n","owner":"springtype-org","description":"~500 byte nano library for internationalization","archived":false,"fork":false,"pushed_at":"2021-03-02T19:30:24.000Z","size":421,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T12:38:31.617Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/springtype-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-05T23:30:10.000Z","updated_at":"2021-03-02T19:30:27.000Z","dependencies_parsed_at":"2022-09-15T21:31:10.983Z","dependency_job_id":null,"html_url":"https://github.com/springtype-org/st-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/springtype-org%2Fst-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springtype-org%2Fst-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springtype-org%2Fst-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springtype-org%2Fst-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/springtype-org","download_url":"https://codeload.github.com/springtype-org/st-i18n/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240347763,"owners_count":19787230,"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":[],"created_at":"2024-11-09T18:22:01.759Z","updated_at":"2025-02-23T16:40:40.282Z","avatar_url":"https://github.com/springtype-org.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eSpringType: st-i18n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  Nano library for client-side translation\n\u003c/p\u003e\n\n[![Gitter](https://badges.gitter.im/springtype-official/springtype.svg)](https://gitter.im/springtype-official/springtype?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\n\u003ch2 align=\"center\"\u003ePurpose\u003c/h2\u003e\n\nThis is an exremely tiny, yet powerful library for translation. `st-i18n` does also handle string interpolation for advanced translation needs.\n\n\u003ch2 align=\"center\"\u003eFeatures\u003c/h2\u003e\n\n- ✅ Implements a simple, i18next-like API including string interpolation\n- ✅ Comes with namespace support\n- ✅ Tiny: `441 bytes` (best, brotli) - `599 bytes` (worst, umd, gz)\n- ✅ Zero dependencies\n- ✅ First class TypeScript support\n- ✅ 100% Unit Test coverage\n\n\u003ch2 align=\"center\"\u003eHow to\u003c/h2\u003e\n\nThis is how using `st-i18n` looks like:\n\n```tsx\nimport { tsx, render, Ref } from 'springtype';\nimport { $ } from 'st-query';\nimport { i18n } from 'st-i18n';\n\n// example with local translation source\nimport de from './assets/translation/de.json';\nimport en from './assets/translation/en.json';\n\nconst t = i18n.t(/* optional: provide a namespace name here */);\n\n/**\n * de.json:\n * e.g.:\n * {\n *   \"translation\": {\n *     \"Hello world, {name}\": \"Hallo {name}, Welt!\"\n *   }\n * }\n */\ni18n.load('de', de);\ni18n.load('en', en);\n\ni18n.language = 'de';\n\n// prints:  Hallo Jack, Welt!\nt('Hello world, {name}', {\n  name: 'Jack'\n});\n```\n\n\u003ch2 align=\"center\"\u003eAPI\u003c/h2\u003e\n\nThe following contract is made between the webapp and `st-i18n`:\n\n```typescript\nexport interface API {\n  language: string;\n  defaultNamespace: string;\n  trans: Translations;\n  t: (namespace?: string) =\u003e TFunction;\n  load: (language: string, translations: NamespaceTranslation) =\u003e API;\n}\n```\n\n\u003ch2 align=\"center\"\u003eBackers\u003c/h2\u003e\n\nThank you so much for supporting us financially! 🙏🏻😎🥳👍\n\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003cimg width=\"150\" height=\"150\"\n        src=\"https://avatars2.githubusercontent.com/u/17221813?v=4\u0026s=150\"\u003e\n        \u003c/br\u003e\n        \u003ca href=\"https://github.com/jsdevtom\"\u003eTom\u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003ctbody\u003e\n\u003c/table\u003e\n\n\u003ch2 align=\"center\"\u003eMaintainers\u003c/h2\u003e\n\n`st-i18n` is brought to you by:\n\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003cimg width=\"150\" height=\"150\"\n        src=\"https://avatars2.githubusercontent.com/u/12079044?s=150\u0026v=4\"\u003e\n        \u003c/br\u003e\n        \u003ca href=\"https://github.com/mansi1\"\u003eMichael Mannseicher\u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003cimg width=\"150\" height=\"150\"\n        src=\"https://avatars3.githubusercontent.com/u/454817?v=4\u0026s=150\"\u003e\n        \u003c/br\u003e\n        \u003ca href=\"https://github.com/kyr0\"\u003eAron Homberg\u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003ctbody\u003e\n\u003c/table\u003e\n\n\u003ch2 align=\"center\"\u003eContributing\u003c/h2\u003e\n\nPlease help out to make this project even better and see your name added to the list of our\n[CONTRIBUTORS.md](./CONTRIBUTORS.md) :tada:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringtype-org%2Fst-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspringtype-org%2Fst-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringtype-org%2Fst-i18n/lists"}