Using locize

Is it possible to integrate multiple projects in the same app/website?

Yes, this is possible, you can combine any project you want on your side. Just have a look at our API, and use the appropriate endpoint with the appropriate project-id.

Using i18next?

With i18next you can configure fallback backends to be used . This way you can simply add the i18next-locize-backend multiple times and pass in the appropriate options. This is all possible thanks to the chained backend.

import i18next from "i18next";
import ChainedBackend from "i18next-chained-backend";
import LocizeBackend from "i18next-locize-backend";
i18next
.use(ChainedBackend)
.init({
fallbackLng: "en",
// ... your i18next config
backend: {
backends: [
LocizeBackend,
LocizeBackend
],
backendOptions: [
{ // first project
projectId: "[PROJECTID]",
version: "[VERSION]",
referenceLanguage: "en"
},
{ // second project
projectId: "[PROJECTID]",
version: "[VERSION]",
referenceLanguage: "en"
}
]
}
});

Make sure your projects contain different namespace names. i.e. project 1: common, header, blog project 2: extended, mails, templates

The i18next-chained-backend will always take the first backend that returned some data. It will not check if the key you're looking for is present in the namespace.

We suggest not to use multiple backends in combination with saveMissing or updateMissing, because it may happen, that the trigger for this is based on stale data.

App / Website splitted in app specific and framework translations.

If you have some sort of shared component, like an own framework or a core module, which is shared accross multiple applications, we suggest to use separate i18next instances, each instance references its own locize project.