# How to start with i18next in the node application

This article will show how to start [i18next](https://www.i18next.com/) in a node project.

# i18next
i18next is one of the libraries I included in my list of [5 interesting internationalization libraries](https://how-to.dev/5-javascript-internationalization-libraries-that-look-interesting). On the project page, it's called *internationalization-framework*, and indeed it looked the most complete from the libraries I checked.

# Package
To start, let's create a new package:
```
$ npm init -y
```

To make sure we can use es modules, let's add to `package.json`:
```JSON
...
  "type": "module",
...
```

# Dependecy
We can install i18next as a normal dependency with:
```
$ npm install --save i18next
npm WARN i18next-vanilla@1.0.0 No description
npm WARN i18next-vanilla@1.0.0 No repository field.

+ i18next@20.4.0
added 1 package from 1 contributor and audited 3 packages in 0.658s
found 0 vulnerabilities
```

# Code
The minimal code needed to experiment with the library is `index.js`:
```JS
import i18next from "i18next";

i18next
  .init({
    lng: "en",
    resources: {
      en: {
        translation: {
          hello_world: "hello world",
        },
      },
    },
  })
  .then((t) => {
    console.log(t("hello_world"));
  });
```

# Running
The code works as expected:
```shell
$ node index.js 
hello world
```

# Links
* [repository](https://github.com/how-to-js/i18next-vanilla)
* [branch](https://github.com/how-to-js/i18next-vanilla/tree/node-start)

%%[i18next]

# Summary
In this article, we have started playing with i18next. Stay tuned for the following parts!
