{"id":22305704,"url":"https://github.com/muratgozel/regionist","last_synced_at":"2025-07-29T04:32:40.902Z","repository":{"id":42931893,"uuid":"239186971","full_name":"muratgozel/regionist","owner":"muratgozel","description":"Guesses the user's regional parameters on-device, in a reliable way.","archived":false,"fork":false,"pushed_at":"2024-03-24T01:40:37.000Z","size":1537,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-10T10:55:21.471Z","etag":null,"topics":["country","country-detection","javascript","language-detection","localization","timezone","timezone-detection"],"latest_commit_sha":null,"homepage":"https://muratgozel.github.io/regionist/","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/muratgozel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":null,"patreon":"muratgozel","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-02-08T18:52:02.000Z","updated_at":"2024-07-07T12:28:12.825Z","dependencies_parsed_at":"2024-07-07T12:28:02.816Z","dependency_job_id":"094d2c3d-464a-46d7-90c0-9d946ed8abb1","html_url":"https://github.com/muratgozel/regionist","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muratgozel%2Fregionist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muratgozel%2Fregionist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muratgozel%2Fregionist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muratgozel%2Fregionist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muratgozel","download_url":"https://codeload.github.com/muratgozel/regionist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227981888,"owners_count":17850920,"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":["country","country-detection","javascript","language-detection","localization","timezone","timezone-detection"],"created_at":"2024-12-03T19:12:50.694Z","updated_at":"2025-07-29T04:32:40.863Z","avatar_url":"https://github.com/muratgozel.png","language":"JavaScript","funding_links":["https://patreon.com/muratgozel","https://patreon.com/muratgozel?utm_medium=organic\u0026utm_source=github_repo\u0026utm_campaign=github\u0026utm_content=join_link","https://github.com/sponsors/muratgozel"],"categories":[],"sub_categories":[],"readme":"# regionist\nGuesses the user's regional parameters on-device.\n\nThis library relies on the `window` object of the user's browser. It guesses timezone, country and the preferred language. It's stateless. Only two methods: `guess` and `match`. As there is no %100 accurate way of detecting user's regional parameters, this library tries its chance by combinating the outputs of `window.Intl` and `window.navigator` objects.\n\n## Install\n```sh\nnpm i regionist\n```\nor inject with script tag:\n```html\n\u003cscript type=\"module\" src=\"https://cdn.jsdelivr.net/npm/regionist@7/dist/regionist.iife.js\"\u003e\u003c/script\u003e\n\n\u003cscript type=\"text/javascript\"\u003e\n    console.log(window.Regionist)\n\u003c/script\u003e\n```\n\n## Usage\n### guess\n```js\nimport { regionist } from 'regionist'\n// or\n// const { regionist } = require('regionist')\n\n// guess\nconst guessResult = regionist.guess()\n\nconsole.assert(guessResult === {\n    timezone: 'America/New_York', // timezone name as returned by window.Intl object\n    timezoneCountry: 'US', // mapped from the timezone\n    preferredLocale: 'tr-TR', // relies on window.navigator\n    preferredLanguage: 'tr' // it's just derived from preferredLocale\n})\n```\n\n### match\n```js\nimport { regionist } from 'regionist'\n\n// match, useful for finding the best matching locale against a list of supported locales\nconst bestLocale = regionist.match(['az-AZ', 'en-US', 'tr-TR'])\nconsole.assert(bestLocale === 'tr-TR') // because user's preferred locale is tr-TR\n\nconst bestLocale2 = regionist.match(['az_AZ', 'en_us', 'tr_tr'])\nconsole.assert(bestLocale === 'tr-TR') // always returns formatted\n```\n\n## Contributing\nIf you're interested in contributing, read the [CONTRIBUTING.md](https://github.com/muratgozel/muratgozel/blob/main/CONTRIBUTING.md) first, please.\n\n---\n\nThanks for the attention 💙 Any amount of support on [patreon](https://patreon.com/muratgozel?utm_medium=organic\u0026utm_source=github_repo\u0026utm_campaign=github\u0026utm_content=join_link) or [github](https://github.com/sponsors/muratgozel) will return you back as bug fixes, new features and bits and bytes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuratgozel%2Fregionist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuratgozel%2Fregionist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuratgozel%2Fregionist/lists"}