Socket
Socket
Sign inDemoInstall

code42day-i18n

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code42day-i18n

Stack of connect middleware for language/locale detection and translation.


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

NPM version Dependency Status

code42day-i18n

Stack of connect middleware for language/locale detection and translation.

  • detectLanguage - parse and detect browser language preference
  • overwriteLanguage - overwrite language selection with query param and/or cookie
  • gettext - insert simple gettext implementation in response

Also exposes parseAcceptLanguage - in case if you need parsed form of Accept-Language header for some other reason than language selection.

If you don't need this exact stack all of its components can be used separately.

Install

$ npm install --save code42day-i18n

Usage


var app = require('express');

var locale = {
  supportedLanguages: ['de', 'fr', 'pl', 'en-GB', 'en-US'],
  defaultLanguage: 'en',
  gettextAlias: '_'
};

var i18n = require('code42day-i18n');

app.use(i18n.overwriteLanguage(locale));
app.use(i18n.detectLanguage(locale));
app.use(i18n.gettext)(locale));


License

MIT © code42day

Keywords

FAQs

Package last updated on 13 Jul 2016

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