{"id":16271056,"url":"https://github.com/b4rtaz/ultimate-i18n-js","last_synced_at":"2025-10-04T06:30:23.910Z","repository":{"id":62330429,"uuid":"559280791","full_name":"b4rtaz/ultimate-i18n-js","owner":"b4rtaz","description":"Simplest ever I18N 1 KB library for HTML/JavaScript apps.","archived":false,"fork":false,"pushed_at":"2022-10-31T18:48:27.000Z","size":142,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-08T16:48:32.253Z","etag":null,"topics":["i18n","i18n-js","internationalization","javascript","l10n","transaction"],"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/b4rtaz.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}},"created_at":"2022-10-29T16:12:52.000Z","updated_at":"2022-12-22T09:53:00.000Z","dependencies_parsed_at":"2023-01-20T22:47:16.485Z","dependency_job_id":null,"html_url":"https://github.com/b4rtaz/ultimate-i18n-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/b4rtaz/ultimate-i18n-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4rtaz%2Fultimate-i18n-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4rtaz%2Fultimate-i18n-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4rtaz%2Fultimate-i18n-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4rtaz%2Fultimate-i18n-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b4rtaz","download_url":"https://codeload.github.com/b4rtaz/ultimate-i18n-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4rtaz%2Fultimate-i18n-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278277114,"owners_count":25960423,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"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":["i18n","i18n-js","internationalization","javascript","l10n","transaction"],"created_at":"2024-10-10T18:12:18.484Z","updated_at":"2025-10-04T06:30:23.627Z","avatar_url":"https://github.com/b4rtaz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Ultimate I18n JS](.github/cover.png)\n\n# Ultimate I18n JS 🤯\n\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fb4rtaz%2Fultimate-i18n-js%2Fbadge%3Fref%3Dmain\u0026style=flat)](https://actions-badge.atrox.dev/b4rtaz/ultimate-i18n-js/goto?ref=main) [![License: MIT](https://img.shields.io/github/license/mashape/apistatus.svg)](/LICENSE) [![View this project on NPM](https://img.shields.io/npm/v/ultimate-i18n-js.svg)](https://npmjs.org/package/ultimate-i18n-js) [![Twitter: b4rtaz](https://img.shields.io/twitter/follow/b4rtaz.svg?style=social)](https://twitter.com/b4rtaz)\n\nUltimate internationalization library for web applications. \n\n* Super simple \u0026 easy.\n* Less than 1KB (minified and gziped).\n* 0 dependencies.\n* SEO friendly (default language will be indexed).\n* Automatic a user's language detection.\n* It remembers a language change (uses local storage).\n* JavaScript / TypeScript support.\n* Support all modern browsers (it uses the [MutationObserver](https://caniuse.com/mutationobserver) internally).\n\n#### 🤩 Online Examples\n\n* [Basic](https://b4rtaz.github.io/ultimate-i18n-js/examples/static-web-app/basic.html)\n* [Create Element](https://b4rtaz.github.io/ultimate-i18n-js/examples/static-web-app/create-element.html)\n* [Document Write](https://b4rtaz.github.io/ultimate-i18n-js/examples/static-web-app/document-write.html)\n* [Dynamic Text](https://b4rtaz.github.io/ultimate-i18n-js/examples/static-web-app/dynamic-text.html)\n* [Late Setup](https://b4rtaz.github.io/ultimate-i18n-js/examples/static-web-app/late-setup.html)\n\n## 🚀 Use with Static HTML Web App\n\nSet your default language code in the `html` tag.\n\n```html\n\u003chtml lang=\"en\"\u003e\n```\n\nAdd this library as **the first script** in your `\u003chead\u003e` section.\n\n```html\n\u003chead\u003e\n   \u003cscript src=\"https://cdn.jsdelivr.net/npm/ultimate-i18n-js@0.0.3/lib/index.min.js\"\u003e\u003c/script\u003e\n   ...\n\u003c/head\u003e\n```\n\nThat's it! 🤯 Now you can add language attributes to any element on your page.\n\n```html\n\u003cbody\u003e\n  \u003ch1\n    i18n-pl=\"Witaj świecie\"\n    i18n-es=\"Hola Mundo\"\u003e\n    Hello World \u003c!-- Your default language (en) --\u003e\n  \u003c/h1\u003e\n````\n\nTo change language call the `set` function.\n\n```js\nUltimateI18n.set('es');\n```\n\n```html\n\u003cbutton onclick=\"UltimateI18n.set('en');\"\u003eEN\u003c/button\u003e\n\u003cbutton onclick=\"UltimateI18n.set('es');\"\u003eES\u003c/button\u003e\n\u003cbutton onclick=\"UltimateI18n.set('pl');\"\u003ePL\u003c/button\u003e\n```\n\n➡ Check [examples for static HTML web apps](examples/static-web-app)\n\n## 🚀 Use with Module Bundler\n\nInstall this package.\n\n`npm install ultimate-i18n-js`\n\nSet your default language code in the `html` tag.\n\n```html\n\u003chtml lang=\"en\"\u003e\n```\n\nCall the `setup` method before your app start.\n\n```ts\nimport * as UltimateI18n from 'ultimate-i18n-js';\n\nUltimateI18n.setup();\n```\n\nThat's it! 🤯 Now you can add dynamicaly content to your app.\n\n```ts\ndocument.addEventListener('DOMContentLoaded', () =\u003e {\n  document.getElementById('placeholder').innerHTML = `\n    \u003cspan\n      i18n-pl=\"Kocham czerwony\"\n      i18n-es=\"Amo el rojo\"\u003e\n      I love red\n    \u003c/span\u003e\n  `;\n});\n```\n\nTo change language call the `set` function.\n\n```js\nUltimateI18n.set('es');\n```\n\n➡ Check [examples for Webpack apps](examples/webpack-app)\n\n## ⚒ API\n\n* `UltimateI18n.set('es')` - Changes the current language.\n* `UltimateI18n.get()` - Reads the current language.\n* `UltimateI18n.setup()` - Initializes the library. This step is required only for a late setup.\n* `UltimateI18n.isSupported` - Returns `true` if the library is enabled, otherwise `false`.\n\n## 👷‍♂️ TODO\n\nReact and Angular is not supported yet.\n\nThe dynamic attribute change is not supported yet. The below code currently doesn't work properly.\n\n```js\nconst season = document.getElementById('season');\nseason.innerHtml = 'Summer';\nseason.setAttribute('i18n-pl', 'Lato');\nseason.setAttribute('i18n-es', 'El verano');\n```\n\nUse the below approach instead. Basically you need to replace a whole element.\n\n```js\ndocument.getElementById('seasonContainer').innerHTML = `\n   \u003ch2\n      i18n-pl=\"Lato\"\n      i18n-es=\"El verano\"\u003e\n      Summer\n   \u003c/h2\u003e`;\n```\n\nOr:\n\n```js\nconst newSeason = document.createElement('h2');\nnewSeason.innerHtml = 'Summer';\nnewSeason.setAttribute('i18n-pl', 'Lato');\nnewSeason.setAttribute('i18n-es', 'El verano');\n\noldSeason.replaceWith(newSeason);\n```\n\n## 💡 License\n\nThis project is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb4rtaz%2Fultimate-i18n-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb4rtaz%2Fultimate-i18n-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb4rtaz%2Fultimate-i18n-js/lists"}