Skip to main content

useTranslate

Returns a translate(key, options?) function for translating message keys using the active i18n provider. Strato uses ICU MessageFormat, so options can include named variables for interpolation.

import { useTranslate } from '@strato-admin/core';

const WelcomeMessage = ({ name }: { name: string }) => {
const translate = useTranslate();
return <p>{translate('app.welcome', { name })}</p>;
};
ICU MessageFormat

Strato uses ICU MessageFormat (not react-intl simple format). Translation messages support plurals, selects, and named variables. See the Translation guide for details.

React-Admin reference

This hook is provided by react-admin. See the full documentation at marmelab.com/react-admin/useTranslate.html.