Constructor
# <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 :). |