{"id":18930039,"url":"https://github.com/labd/next-intl-custom-paths","last_synced_at":"2025-10-05T09:45:53.714Z","repository":{"id":218526146,"uuid":"734289199","full_name":"labd/next-intl-custom-paths","owner":"labd","description":"Wrapper around next-intl for custom locale paths","archived":false,"fork":false,"pushed_at":"2024-02-02T16:47:46.000Z","size":174,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-16T09:50:43.680Z","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/labd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2023-12-21T10:13:26.000Z","updated_at":"2024-01-22T14:09:42.000Z","dependencies_parsed_at":"2024-01-22T15:26:25.387Z","dependency_job_id":"38b0a4b1-b285-4253-8a18-b47828b9a3a3","html_url":"https://github.com/labd/next-intl-custom-paths","commit_stats":null,"previous_names":["labd/next-intl-custom-paths"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/labd/next-intl-custom-paths","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fnext-intl-custom-paths","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fnext-intl-custom-paths/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fnext-intl-custom-paths/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fnext-intl-custom-paths/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labd","download_url":"https://codeload.github.com/labd/next-intl-custom-paths/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fnext-intl-custom-paths/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278437955,"owners_count":25986760,"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-05T02:00:06.059Z","response_time":54,"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":[],"created_at":"2024-11-08T11:36:20.593Z","updated_at":"2025-10-05T09:45:53.679Z","avatar_url":"https://github.com/labd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @labdigital/next-intl-custom-paths\n\nOpinionated wrapper around next-intl 3.0 for internationalization with custom paths.\n\nThis decouples the locale used in your codebase from the path. So for example `/en` can internally be used as `en-US`.\n\nIt's a bit opinionated and specific for our use cases for now:\n- Only supports localized path names, see [cprussin's comment](https://github.com/amannn/next-intl/issues/653#issuecomment-1823273158) on how to set something like this up for shared pathnames\n- Doesn't support saving the default locale based on cookie\n\nHeavily inspired by https://github.com/amannn/next-intl/issues/653#issuecomment-1823273158, thanks @cprussin.\n\n## Usage\n\nIn your middleware.ts add the following\n```ts\nimport { createNextIntlCustomPathMiddleware } from \"@labdigital/next-intl-custom-paths\";\n\nconst intlMiddleware = createNextIntlCustomPathMiddleware({\n\t\tdefaultLocale: \"en-US\",\n\t\tlocales: [\"en-US\", \"nl-NL\", \"de-DE\"],\n\t\tpathToLocaleMapping: {\n\t\t\t\"en\": \"en-US\",\n\t\t\t\"nl\": \"nl-NL\",\n\t\t\t\"de\": \"de-DE\",\n\t\t}\n\t});\n```\n\nYou can also edit all next-intl middleware arguments using the `nextIntlMiddlewareOptions` key, e.g.:\n\n```ts\nconst intlMiddleware = createNextIntlCustomPathMiddleware({\n\t\tdefaultLocale: \"en-US\",\n\t\tlocales: [\"en-US\", \"nl-NL\", \"de-DE\"],\n\t\tpathToLocaleMapping: {\n\t\t\t\"en\": \"en-US\",\n\t\t\t\"nl\": \"nl-NL\",\n\t\t\t\"de\": \"de-DE\",\n\t\t},\n\t\tnextIntlMiddlewareOptions: {\n\t\t\tlocaleDetection: false,\n\t\t\tpathnames: {\n\t\t\t\t\"/\": \"/\"\n\t\t\t}\n\t\t}\n\t});\n\n```\n\nThis package has it's own navigation helpers to translate path to locale, you should use these if you use our middleware:\n\n```ts\nimport { createLocalizedNavigation } from \"@labdigital/next-intl-custom-paths\";\n\nexport const { usePathname, useRouter, Link } = createLocalizedNavigation(\n\tlocales,\n\tdefaultLocale,\n\tlocalePrefix,\n\tpathToLocaleMapping,\n\tpathnames,\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fnext-intl-custom-paths","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabd%2Fnext-intl-custom-paths","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fnext-intl-custom-paths/lists"}