2.0.0 • Published 3 years ago

i18next-fluent v2.0.0

Weekly downloads
5,249
License
MIT
Repository
github
Last release
3 years ago

Introduction

Travis npm version David

This changes i18n format from i18next json to fluent Spec version 1.0.0

Getting started

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

# npm package
$ npm install i18next-fluent

Wiring up:

import i18next from "i18next";
import Fluent from "i18next-fluent";

i18next.use(Fluent).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.i18nextFluent

Samples

Options

{
  bindI18nextStore: true,
  fluentBundleOptions: { useIsolating: false }
}

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

import i18next from "i18next";
import Fluent from "i18next-fluent";

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

loading .ftl fluent flavored textfiles

You can use the i18next-fluent-backend to directly load fluent files in fluent syntax from the server.

more complete sample

import i18next from "i18next";
import Fluent from "i18next-fluent";

i18next.use(Fluent).init({
  lng: "en",
  resources: {
    en: {
      translation: {
        hello: "Hello { $name }."
      }
    }
  }
});

i18next.t("hello", { name: "fluent" }); // -> Hello fluent.

2.0.0

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.4

5 years ago

0.0.3

6 years ago

0.0.2

6 years ago