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

i18next-polyglot

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-polyglot

i18nFormat plugin to use airbnb/polyglot.js format with i18next

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Introduction

Travis Coveralls npm version David

This changes i18n format from i18next json to polyglot using airbnb/polyglot.js

Getting started

Source can be loaded via npm or downloaded from this repo.

# npm package
$ npm install i18next-polyglot

Wiring up:

import i18next from 'i18next';
import Polyglot from 'i18next-polyglot';

i18next
  .use(Polyglot)
  .init(i18nextOptions);
  • As with all modules you can either pass the constructor function (class) to the i18next.use or a concrete instance.
  • If you don't use a module loader it will be added to window.i18nextPolyglot

Backend Options

{
  // currently there are no extra options
}

Options can be passed in by setting options.i18nFormat in i18next.init:

import i18next from 'i18next';
import Polyglot from 'i18next-polyglot';

i18next
  .use(Polyglot)
  .init({
    i18nFormat: options
  });

more complete sample

import i18next from 'i18next';
import Polyglot from 'i18next-polyglot';

i18next
  .use(Polyglot)
  .init({
    lng: 'en',
    resources: {
      en: {
        translation: {
          "hello_name": "Hola, %{name}."
        }
      }
    }
  });

 i18next.t('hello_name', { name: "DeNiro" }); // -> "Hola, DeNiro."

Keywords

FAQs

Package last updated on 13 Apr 2018

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