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

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

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