I18nKeyEditor

Wraps an i18n provider so every missing-key lookup is captured and surfaced in a floating panel. Inline-edit translations; Export emits a JSON patch to the clipboard.

Installation

pnpm dlx shadcn@latest add @shadmin/i18n-key-editor

Usage

import { Admin, I18nKeyEditor, Resource } from "@/components/admin";
 
const App = () => (
  <Admin dataProvider={myDataProvider} i18nProvider={myI18n}>
    <I18nKeyEditor baseProvider={myI18n}>
      <Resource name="posts" />
    </I18nKeyEditor>
  </Admin>
);

Props

PropRequiredTypeDefaultDescription
childrenRequiredReactNode-Tree to track
baseProviderRequiredI18nProvider-Original provider
defaultOpenOptionalbooleantruePanel state at mount
showExportOptionalbooleantrueShow Export button

Detection mechanism

A key is "missing" when baseProvider.translate(key) returns the literal key. That requires the provider to support allowMissing: true (the polyglot default). Translated keys are not captured.

Limitations

  • v1 only captures via useTranslate() calls; direct i18nProvider.translate(...) invocations are not observable through React context.
  • No filesystem write — export is clipboard-only.