{"id":41284034,"url":"https://github.com/funny-bytes/hapi-locale-17","last_synced_at":"2026-01-23T02:58:36.791Z","repository":{"id":42344893,"uuid":"114393823","full_name":"funny-bytes/hapi-locale-17","owner":"funny-bytes","description":"Locale and language detection for HAPI server","archived":false,"fork":false,"pushed_at":"2025-09-24T12:15:21.000Z","size":1178,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-24T13:28:37.798Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/funny-bytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2017-12-15T17:07:07.000Z","updated_at":"2025-09-24T12:11:26.000Z","dependencies_parsed_at":"2025-08-18T22:33:03.914Z","dependency_job_id":"caaeddbf-7b84-438d-8993-377c22aa9672","html_url":"https://github.com/funny-bytes/hapi-locale-17","commit_stats":null,"previous_names":["frankthelen/hapi-locale-17"],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/funny-bytes/hapi-locale-17","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funny-bytes%2Fhapi-locale-17","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funny-bytes%2Fhapi-locale-17/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funny-bytes%2Fhapi-locale-17/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funny-bytes%2Fhapi-locale-17/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/funny-bytes","download_url":"https://codeload.github.com/funny-bytes/hapi-locale-17/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funny-bytes%2Fhapi-locale-17/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28679139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T01:00:35.747Z","status":"online","status_checked_at":"2026-01-23T02:00:08.296Z","response_time":59,"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":"2026-01-23T02:58:35.654Z","updated_at":"2026-01-23T02:58:36.786Z","avatar_url":"https://github.com/funny-bytes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hapi-locale-17\n\nLocale and language detection for Hapi Server.\n\n![main workflow](https://github.com/funny-bytes/hapi-locale-17/actions/workflows/main.yml/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/funny-bytes/hapi-locale-17/badge.svg)](https://coveralls.io/github/funny-bytes/hapi-locale-17)\n[![Maintainability](https://api.codeclimate.com/v1/badges/2b21f79b2657870c146f/maintainability)](https://codeclimate.com/github/funny-bytes/hapi-locale-17/maintainability)\n[![node](https://img.shields.io/node/v/hapi-locale-17.svg)]()\n[![code style](https://img.shields.io/badge/code_style-airbnb-brightgreen.svg)](https://github.com/airbnb/javascript)\n[![License Status](http://img.shields.io/npm/l/hapi-locale-17.svg)]()\n\nEvaluates locale information from `accept-language` header and query or path parameter.\nDecorates Hapi request object with `request.getLocale()` available in all route handlers.\n\nPriority of evaluation:\n(1) `locale` query parameter (if provided),\n(2) `locale` path parameter (if provided),\n(3) `accept-language` http request header,\n(4) fallback locale (the first locale in `locales` list).\n\nDecorated method `request.getLocale()` can be renamed.\nQuery and path parameters `locale` can be renamed or switched off.\n\nTested with\n\n* Hapi 20/21 on Node 22\n\n## Install\n\n```bash\nnpm install hapi-locale-17\n```\n\n## Usage\n\nRegister the plugin with Hapi server like this:\n\n```js\nconst Hapi = require('@hapi/hapi');\nconst HapiLocale = require('hapi-locale-17');\n\nconst server = new Hapi.Server({\n  port: 3000,\n});\n\nconst provision = async () =\u003e {\n  await server.register({\n    plugin: HapiLocale,\n    options: {\n      locales: ['de', 'en'], // your supported locales\n    }\n  });\n  await server.start();\n};\n\nprovision();\n```\n\nIn your route handler, do something like this:\n\n```js\nserver.route({\n  method: 'GET',\n  path: '/test',\n  handler: function (request, h) {\n    const locale = request.getLocale();\n    // ...\n  }\n});\n```\n\n## Options\n\nThe plugin provides the following options:\n\n| Option    | Default     | Description |\n|-----------|-------------|-------------|\n| `locales` | `[]`        | Your list of supported locales, e.g., `['de', 'en']` or `['en-US', 'es-ES']`. |\n| `query`   | `locale`    | Name of query parameter to evaluate. Set to `false` to switch off. |\n| `path`    | `locale`    | Name of path parameter to evaluate. Set to `false` to switch off. |\n| `method`  | `getLocale` | Name of method for request decoration, i.e., `request.getLocale()`. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunny-bytes%2Fhapi-locale-17","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffunny-bytes%2Fhapi-locale-17","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunny-bytes%2Fhapi-locale-17/lists"}