@open-xchange/i18next-plugin-pofile-backend
v0.0.1
Published
An i18next backend plugin that reads `.po` files.
Downloads
527
Maintainers
Keywords
Readme
@open-xchange/i18next-plugin-pofile-backend
An i18next backend plugin that reads .po
files.
Usage
Create a plugin instance with a callback function that imports the .po
files.
Example:
// src/i18next.ts
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).