Hooks
Functions
useTranslation
useTranslation is a custom wrapper around next-intl's useTranslation.
Example
import useTranslation from '@/utils/hooks/useTranslation
const Example = () => {
const { t } = useTranslation()
return (
<div>
{t('hello')}
</div>
);
};
export default Example
Params
| param | Description | Type | Default |
|---|---|---|---|
| namespaces | Access the namespace of the translation message. | string | - |
| return | Description | Type | Default |
|---|---|---|---|
| t | A translation function that returns the translated string. It also provided other translation functions, refer to next-intl docs for more details usage. | (key: string, nameSpace?: string) => string | - |