CustomCallbackBackend
for i18next
This is a very simple i18next backend to be used in the browser or in the server. It allows you to tap in to i18next's callback to load resources without having to write the boilerplate yourself.
Getting started
Package can be downloaded via npm.
npm install i18next-callback-backend
Wiring up:
;; i18next;
- As with all modules you can either pass the constructor function (class) to the i18next.use or a concrete instance.
- If you don't use a module loader it will be added to
window.i18nextCustomCallbackBackend
Backend Options
// Callback used when loading a single resource. { // Your custom loading logic. ; } // Callback used when loading multiple resources. (Optional) { // Your custom loading logic. ; } // Callback used when saving resources. (Optional) { // Your custom saving logic. }
Options can be passed in:
preferred - by setting options.customLoad
, in i18next.init:
;; i18next;
on construction:
;const customCallbackBackend = null customLoad: /* your custom callback */ customLoadMulti: /* your custom callback */ customCreate: /* your custom callback */ ;
via calling init:
;const customCallbackBackend = ;customCallbackBackend;