First setup help
Let's try to figure out what you need.

For which environment are you looking for an i18n solution?

There are a lot of appropriate libraries. Have a look at this list.

Special handling for serverless environments (AWS lambda, Google Cloud Functions, Azure Functions, etc...)

Make use of i18next-fs-backend
1
import i18next from 'i18next';
2
import Backend from 'i18next-fs-backend';
3
4
const backend = new Backend({
5
// path where resources get loaded from
6
loadPath: '/locales/{{lng}}/{{ns}}.json'
7
});
8
9
i18next
10
.use(backend)
11
.init({
12
// initImmediate: false, // setting initImediate to false, will load the resources synchronously
13
...opts,
14
...yourOptions
15
}); // yourOptions should not include backendOptions!
Copied!
or just import/require your files directly
1
import i18next from 'i18next';
2
import en from './locales/en.json'
3
import de from './locales/de.json'
4
5
i18next
6
.init({
7
...opts,
8
...yourOptions,
9
resources: {
10
en,
11
de
12
}
13
});
Copied!

Do you need a language detector for your environment?

Do you want to bundle the translations with your app?

Do you want to load the translations separate from your app via http?

Do you want to manage your translations with an awesome translation management system?

Last modified 4mo ago