mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
17 lines
452 B
JavaScript
17 lines
452 B
JavaScript
import { useIntl, FormattedMessage } from 'react-intl';
|
|
import { messages, labels } from 'components/messages';
|
|
|
|
export function useMessages() {
|
|
const { formatMessage } = useIntl();
|
|
|
|
function getMessage(id) {
|
|
const message = Object.values(messages).find(value => value.id === id);
|
|
|
|
return message ? formatMessage(message) : id;
|
|
}
|
|
|
|
return { formatMessage, FormattedMessage, messages, labels, getMessage };
|
|
}
|
|
|
|
export default useMessages;
|