Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

668 B
Raw Blame
import {
  type ContentTranslationTestSetupOptions,
  setupForContentTranslationTest,
} from "metabase/content-translation/test-utils";

import { useTranslateContent } from "../use-translate-content";

interface SetupOpts extends ContentTranslationTestSetupOptions {
  /** An untranslated string */
  msgid: string | null | undefined;
}

const TestComponent = ({ msgid }: { msgid?: string | null }) => {
  const tc = useTranslateContent();
  const msgstr = tc(msgid);
  return <>{msgstr}</>;
};

export function setup({ msgid, ...options }: SetupOpts) {
  return setupForContentTranslationTest({
    ...options,
    component: <TestComponent msgid={msgid} />,
  });
}