import { useCallback } from 'react'
import { useLocale } from '@meshkee/dashboard-ui'
import { translate, type BusinessMessageKey } from './messages'

export function useT() {
  const { locale } = useLocale()

  return useCallback(
    (key: BusinessMessageKey, vars?: Record<string, string | number>) =>
      translate(locale, key, vars),
    [locale],
  )
}
