teableio/teable

View on GitHub
plugins/src/hooks/useInitializationZodI18n.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { z } from '@teable/openapi';
import { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { makeZodI18nMap } from 'zod-i18n-map';

export const useInitializationZodI18n = () => {
  const { t } = useTranslation();

  useEffect(() => {
    z.setErrorMap(makeZodI18nMap({ t }));
  }, [t]);
};