@open-xchange/i18next-plugin-pofile-backend
An i18next backend plugin that converts .po
files to i18next JSON data.
Usage
Create a plugin instance with a callback function that imports the .po
files.
Example:
import i18next from "i18next"
import pofileBackend from "@open-xchange/i18next-plugin-pofile-backend"
i18next.use(pofileBackend(async (lang, ns) =>
await import(`i18n/${lang}-${ns}.po`) as typeof import("*.po"))
)
Due to a bug in TypeScript, it is currently needed to explicitly declare the type of the imported module in TypeScript files (the as typeof import("*.po")
annotation).