i18next backend — lexisync

Wire i18next to load from LexiSync CDN, with saveMissing back into the working copy.

LexiSync ships an i18next backend that loads from the CDN and (optionally) writes missing keys back to the working copy.

import i18next from 'i18next';
import { LexiSyncBackend } from 'lexisync/i18next';

await i18next
  .use(LexiSyncBackend)
  .init({
    backend: {
      projectId: process.env.LEXISYNC_PROJECT_ID!,
      version: 'production',
      apiUrl: 'https://lexisync.app',
      apiKey: undefined, // CDN is public; only set for working-copy writes
    },
    fallbackLng: 'en',
    ns: ['common'],
    defaultNS: 'common',
  });

saveMissing

Pass apiKey with source:write scope to enable saveMissing. Missing keys are appended to the working copy as a revision with origin saveMissing.