New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hapi-locale-17

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-locale-17

Locale and language detection for Hapi v17

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
226
increased by9.71%
Maintainers
1
Weekly downloads
 
Created
Source

hapi-locale-17

Locale and language detection for Hapi Server v17.

Evaluates locale information from accept-language header and query parameter and attaches locale to request.locale available in all Hapi route handlers.

If a locale query parameter is provided, it has highest priority. Second priority is the accept-language http request header. Final priority is a fallback locale.

Target attribute request.locale and query parameter locale can be renamed.

Install

npm install --save hapi-locale-17

Example

const Hapi = require('hapi');
const HapiLocale = require('hapi-locale-17');

const server = new Hapi.Server({
  port: 3000,
});

const provision = async () => {
  await server.register({
    plugin: HapiLocale,
    options: {
      locales: ['de', 'en'], // your supported locales
      query: 'lang',         // name of query param, defaults to 'locale'
      attribute: 'lang',     // name of target attribute, defaults to 'locale'
    }
  });
  await server.start();
};

provision();

Keywords

FAQs

Package last updated on 16 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc