{"id":20817287,"url":"https://github.com/intlify/utils","last_synced_at":"2025-05-07T13:34:58.142Z","repository":{"id":195804077,"uuid":"693581642","full_name":"intlify/utils","owner":"intlify","description":"Collection of i18n utilities","archived":false,"fork":false,"pushed_at":"2025-02-25T19:51:23.000Z","size":712,"stargazers_count":16,"open_issues_count":12,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-20T18:41:26.929Z","etag":null,"topics":["i18n","internationalization","utilities"],"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/intlify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"kazupon"}},"created_at":"2023-09-19T10:04:06.000Z","updated_at":"2025-04-14T17:55:33.000Z","dependencies_parsed_at":"2024-01-28T17:42:26.658Z","dependency_job_id":"d8b039d5-2693-40ad-a230-6ea34be0ee46","html_url":"https://github.com/intlify/utils","commit_stats":null,"previous_names":["intlify/utils"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intlify%2Futils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intlify%2Futils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intlify%2Futils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intlify%2Futils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intlify","download_url":"https://codeload.github.com/intlify/utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252887561,"owners_count":21819923,"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":["i18n","internationalization","utilities"],"created_at":"2024-11-17T21:40:29.091Z","updated_at":"2025-05-07T13:34:58.119Z","avatar_url":"https://github.com/intlify.png","language":"TypeScript","funding_links":["https://github.com/sponsors/kazupon"],"categories":[],"sub_categories":[],"readme":"# @intilfy/utils\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![CI][ci-src]][ci-href]\n\nCollection of i18n utilities\n\n## 🌟 Features\n\n✅️ \u0026nbsp;**Modern:** ES Modules first and respect Web Standard and ECMAScript\nInternationalization APIs\n\n✅️ \u0026nbsp;**Compatible:** support CommonJS and various JS environments\n\n✅️️ \u0026nbsp;**Minimal:** Small and fully tree-shakable\n\n✅️️ \u0026nbsp;**Type Strong:** Written in TypeScript, with full JSdoc\n\n## 💿 Installation\n\n### 🐢 Node.js\n\n```sh\n# Using npm\nnpm install @intlify/utils\n\n# Using yarn\nyarn add @intlify/utils\n\n# Using pnpm\npnpm add @intlify/utils\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eUsing Edge Releases\u003c/summary\u003e\n\nIf you are directly using `@intlify/utils` as a dependency:\n\n```json\n{\n  \"dependencies\": {\n    \"@intlify/utils\": \"npm:@intlify/utils-edge@latest\"\n  }\n}\n```\n\n**Note:** Make sure to recreate lockfile and `node_modules` after reinstall to avoid hoisting issues.\n\n\u003c/details\u003e\n\n### 🦕 Deno\n\nYou can install via `import`.\n\nin your code:\n\n```ts\n/**\n * you can install via other CDN URL such as skypack,\n * or, you can also use import maps\n * https://docs.deno.com/runtime/manual/basics/import_maps\n */\nimport { ... } from 'https://deno.land/x/intlify_utils/mod.ts'\n\n// something todo\n// ...\n```\n\n### 🥟 Bun\n\n```sh\nbun install @intlify/utils\n```\n\n### 🌍 Browser\n\nin your HTML:\n\n```html\n\u003cscript type=\"module\"\u003e\n/**\n * you can install via other CDN URL such as skypack,\n * or, you can also use import maps\n */\nimport { isLocale } from 'https://esm.sh/@intlify/utils'\n\n// something todo\n// ...\n\u003c/script\u003e\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eUsing Edge Releases\u003c/summary\u003e\n\n```ts\nimport { isLocale } from 'https://esm.sh/@intlify/utils-edge'\n\n// something todo\n// ...\n```\n\n\u003c/details\u003e\n\n## 🍭 Playground\n\nYou can play the below examples:\n\n- 🐢 [Node.js](https://github.com/intlify/utils/tree/main/examples/node):\n  `npm run play:node`\n- 🦕 [Deno](https://github.com/intlify/utils/tree/main/examples/deno):\n  `npm run play:deno`\n- 🥟 [Bun](https://github.com/intlify/utils/tree/main/examples/bun):\n  `npm run play:bun`\n- 🌍 [Browser](https://github.com/intlify/utils/tree/main/examples/browser):\n  `npm run play:browser`\n\n## 🔨 Utilities\n\n### Common\n\n- `isLocale`\n- `toLocale`\n- `parseAcceptLanguage`\n- `validateLangTag`\n- `normalizeLanguageName`\n\nYou can do `import { ... } from '@intlify/utils'` the above utilities\n\n### Navigator\n\n- `getNavigatorLocales`\n- `getNavigatorLocale`\n\nYou can do `import { ... } from '@intlify/utils'` the above utilities\n\n\u003e [!NOTE]\n\u003e for Node.js You need to do `import { ... } from '@intlify/utils/node'`\n\n### HTTP\n\n- `getHeaderLanguages`\n- `getHeaderLanguage`\n- `getHeaderLocales`\n- `getHeaderLocale`\n- `getCookieLocale`\n- `setCookieLocale`\n- `getPathLocale`\n- `getQueryLocale`\n- `tryHeaderLocales`\n- `tryHeaderLocale`\n- `tryCookieLocale`\n- `tryPathLocale`\n- `tryQueryLocale`\n\nThe about utilies functions accpet Web APIs such as [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) and [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) that is supported by JS environments (such as Deno, Bun, and Browser)\n\n#### Specialized environments\n\nIf you will use Node.js and H3, You can do `import { ... } from '@intlify/utils/{ENV}'` the above utilities.\n\nThe namespace `{ENV}` is one of the following:\n\n- `node`: accpet `IncomingMessage` and `Outgoing` by Node.js [http](https://nodejs.org/api/http.html) module\n- `h3`: accept `H3Event` by HTTP framework [h3](https://github.com/unjs/h3)\n- `hono`: accept `Context` by edge-side web framework [hono](https://github.com/honojs/hono)\n\n## 🙌 Contributing guidelines\n\nIf you are interested in contributing to `@intlify/utils`, I highly recommend checking out [the contributing guidelines](/CONTRIBUTING.md) here. You'll find all the relevant information such as [how to make a PR](/CONTRIBUTING.md#pull-request-guidelines), [how to setup development](/CONTRIBUTING.md#development-setup)) etc., there.\n\n## ©️ License\n\n[MIT](http://opensource.org/licenses/MIT)\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/@intlify/utils?style=flat\u0026colorA=18181B\u0026colorB=FFAD33\n[npm-version-href]: https://npmjs.com/package/@intlify/utils\n[npm-downloads-src]: https://img.shields.io/npm/dm/@intlify/utils?style=flat\u0026colorA=18181B\u0026colorB=FFAD33\n[npm-downloads-href]: https://npmjs.com/package/@intlify/utils\n[ci-src]: https://github.com/intlify/utils/actions/workflows/ci.yml/badge.svg\n[ci-href]: https://github.com/intlify/utils/actions/workflows/ci.yml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintlify%2Futils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintlify%2Futils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintlify%2Futils/lists"}