Class

useTranslation

useTranslation

Extends the useTranslation hook from react-i18next library.

Returns all the TranslateFunctions + methods returned by the original useTranslation method from react-i18next like: i18n instance and ready flag.

Type Definitions

object

# UseTranslationResponse

Extends TranslateFunctions. Apart from that it also returns all the properties defined below.

import { useTranslation } from 'admin-bro'

const MyComponent = () => {
  const { translateButton } = useTranslation()

  return (
    <Box>
      <Button variant="primary" onClick={...}>{translateButton('save')}<Button>
    </Box>
  )
}
Properties:
Name Type Description
... TranslateFunction

All functions defined in TranslateFunctions

t TFunction
i18n i18n

Current i18n instance.

ready boolean

Indicates if translation system is ready. In AdminBro it is always ready :).

View Source admin-bro/src/frontend/hooks/use-translation.ts, line 32

SoftwareBrothers

Proudly built and maintained by SoftwareBrothers

Software House with a passion for both JavaScript and TypeScript.

See what we do See what we believe in

Proudly built and maintained by

SoftwareBrothers