Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@os-team/i18next-express-middleware

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@os-team/i18next-express-middleware

Middleware for i18next and express to detect the user's language.

  • 1.0.10
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

@os-team/i18next-express-middleware NPM version BundlePhobia

Middleware for i18next and express to detect the user's language.

Usage

Install the package using the following command:

yarn add @os-team/i18next-express-middleware

Install peer dependencies using the following command:

npx install-peerdeps @os-team/i18next-express-middleware

Example

import express from 'express';
import cookieParser from 'cookie-parser';
import i18next from 'i18next';
import {
  i18nextMiddleware,
  LanguageDetector,
} from '@os-team/i18next-express-middleware';

// Initialize i18next
i18next
  .use(LanguageDetector) // Pass the LanguageDetector middleware
  .init({
    fallbackLng: 'en',

    // Pass the custom options if necessary
    detection: {
      // In what order will the detectors be started
      order: ['cookie', 'header'], // default: ['header']

      // Keys used by the detectors
      cookie: 'custom-cookie', // default: i18next
      header: 'custom-header', // default: Accept-Language
    },
  });

const app = express();
app.use(cookieParser());
app.use(i18nextMiddleware(i18next));

FAQs

Package last updated on 05 Mar 2021

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