i18n: removes useTranslate hook (#106556)
* i18n: removes useTranslate hook * chore: fix duplicate imports * chore: fix import sorting and hook dependencies
This commit is contained in:
@@ -75,9 +75,8 @@ const ErrorMessage = ({ id, message }) => <Trans i18nKey={`errors.${id}`}>There
|
||||
Sometimes you may need to translate a string cannot be represented in JSX, such as `placeholder` props. Use the `t` macro for this.
|
||||
|
||||
```jsx
|
||||
import { useTranslate } from "@grafana/i18n"
|
||||
import { t } from "@grafana/i18n"
|
||||
|
||||
const { t } = useTranslate();
|
||||
const placeholder = t('form.username-placeholder','Username');
|
||||
|
||||
return <input type="value" placeholder={placeholder}>
|
||||
@@ -211,9 +210,8 @@ import { Trans } from '@grafana/i18n';
|
||||
```
|
||||
|
||||
```js
|
||||
import { useTranslate } from '@grafana/i18n';
|
||||
import { t } from '@grafana/i18n';
|
||||
|
||||
const { t } = useTranslate();
|
||||
const translatedString = t('inbox.heading', 'You got {{count}} messages', { count: messages.length });
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user