{"id":19472367,"url":"https://github.com/aboutbits/internationalization","last_synced_at":"2025-05-05T21:46:49.554Z","repository":{"id":41183448,"uuid":"285558962","full_name":"aboutbits/internationalization","owner":"aboutbits","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-20T10:54:12.000Z","size":459,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-26T06:41:47.924Z","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/aboutbits.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","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":"2020-08-06T11:56:11.000Z","updated_at":"2025-03-20T10:54:15.000Z","dependencies_parsed_at":"2024-11-10T19:14:17.259Z","dependency_job_id":"51f48961-c9e4-4b91-9c13-27ecc198116e","html_url":"https://github.com/aboutbits/internationalization","commit_stats":{"total_commits":33,"total_committers":6,"mean_commits":5.5,"dds":0.5151515151515151,"last_synced_commit":"392a7f7fcfb99bf41a23cb7a74a6195935d4dbeb"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aboutbits%2Finternationalization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aboutbits%2Finternationalization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aboutbits%2Finternationalization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aboutbits%2Finternationalization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aboutbits","download_url":"https://codeload.github.com/aboutbits/internationalization/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252525597,"owners_count":21762331,"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-10T19:14:13.364Z","updated_at":"2025-05-05T21:46:49.530Z","avatar_url":"https://github.com/aboutbits.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Internationalization\n====================\n\n[![npm package](https://badge.fury.io/js/%40aboutbits%2Finternationalization.svg)](https://badge.fury.io/js/%40aboutbits%2Finternationalization)\n[![license](https://img.shields.io/github/license/aboutbits/internationalization)](https://github.com/aboutbits/internationalization/blob/master/license.md)\n\nThis package includes utilities for working with different languages in the browser. \nThis package works for client side rendered applications as well as for server side rendered applications.\n\n## Table of content\n\n- [Usage](#usage)\n- [Build \u0026 Publish](#build--publish)\n- [Information](#information)\n\n## Usage\n\nFirst, you have to install the package:\n\n```bash\nnpm install @aboutbits/internationalization\n```\n\nSecond, you can setup the tool with all supported languages and the fallback language and then detect the given browser language.\n\n```js\nimport { Internationalization } from '@aboutbits/internationalization'\n\nlet supportedLanguages = ['en', 'de', 'it']\nlet fallbackLanguage = 'en'\n\nlet i18n = new Internationalization(supportedLanguages, fallbackLanguage)\n\n// Fetches the language only from the user's browser\nlet browserLanguage = i18n.detectBrowserLanguage()\n\n// First check the cookies to see if a language is set. If not it will look in the browser.\n// You can also pass a requiest obejct with which the language can be recognized already during the server side rendering\nlet language = i18n.detectLanguage()\n\n// Sets a cookie with the specified language. \n// There exists also a static version of this method. \n// Ex. Internationalization.setLanguage(\"de\")\ni18n.setLanguage(\"de\")\n\nconsole.log(browserLanguage)\nconsole.log(language)\n```\n\n## Build \u0026 Publish\n\nTo build and publish the package, simply commit all changes and push them to master. Then run one of the following commands locally:\n\n```bash\nnpm version patch\nnpm version minor\nnpm version major\n```\n\n## Information\n\nAbout Bits is a company based in South Tyrol, Italy. You can find more information about us on [our website](https://aboutbits.it).\n\n### Support\n\nFor support, please contact [info@aboutbits.it](mailto:info@aboutbits.it).\n\n### Credits\n\n- [Alex Lanz](https://github.com/alexlanz)\n- [Martin Malfertheiner](https://github.com/mmalfertheiner)\n- [All Contributors](../../contributors)\n\n### License\n\nThe MIT License (MIT). Please see the [license file](license.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faboutbits%2Finternationalization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faboutbits%2Finternationalization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faboutbits%2Finternationalization/lists"}